Old documentation would not have helped.
Here is the code from the old version:
Code:
/**
* @return Text content of this node and it's subelements.
*/
public StringBuffer getText() {
StringBuffer text = new StringBuffer();
for (int i = 0; i < children.size(); i++) {
Object item = children.get(i);
if (item instanceof ContentToken) {
text.append( ((ContentToken)item).getContent() );
} else if (item instanceof TagNode) {
StringBuffer subtext = ((TagNode)item).getText();
text.append(subtext);
}
}
return text;
}
And here is the code from the new version:
Code:
/**
* @return Text content of this node and it's subelements.
*/
public CharSequence getText() {
StringBuilder text = new StringBuilder();
for (Object item :children) {
if (item instanceof ContentNode) {
text.append(((ContentNode) item).getContent());
} else if (item instanceof TagNode) {
CharSequence subtext = ((TagNode) item).getText();
text.append(subtext);
}
}
return text;
}
I don't see a functional difference.
Looking at this more closely, I did not identify the root cause. With the old version, the HTML parse tree looks like this:
Code:
<p>
<center>
You win the fight!
<!--WINWINWIN-->
<p>
<p>
Your Evilometer emits a single beep. The air in this part of the crypt smells slightly less evil...
<p>
<p>
<!--familiarmessage-->
<center>
<table>
<tbody>
<tr>
<td align="center" valign="center">
<img src="https://s3.amazonaws.com/images.kingdomofloathing.com/itemimages/godlob.gif" width="30" height="30">
<td valign="center">
<i>
Klugh
God Lobster touches you and your foe each with one tentacle and transfers their failing life energy.
And I get this in my session log:
Round 2: Veracity wins the fight!
After Battle: Your Evilometer emits a single beep. The air in this part of the crypt smells slightly less evil...
After Battle: Klugh God Lobster touches you and your foe each with one tentacle and transfers their failing life energy.
Whereas with the new version, this is the HTML parse tree:
Code:
<p>
<center>
You win the fight!
<!--WINWINWIN-->
<p>
<p>
Your Evilometer emits a single beep. The air in this part of the crypt smells slightly less evil...
<p>
<p>
<!--familiarmessage-->
<center>
<table>
<tbody>
<tr>
<td align="center" valign="center">
<img src="https://s3.amazonaws.com/images.kingdomofloathing.com/itemimages/godlob.gif" width="30" height="30">
<td valign="center">
<i>
Hoare
God Lobster reaches out his rod
<i>
brand
touches you.
And I get this in my session log:
Round 2: You win the fight!Your Evilometer emits a single beep. The air in this part of the crypt smells slightly less evil...Hoare God Lobster reaches out his rod brand touches you.You gain 18 hit points.You gain 11 Mojo Points.You gain 51 MeatVague Summer gives you some meat under the table.You gain 11 Meat.You acquire an item: bland half-sized ghuol eggYou acquire an item: ghuol earsYour God Lobster imparts knowledge directly into your mind. (+8 Stats)You gain 5 Strongness.You gain 18 Wizardliness.You gain 25 Smarm.You catch a line from the song playing on your SongBoom™ BoomBox:"And the way the terroir plays upon the taste,"You take a sip of your Guarna and ink Latte with oil paint.Adventure Again (The Defiled Cranny)Go back to The Defiled Cyrptparent.charpane.location.href="charpane.php";
Notice that the old HTML cleaner did not mske the <center> the child of the <p>, whereas the new one does. THAT is the root cause.
(Note also that those were from different fights.)
With the change I submitted, this is what "test fight 1" prints for the fight:
Round 2: gaunt ghuol takes 105 damage.
Round 2: Veracity wins the fight!
After Battle: Your Evilometer emits a single beep. The air in this part of the crypt smells slightly less evil...
After Battle: Hoare God Lobster reaches out his rod brand touches you.
After Battle: You gain 18 hit points
After Battle: You gain 11 Mojo Points
You gain 51 Meat
You gain 11 Meat.
You acquire an item: ghuol egg
You acquire an item: ghuol ears
After Battle: Your God Lobster imparts knowledge directly into your mind. (+8 Stats)
After Battle: You gain 5 Strongness
After Battle: You gain 18 Wizardliness
After Battle: You gain 25 Smarm
So, it worked, somehow.
(I also notice that it did not log "Vague Summer gives you some meat under the table" although it did log "You gain 11 Meat."
Messages from your horse are not tagged with <!--familiarmessage-->, which probably would make those automatically log. A pity.