Error when deleting SetDressing


#1

Issue: Receive error when removing setdressing object.
Crash (y/n): Yes.
Platform (Windows/Mac/Linux): Windows (10)
Description: Placing at setdressing item (such as a castle or palace) and adding the maximum allowed number of blocks will crash the game when you try to remove it.

I’ve tried it out a few times, I placed a castle and removed it, nothing went wrong. Placed a palace and removed it, nothing went wrong. Placed a castle, added as many blocks as I could to it, and removed it - crash. Same for the Palace.
If I max out blocks, save, and load the game, I am able to destroy without the game crashing.
I’ve attached the error message below.
setdressingerror


#2

Wow; that’s a real crash!

Most of the “crashes” we see are actually failed assertions; I notice that something unexpected is happening in the code and intentionally “crash” the game in a controlled way so that I can generate debugging information to help me track it down, but this one is an an actual crash!

Okay. Debugging shows that what’s happened here;

You may remember me talking about “Advertisers” and the “AdvertiserManager”, in previous bug reports. “Advertisers” are things which provide activities for subscribers to do (fighting monsters, buying swords, chatting with groups of other people, etc), and the “AdvertiserManager” for a region keeps track of what Advertisers exist in that region. Here’s what was going on in this crash:

When its model is being created, buildings register themselves with the AdvertiserManager. Here are the bugs:

  1. “Set Dressing” buildings actually don’t provide any activities; they’re just scenery, so they really shouldn’t be registering themselves with the AdvertiserManager at all.
  2. “Set Dressing” buildings rebuild their models every time extra blocks are added to them, which means that they were re-registering to the AdvertiserManager each time their model changed; really, they only should have registered once. Sub-bugs:
    a. When registering to an advertiser manager, the advertiser should automatically unregister from whatever manager it had been registered with before, if it had previously been registered. It previously wasn’t doing that.
    b. When registering an advertiser, the advertiser manager should validate that it isn’t already registered; don’t add it to the list of advertisers again, if it’s already on the list of advertisers!

So. What was happening was that when you added blocks to the building, it was re-registering to the advertiser manager and being listed multiple times. When the building was then destroyed, it only de-registered one time, leaving potentially many listings with the advertiser manager. The next time somebody went looking for something to do, the game tried to find out what activities were being offered by that destroyed building, and everything crashed since the building didn’t exist any longer.

To make a long story short (too late), there were a whole bunch of bugs around this, and fixing any single one of them would have prevented this crash. I’ve now fixed 1, 2, and 2b, and am currently working on sorting out 2a.

I’m kind of a fan of fixing crash bugs in at least three different ways, each. :blush:

Edit: And all done, now! This will be fixed in the next build.


#3

Ah, I see! It was leaving phantom listings in the advertiser manager. Nice to see you’ve gone one step further and solved all potential bugs surrounding that.
Consider this case closed!