Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » Stracciatella Project (Platform Independent JA2) » Crash when going into tactical screen on mine sectors
Re: Crash when going into tactical screen on mine sectors[message #250967] Wed, 05 May 2010 00:08 Go to previous messageGo to previous message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
I looked (here) at what the 1.13 team did with the "MAPROWCOLTOPOS()" and its use in the function "RecompileLocalMovementCosts()" from the file 'WorldDef.cpp' when they compare it to WORLD_MAX. They have exactly the same bug ported to 32 bits instead of 16 in stracciatella.

"MAPROWCOLS()" return the hexadecimal "FF.FF.FF.FF" value as an invalid gridno id.
Store this in an UINT32 and it's the biggest possible number. It's bigger than WORLD_MAX and the test fails as expected.
Store it in an INT32 and it reads "-1" (2's complement arithmetic). It's lesser than WORLD_MAX and passes the test successfully instead of failing.

Unless I'm losing my mind, don't use signed variables in a macro call which returns hexadecimal values. If its author had wanted to return -1, he would have written it as "-1", not as "FF.FF" on 16 bits or "FF.FF.FF.FF" on 32 bits. The only exception would be if the macro returned "7F.FF" on 16 bits and "7F.FF.FF.FF": the highest possible positive value.

Report message to a moderator

Master Sergeant
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bus Error @ Tactical screen
Next Topic: Bug: looking for enemies in adjacent sectors
Goto Forum:
  


Current Time: Sat Jan 11 02:07:16 GMT+2 2025

Total time taken to generate the page: 0.01168 seconds