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 #250723]
|
Fri, 30 April 2010 12:28
|
|
mgl |
|
Messages:255
Registered:December 2007 Location: France |
|
|
The function "FindNearestAvailableGridNoForCorpse()" in 'Build/Tactical/Tactical_Save.cc' returns a gridno or the value "NOWHERE" (= WORLD_MAX + 1) if it can't find one.
Its caller, the function "LoadRottingCorpsesFromTempCorpseFile()", which is the caller of the function "FloorAtGridNo()" too, has a comment which says that they will force their way through the code to the function which adds a corpse on the map despise an invalid gridno because that function could do interesting things with it anyway. Indeed, if that function sees "NOWHERE" as a gridno, it returns immediately!
This is the change I suggest:
Index: Build/Tactical/Tactical_Save.cc
===================================================================
--- Build/Tactical/Tactical_Save.cc (revision 7059)
+++ Build/Tactical/Tactical_Save.cc (working copy)
@@ -720,9 +720,19 @@
def.sGridNo = FindNearestAvailableGridNoForCorpse(&def, 5);
if (def.sGridNo == NOWHERE)
def.sGridNo = FindNearestAvailableGridNoForCorpse(&def, 15);
- /* ATE: Here we still could have a bad location, but send in NOWHERE to
- * corpse function anyway, 'cause it will iwth not drop it or use a map
- * edgepoint */
+ /* ATE: Here we still could have a bad location, but send in NOWHERE to
+ * corpse function anyway, 'cause it will iwth not drop it or use a map
+ * edgepoint */
+
+ /* 2010-04-29:
+ * The corpse func does nothing from NOWHERE.
+ * No need to force our way to it as the
+ * comment above suggests.
+ * NOWHERE is (WORLD_MAX + 1), and would
+ * fail the next test but I leave this line
+ * for clarity.
+ */
+ if (def.sGridNo == NOWHERE) { continue; }
}
else if (def.usFlags & ROTTING_CORPSE_USE_NORTH_ENTRY_POINT)
{
@@ -741,6 +751,9 @@
def.sGridNo = gMapInformation.sWestGridNo;
}
+ /* 2010-04-29: Don't add a corpse on an invalid gridno */
+ if (def.sGridNo >= WORLD_MAX || def.sGridNo < 0) { continue; }
+
/* ATE: Don't place corpses if not loading a savegame, in town, indoors and
* the corpse is too old */
if (maybe_dont_add &&
I have added a line to stop trying to add a corpse on a "NOWHERE" gridno value and, later, a general check on the gridno obtained from the savegame or from the map north/south/east/west entry points because I don't trust them. Since the gridno is signed in this file, it needs to be compared to 0 as well as the usual WORLD_MAX.
The way the gridnos are managed is really confusing: sometimes signed, sometimes not, sometimes on 16 bits, sometimes on 32... A general function to check the validity of a gridno would be welcome.
Edit: You are in the NOWHERE case, bbun. No suitable gridno was found on a radius of 15 tiles around the original location chosen for the corpse. How can it be possible ?
Report message to a moderator
|
|
|
|
|
|
Crash when going into tactical screen on mine sectors
By: bbun on Wed, 31 March 2010 11:33
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Wed, 21 April 2010 23:34
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Thu, 22 April 2010 00:00
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Thu, 22 April 2010 21:57
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Thu, 22 April 2010 23:57
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: usrbid on Fri, 23 April 2010 07:18
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Fri, 23 April 2010 14:15
|
|
|
Re: Crash when going into tactical screen on mine sectors
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Sat, 24 April 2010 12:03
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Sun, 25 April 2010 16:39
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Wed, 28 April 2010 22:48
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Fri, 30 April 2010 01:22
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Fri, 30 April 2010 10:34
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Fri, 30 April 2010 12:28
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Fri, 30 April 2010 14:20
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Fri, 30 April 2010 19:31
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Fri, 30 April 2010 20:13
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: Tron on Tue, 04 May 2010 10:47
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: bbun on Tue, 04 May 2010 13:28
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: mgl on Wed, 05 May 2010 00:08
|
|
|
Re: Crash when going into tactical screen on mine sectors
By: Helios on Wed, 05 May 2010 13:49
|
Goto Forum:
Current Time: Sat Jan 11 01:57:01 GMT+2 2025
Total time taken to generate the page: 0.01425 seconds
|