arendjr / PlainText

Text-based MUD game engine
GNU Affero General Public License v3.0
78 stars 17 forks source link

LOOK getting longer each time it is executed. #6

Closed two-first-names closed 11 years ago

two-first-names commented 11 years ago

I've no idea what is causing this, but I'm getting a very odd bug where the dynamic description gets bigger each time I LOOK

For reference, here is what I'm getting: Market Street

Leading up to the market square, the street is filled with little shops that hope to get attention from those going to and from the market. To your left is shoe store and the shoe store. To your right is tea house and the tea house. In the distance, you see a beggar. Obvious exits: north, south, shoe store, tea house. You see a cat. (22H 20M) l

Market Street

Leading up to the market square, the street is filled with little shops that hope to get attention from those going to and from the market. To your left are two , the shoe store and the shoe store. To your right are two , the tea house and the tea house. In the distance, you see a beggar. Obvious exits: north, south, shoe store, tea house. You see a cat. (22H 20M) l

Market Street

Leading up to the market square, the street is filled with little shops that hope to get attention from those going to and from the market. To your left are three , the shoe store, the shoe store and the shoe store. To your right are three , the tea house, the tea house and the tea house. In the distance, you see a beggar. Obvious exits: north, south, shoe store, tea house. You see a cat. (22H 20M) l

Market Street

Leading up to the market square, the street is filled with little shops that hope to get attention from those going to and from the market. To your left are four , the shoe store, the shoe store, the shoe store and the shoe store. To your right are four , the tea house, the tea house, the tea house and the tea house. In the distance, you see a beggar. Obvious exits: north, south, shoe store, tea house. You see a cat.

arendjr commented 11 years ago

Hm, looks like an annoying bug indeed! I'll look into it as soon as I can.

In the mean time, can I ask what version of Qt you are using? Thanks!

two-first-names commented 11 years ago

Qt5.0.2. Thanks.

two-first-names commented 11 years ago

Just noticed something, they're portals, yet the code in question (describeCharactersRelativeTo) is expecting characters.

arendjr commented 11 years ago

Yep, that indeed was related to the issue. But the real problem was the groupsTemplate was no longer copied using a deep clone after I introduced underscore.js. 82981e9 should fix it. Can you verify? Thanks!

arendjr commented 11 years ago

Oops, I just committed some experimental with that commit as well... ah, nevermind, it should do no harm :)

two-first-names commented 11 years ago

Actually, it looks to be an issue with the stuff in the ItemTexts array in Room.lookAtBy, I just commented it out and it looks fine. Of course, far from a fix. ;)

two-first-names commented 11 years ago

I'm willing to bet the issue is in this:

if (hasDynamicPortals)
  portalGroups[key].forEach(function(portal) {
    combinedItems.append(portal.nameWithDestinationFromRoom(self));
  });
}
arendjr commented 11 years ago

Yeah, I made a small adjustment to that code as well. But the root problem was because the portalGroups that code uses were coming out of VisualUtil.dividePortalsAndCharactersIntoGroups() which kept reusing the same data structure, instead of providing a fresh one each time as it should. Could you try if it works for you with the latest commit?

two-first-names commented 11 years ago

Much better! Thank you!

arendjr commented 11 years ago

Welcome :)