Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » Stracciatella Project (Platform Independent JA2) » [Fix] Missing civilians
[Fix] Missing civilians[message #317704] Tue, 23 April 2013 22:32 Go to next message
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
This is my patch to fix the missing civilians issue. It's against Tron's repository.

I left a comment in the code, it explains what happens.

missing_civilians.diff:
Index: Build/Tactical/Soldier_Init_List.cc
===================================================================
--- Build/Tactical/Soldier_Init_List.cc	(revision 7072)
+++ Build/Tactical/Soldier_Init_List.cc	(working copy)
@@ -616,7 +616,13 @@
 	for (SOLDIERINITNODE* i = gSoldierInitHead; i && !i->pSoldier; i = i->next)
 	{
 		if (i->pBasicPlacement->bTeam != team) continue;
-		if (!AddPlacementToWorld(i))
+		
+		/* mgl: Missing civilians Fix
+		 * AddPlacementToWorld() returns false for people (civilians) who have a profile
+		 * but are not currently in the sector of the loaded map. It doesn't mean that
+		 * there isn't any remaining slot for them in this case.
+		 */
+		if (!AddPlacementToWorld(i) && i->pBasicPlacement->bTeam != CIV_TEAM)
 		{ /* If it fails to create the soldier, it is likely that it is because the
 			 * slots in the tactical engine are already full. Besides, the strategic
 			 * AI shouldn't be trying to fill a map with more than the maximum


Edit:

This single line of code patch is very efficient but it doesn't deal with the real problem wich is that the AddPlacementToWorld() function returns the same error code when it fails for a game logic reason, like don't spawn Ira in the rebels' hideout if she is in your team, as when it fails for a technical reason, like no more memory space available for a new character. It simply returns "success" or "failure", leaving the caller with a case study to do. This function only has one caller though.

This bug is originally from Tron when he simplified the code and made it faster where the caller is, changing from two passes on the list of characters to create to one pass.

Edit:

Forgot to remind that sunshine spotted the bug before me and fixed it in his own repository of stracciatella by commenting out the action to take by the caller if the AddPlacementToWorld() function fails.

[Updated on: Thu, 25 April 2013 19:23] by Moderator

Report message to a moderator

Master Sergeant
Re: [Fix] Missing civilians[message #318163] Mon, 29 April 2013 01:29 Go to previous message
Gennady is currently offline Gennady

 
Messages:14
Registered:March 2013
Location: Russia
Thanks for the patch mgl.
I've applied it. New version can be downloaded here

Report message to a moderator

Private
Previous Topic: [Fix] Loyalty loss in tactical screen
Next Topic: High resolutions support added
Goto Forum:
  


Current Time: Mon Jan 13 07:58:27 GMT+2 2025

Total time taken to generate the page: 0.00757 seconds