Crash in CCommandAI::UpdateTargetLostTimer()

Crash in CCommandAI::UpdateTargetLostTimer()

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Crash in CCommandAI::UpdateTargetLostTimer()

Post by submarine »

Using latest svn version, 4 AAI 2vs2 on long divison





crashed here:

Code: Select all

	if (uh->units[unitid] && (uh->units[unitid]->losStatus[owner->allyteam] & LOS_INRADAR))

Callstack:

> spring.exe!CCommandAI::UpdateTargetLostTimer() Line 647 + 0x1b C++
spring.exe!CMobileCAI::SlowUpdate() Line 424 + 0x5f C++
spring.exe!CCommandAI::GiveAllowedCommand() Line 550 C++
spring.exe!CMobileCAI::GiveCommand() Line 142 + 0x8 C++
spring.exe!std::vector<float,std::allocator<float> >::push_back() Line 583 + 0x10 C++
spring.exe!CSelectedUnits::AiOrder() Line 561 C++
spring.exe!CGame::ClientReadNet() Line 2189 C++
spring.exe!streflop_libm::__tanf() Line 39 + 0x15 C++
spring.exe!COverheadController::KeyMove() Line 133 + 0x2e C++
spring.exe!CGame::UpdateUI() Line 2439 C++
spring.exe!CGame::Update() Line 1333 + 0x7 C++
spring.exe!SpringApp::Run() Line 885 + 0x2f C++
spring.exe!Run() Line 964 + 0x1b C++
spring.exe!_WinMain@16() Line 990 + 0x19 C++
spring.exe!WinMainCRTStartup() Line 390 + 0x1b C
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

compiled spring in debug mode to get more information:

Code: Select all

int CCommandAI::UpdateTargetLostTimer(int unitid)
is called with unitid = -1 from

Code: Select all

case CMD_GUARD:
		assert(owner->unitDef->canGuard);
		if(uh->units[int(c.params[0])]!=0 && UpdateTargetLostTimer(int(c.params[0]))){....
in CMobileCAI::SlowUpdate() Line 424
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Are you really sure it isn't AAI that sets the (first) argument of the CMD_GUARD command to -1? (for example by directly passing the return value of another function - that may fail by returning -1 - to it)

In any case I'll add a little check so it doesn't crash but just ignores those cases in the future.
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

it doesnt do this on purpose, but who knows :)

i'll check that
Post Reply

Return to “Help & Bugs”