matoom/frostbite

Broken parsing of the room exits in a Temple in Crossing

Closed this issue · 11 comments

Here how it looks like in a Game window:

>
A stocky acolyte leads you clockwise.
<component id='room exits'>Obvious paths: clockwise, widdershins.
<compass></compass></component>
[Resurrection Creche, Chamber of Rains]
Softly luminous gaethzen orbs hang suspended from polished brass chains.  The delicate-looking globes are draped with gauzy fabric in a myriad of soft blues and greens.  The veined granite of the far wall has been chiseled into a three-dimensional mural resembling lush foliage.  Gentle pattering laughter of a spring shower fills the room as water from a hidden source cascades in wide rivulets down the sculpted flora.  Large tapestry cushions carpet the floor with embroidered verdure.  You also see a stocky acolyte.
Obvious paths: clockwise, widdershins.

Relevant dump from the debug.log:

A stocky acolyte leads you clockwise.
<nav/>
<streamWindow id='main' title='Story' subtitle=" - [The Crossing Temple, Hallway]" location='center' target='drop'/>
<streamWindow id='room' title='Room' subtitle=" - [The Crossing Temple, Hallway]" location='center' target='drop' ifClosed='' resident='true'/>
<component id='room desc'>Light streams out from a torch set into a pedestal in the center of the room, creating distorted shadows on the curved walls.  Securely mounted along the outer curve is a display of battle-worn weapons, all old but obviously well cared for.  The presence of such items within the peaceful solemnity of the Temple acts as a grim reminder of the dangers in the outside world.</component>
<component id='room objs'>You also see <pushBold/>a stocky acolyte<popBold/>.</component>
<component id='room players'></component>
<component id='room exits'>Obvious paths: clockwise, widdershins.
<compass></compass></component>
<component id='room extra'></component>
<resource picture="0"/><style id="roomName" />[The Crossing Temple, Hallway]
<style id=""/><preset id='roomDesc'>Light streams out from a torch set into a pedestal in the center of the room, creating distorted shadows on the curved walls.  Securely mounted along the outer curve is a display of battle-worn weapons, all old but obviously well cared for.  The presence of such items within the peaceful solemnity of the Temple acts as a grim reminder of the dangers in the outside world.</preset>  You also see <pushBold/>a stocky acolyte<popBold/>.
Obvious paths: clockwise, widdershins.
<compass></compass><component id='room objs'>You also see <pushBold/>a stocky acolyte<popBold/>.</component>
<component id='room players'></component>
<prompt time="1623185006">&gt;</prompt>

Apparently this is because of the newline in the room exits component:

<component id='room exits'>Obvious paths: clockwise, widdershins.
<compass></compass></component>

Yea, i'll have to take a look but my PC crashed last week and i'm still trying to set everything up again.

Probably can't fix it until network decoupling is finished though? This might interfere with changes made to XmlParserThread.

They might be fixed independently probably. I might take a look at it as well later, been trying to play instead of code lately :)

I pushed a fix for this to master. Had to put in some preprocessing to make component tags into a consistent xml element. It's not ideal but sometimes these hacks are necessary, i've already applied same approach for streams.

Verified, works for me at first glance.

Wait, there is some trouble now with parsing hyperlinks when ask for DIRECTIONS, i.e. DIR Shipyard 10. Only second is parsed and the rest is stripped away. Not sure if it is not something broken in an engine or by this fix.

I did some debugging and i think the underlying cause is somewhere in the "processCommands" in xml parser.

DIR works when you first log in until you get the "news" and "e-pedia" links and stops working after that.

>DIR Shipyard 10
Directions towards Barana's Shipyard: South, South, East, East, East, GO shipyard gate, and you're there.
>dir stop
The direction reminder has been shut off.
>
    ********************SPECIAL EVENT ENDING********************
                      Guild Fest 2021 is here!
              Grab your lirums and find the fairground
             a few steps southward from Theren's gates!
 
          The FESTIVAL verb is updated with dates and more!
                  Check Elanthipedia for more info!
 
             Event ends Sunday, June 20th (Prime and TF)
    ********************SPECIAL EVENT ENDING********************
 
>
******************************************************
*** Please check NEWS NEXT for unread NEWS items. ***
******************************************************
>DIR Shipyard 10
Directions towards Barana's Shipyard: GO shipyard gate, and you're there.

The issue seems to be resolved when commenting out "processCommands" method but i'm not sure exactly what's going wrong here. Maybe the regular expression? The ".*" is kind of suspect at first glance, since it generally matches everything.

It also seems that when you press "NEWS" the DIR issue goes away.

And what i don't get is when i comment out "processCommands" all the links are still functional?

Hm, there is a HyperlinkService::createLink call in filterPlainText method, which creates the links. Maybe I overdid with commands around.

Yep, i think just removing processCommands should do the trick? I've tested with different scenarios and the only difference i can see is that it only breaks things but doesn't really add much of anything?

mock.xml:

Directions towards Barana's Shipyard: <d cmd="South">South</d>, <d cmd="South">South</d>, <d cmd="East">East</d>, <d cmd="East">East</d>, <d cmd="East">East</d>, <d cmd="GO shipyard gate">GO shipyard gate</d>, and you're there.
<prompt time="1624214458">&gt;</prompt>

I added debugs in the code, 1 in the start and 2 in the end:

QString XmlParserThread::processCommands(QString line) {
    qDebug() << "1: " << line;
newLine.append(QStringRef(&line, lastPos, line.length() - lastPos));
qDebug() << "2: " << newLine;
return newLine;

output:
1: "Directions towards Barana's Shipyard: <d cmd=\"South\">South</d>, <d cmd=\"South\">South</d>, <d cmd=\"East\">East</d>, <d cmd=\"East\">East</d>, <d cmd=\"East\">East</d>, <d cmd=\"GO shipyard gate\">GO shipyard gate</d>, and you're there."
2: "Directions towards Barana's Shipyard: <a href=\"f://a/U291dGgiPlNvdXRoPC9kPiwgPGQgY21kPSJTb3V0aCI+U291dGg8L2Q+LCA8ZCBjbWQ9IkVhc3QiPkVhc3Q8L2Q+LCA8ZCBjbWQ9IkVhc3QiPkVhc3Q8L2Q+LCA8ZCBjbWQ9IkVhc3QiPkVhc3Q8L2Q+LCA8ZCBjbWQ9IkdPIHNoaXB5YXJkIGdhdGU=\">GO shipyard gate</a>, and you're there."

And i wanted to point out that i'm no longer able to reproduce this in game because the special event notice was removed as of yesterday. Which i already suspected of causing this issue and now it's confirmed.

I think we should still try to fix though.

Yes, it looks like the processCommands is not necessary and could be removed. It looks like everything works for me now as well as soon as I removed it.