Could I have some help debugging AiRequestedTypeAllowed?

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.
Post Reply
User avatar
Mikko Merikivi
Posts: 18
Joined: Fri Sep 13, 2013 9:04 pm

Could I have some help debugging AiRequestedTypeAllowed?

Post by Mikko Merikivi »

So I'm occasionally having crashes with these two possible outputs from gdb:
http://paste.dy.fi/JF/plain
http://paste.dy.fi/rZY/plain

The engine version I used for these error reports is 2.2.7 but they happen in trunk also. The data I'm using is Battle for Mandicor's trunk. The circumstances in which the crashes happen seem to vary (sometimes it even doesn't crash).

A common element is that they happen in the function AiRequestedTypeAllowed in ai/ai_resource.cpp

(Excess blabbering removed)
Here's a debugging function I put in the AiRequestedTypeAllowed: printf("Name: %s\n", type.Ident.c_str());
It said the culprit was the dwarven town hall. However, I don't know why it.
Last edited by Mikko Merikivi on Wed Oct 09, 2013 1:29 pm, edited 1 time in total.
User avatar
Mikko Merikivi
Posts: 18
Joined: Fri Sep 13, 2013 9:04 pm

Re: Could I have some help debugging AiRequestedTypeAllowed?

Post by Mikko Merikivi »

I have a theory now. The town hall crashes the game because it cannot be built by anyone. This was confirmed(?) when I put a button for it to be built and this time the game didn't crash when it reached AiRequestedTypeAllowed. However, there's just one small problem with my theory. City halls cannot be built by anyone either. Why don't they crash the game? Also, that's not really a solution since town halls are supposed to be upgraded from town centers, not built directly.

EDIT: Okay, THIS can't be my fault! When I modified my debugging output like this:
printf("AiRequestedType has called this unit: %s. Builder table size: %u\n", type.Ident.c_str(), AiHelpers.Build[type.Slot].size());

then I get this ridiculous size for the builder table of the dwarven town hall!
AiRequestedType has called this unit: unit-dwarves-town-hall. Builder table size: 4257930690

Normally units have builder table sizes like these:
AiRequestedType has called this unit: unit-darkness-camp. Builder table size: 2
AiRequestedType has called this unit: unit-darkness-fort. Builder table size: 2
AiRequestedType has called this unit: unit-dwarves-city-hall. Builder table size: 0
AiRequestedType has called this unit: unit-dwarves-market. Builder table size: 3
AiRequestedType has called this unit: unit-dwarves-mining-post. Builder table size: 2
AiRequestedType has called this unit: unit-dwarves-mining-post2. Builder table size: 0
AiRequestedType has called this unit: unit-dwarves-town-center. Builder table size: 3
Post Reply