diff --git a/SPD-classes/src/main/java/com/watabou/utils/Highlighter.java b/SPD-classes/src/main/java/com/watabou/utils/Highlighter.java
deleted file mode 100644
index b9c355a14..000000000
--- a/SPD-classes/src/main/java/com/watabou/utils/Highlighter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Pixel Dungeon
- * Copyright (C) 2012-2015 Oleg Dolya
- *
- * Shattered Pixel Dungeon
- * Copyright (C) 2014-2022 Evan Debenham
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see
- */
-
-package com.watabou.utils;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Highlighter {
-
- private static final Pattern HIGHLIGHTER = Pattern.compile( "_(.*?)_" );
- private static final Pattern STRIPPER = Pattern.compile( "[ \n]" );
-
- public String text;
-
- public boolean[] mask;
-
- public Highlighter( String text ) {
-
- String stripped = STRIPPER.matcher( text ).replaceAll( "" );
- mask = new boolean[stripped.length()];
-
- Matcher m = HIGHLIGHTER.matcher( stripped );
-
- int pos = 0;
- int lastMatch = 0;
-
- while (m.find()) {
- pos += (m.start() - lastMatch);
- int groupLen = m.group( 1 ).length();
- for (int i=pos; i < pos + groupLen; i++) {
- mask[i] = true;
- }
- pos += groupLen;
- lastMatch = m.end();
- }
-
- m.reset( text );
- StringBuffer sb = new StringBuffer();
- while (m.find()) {
- m.appendReplacement( sb, m.group( 1 ) );
- }
- m.appendTail( sb );
-
- this.text = sb.toString();
- }
-
- public boolean[] inverted() {
- boolean[] result = new boolean[mask.length];
- for (int i=0; i < result.length; i++) {
- result[i] = !mask[i];
- }
- return result;
- }
-
- public boolean isHighlighted() {
- for (int i=0; i < mask.length; i++) {
- if (mask[i]) {
- return true;
- }
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/SPD-classes/src/main/java/com/watabou/utils/PointF.java b/SPD-classes/src/main/java/com/watabou/utils/PointF.java
index 367890158..d118b5446 100644
--- a/SPD-classes/src/main/java/com/watabou/utils/PointF.java
+++ b/SPD-classes/src/main/java/com/watabou/utils/PointF.java
@@ -146,11 +146,6 @@ public class PointF {
public static float angle( PointF start, PointF end ) {
return (float)Math.atan2( end.y - start.y, end.x - start.x );
}
-
- @Override
- public String toString() {
- return "" + x + ", " + y;
- }
@Override
public boolean equals(Object o) {
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java
index 57d270b6b..99384b992 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Badges.java
@@ -261,7 +261,7 @@ public class Badges {
String names[] = new String[badges.size()];
for (Badge badge:badges) {
- names[count++] = badge.toString();
+ names[count++] = badge.name();
}
bundle.put( BADGES, names );
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java
index 290a8fedb..2ea14aea8 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java
@@ -115,7 +115,7 @@ public class Burning extends Buff implements Hero.Doom {
if (!burnable.isEmpty()){
Item toBurn = Random.element(burnable).detach(hero.belongings.backpack);
- GLog.w( Messages.get(this, "burnsup", Messages.capitalize(toBurn.toString())) );
+ GLog.w( Messages.get(this, "burnsup", Messages.capitalize(toBurn.title())) );
if (toBurn instanceof MysteryMeat || toBurn instanceof FrozenCarpaccio){
ChargrilledMeat steak = new ChargrilledMeat();
if (!steak.collect( hero.belongings.backpack )) {
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java
index 60ba75965..c15dd3c67 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java
@@ -71,7 +71,7 @@ public class Frost extends FlavourBuff {
if (!freezable.isEmpty()){
Item toFreeze = Random.element(freezable).detach( hero.belongings.backpack );
- GLog.w( Messages.get(this, "freezes", toFreeze.toString()) );
+ GLog.w( Messages.get(this, "freezes", toFreeze.title()) );
if (toFreeze instanceof Potion){
((Potion) toFreeze).shatter(hero.pos);
} else if (toFreeze instanceof MysteryMeat){
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java
index c4f5c6d22..bb9038c5d 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java
@@ -87,7 +87,7 @@ public class PinCushion extends Buff {
public String desc() {
String desc = Messages.get(this, "desc");
for (Item i : items){
- desc += "\n" + i.toString();
+ desc += "\n" + i.title();
}
return desc;
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java
index 551f310ad..5a3730dba 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java
@@ -348,15 +348,14 @@ public class Heap implements Bundlable {
items.clear();
}
- @Override
- public String toString(){
+ public String title(){
switch(type){
case FOR_SALE:
Item i = peek();
if (size() == 1) {
- return Messages.get(this, "for_sale", Shopkeeper.sellPrice(i), i.toString());
+ return Messages.get(this, "for_sale", Shopkeeper.sellPrice(i), i.title());
} else {
- return i.toString();
+ return i.title();
}
case CHEST:
return Messages.get(this, "chest");
@@ -371,7 +370,7 @@ public class Heap implements Bundlable {
case REMAINS:
return Messages.get(this, "remains");
default:
- return peek().toString();
+ return peek().title();
}
}
@@ -436,7 +435,7 @@ public class Heap implements Bundlable {
public void storeInBundle( Bundle bundle ) {
bundle.put( POS, pos );
bundle.put( SEEN, seen );
- bundle.put( TYPE, type.toString() );
+ bundle.put( TYPE, type );
bundle.put( ITEMS, items );
bundle.put( HAUNTED, haunted );
bundle.put( AUTO_EXPLORED, autoExplored );
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java
index 600ca5e83..1911ee6a2 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java
@@ -424,9 +424,8 @@ public class Item implements Bundlable {
public static void evoke( Hero hero ) {
hero.sprite.emitter().burst( Speck.factory( Speck.EVOKE ), 5 );
}
-
- @Override
- public String toString() {
+
+ public String title() {
String name = name();
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java
index f0f2b1423..b27d44be8 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ItemStatusHandler.java
@@ -79,7 +79,7 @@ public class ItemStatusHandler {
public void save( Bundle bundle ) {
for (int i=0; i < items.length; i++) {
- String itemName = items[i].toString();
+ String itemName = items[i].getSimpleName();
bundle.put( itemName + PFX_LABEL, itemLabels.get( items[i] ) );
bundle.put( itemName + PFX_KNOWN, known.contains( items[i] ) );
}
@@ -90,7 +90,7 @@ public class ItemStatusHandler {
for (Item item : itemsToSave){
if (items.contains(item.getClass())){
Class extends T> cls = items.get(items.indexOf(item.getClass()));
- String itemName = cls.toString();
+ String itemName = cls.getSimpleName();
bundle.put( itemName + PFX_LABEL, itemLabels.get( cls ) );
bundle.put( itemName + PFX_KNOWN, known.contains( cls ) );
}
@@ -102,7 +102,7 @@ public class ItemStatusHandler {
for (Class cls : clsToSave){
if (items.contains(cls)){
Class extends T> toSave = items.get(items.indexOf(cls));
- String itemName = toSave.toString();
+ String itemName = toSave.getSimpleName();
bundle.put( itemName + PFX_LABEL, itemLabels.get( toSave ) );
bundle.put( itemName + PFX_KNOWN, known.contains( toSave ) );
}
@@ -116,7 +116,12 @@ public class ItemStatusHandler {
for (int i=0; i < items.length; i++) {
Class extends T> item = items[i];
- String itemName = item.toString();
+ String itemName = item.getSimpleName();
+
+ //pre-1.4.0 saves
+ if (!bundle.contains( itemName + PFX_LABEL )){
+ itemName = item.toString();
+ }
if (bundle.contains( itemName + PFX_LABEL )) {
@@ -137,7 +142,7 @@ public class ItemStatusHandler {
for (Class extends T> item : unlabelled){
- String itemName = item.toString();
+ String itemName = item.getSimpleName();
int index = Random.Int( labelsLeft.size() );
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java
index f43bd5985..9a80417d5 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java
@@ -88,9 +88,9 @@ public abstract class KindofMisc extends EquipableItem {
new WndOptions(new ItemSprite(this),
Messages.get(KindofMisc.class, "unequip_title"),
Messages.get(KindofMisc.class, "unequip_message"),
- miscs[0] == null ? "---" : Messages.titleCase(miscs[0].toString()),
- miscs[1] == null ? "---" : Messages.titleCase(miscs[1].toString()),
- miscs[2] == null ? "---" : Messages.titleCase(miscs[2].toString())) {
+ miscs[0] == null ? "---" : Messages.titleCase(miscs[0].title()),
+ miscs[1] == null ? "---" : Messages.titleCase(miscs[1].title()),
+ miscs[2] == null ? "---" : Messages.titleCase(miscs[2].title())) {
@Override
protected void onSelect(int index) {
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java
index 5af2f6a7d..1a99f3676 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java
@@ -231,11 +231,11 @@ public class DriedRose extends Artifact {
desc += "\n";
if (weapon != null) {
- desc += "\n" + Messages.get(this, "desc_weapon", weapon.toString());
+ desc += "\n" + Messages.get(this, "desc_weapon", weapon.title());
}
if (armor != null) {
- desc += "\n" + Messages.get(this, "desc_armor", armor.toString());
+ desc += "\n" + Messages.get(this, "desc_armor", armor.title());
}
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java
index 70f8ebdd8..6ed5967c2 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java
@@ -290,7 +290,7 @@ public class Ring extends KindofMisc {
levelsToID -= levelPercent;
if (levelsToID <= 0){
identify();
- GLog.p( Messages.get(Ring.class, "identify", toString()) );
+ GLog.p( Messages.get(Ring.class, "identify", title()) );
Badges.validateItemLevelAquired( this );
}
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java
index 188261215..c6bd416c9 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java
@@ -116,7 +116,7 @@ public class Notes {
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
- bundle.put( LANDMARK, landmark.toString() );
+ bundle.put( LANDMARK, landmark.name() );
}
}
@@ -137,7 +137,7 @@ public class Notes {
@Override
public String desc() {
- return key.toString();
+ return key.title();
}
public Class extends Key> type(){
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java
index 11aca52de..a5dc4d040 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java
@@ -1390,7 +1390,7 @@ public class GameScene extends PixelScene {
for (Object obj : objects){
if (obj instanceof Hero) names.add(((Hero) obj).className().toUpperCase(Locale.ENGLISH));
else if (obj instanceof Mob) names.add(Messages.titleCase( ((Mob)obj).name() ));
- else if (obj instanceof Heap) names.add(Messages.titleCase( ((Heap)obj).toString() ));
+ else if (obj instanceof Heap) names.add(Messages.titleCase( ((Heap)obj).title() ));
else if (obj instanceof Plant) names.add(Messages.titleCase( ((Plant) obj).name() ));
else if (obj instanceof Trap) names.add(Messages.titleCase( ((Trap) obj).name() ));
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java
index 5d6c79891..c850399de 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java
@@ -295,7 +295,7 @@ public class BuffIndicator extends Component {
@Override
protected String hoverText() {
- return Messages.titleCase(buff.toString());
+ return Messages.titleCase(buff.name());
}
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java
index 4ef7877d1..eed4373da 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java
@@ -51,14 +51,14 @@ public class IconTitle extends Component {
public IconTitle( Item item ) {
ItemSprite icon = new ItemSprite();
icon( icon );
- label( Messages.titleCase( item.toString() ) );
+ label( Messages.titleCase( item.title() ) );
icon.view( item );
}
public IconTitle( Heap heap ){
ItemSprite icon = new ItemSprite();
icon( icon );
- label( Messages.titleCase( heap.toString() ) );
+ label( Messages.titleCase( heap.title() ) );
icon.view( heap );
}
diff --git a/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSLauncher.java b/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSLauncher.java
index 74df91ebd..d7057952f 100644
--- a/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSLauncher.java
+++ b/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSLauncher.java
@@ -63,12 +63,12 @@ public class IOSLauncher extends IOSApplication.Delegate {
});
try {
- Game.version = NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleVersionString").toString();
+ Game.version = NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleVersionString").description();
} catch (Exception e) {
Game.version = "???";
}
try {
- Game.versionCode = Integer.parseInt(NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleVersion").toString());
+ Game.versionCode = Integer.parseInt(NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleVersion").description());
} catch (Exception e) {
Game.versionCode = 0;
}