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:
- “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.
- “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.
Edit: And all done, now! This will be fixed in the next build.