Home » MODDING HQ 1.13 » v1.13 General Development Talk » Any introduction to the code?
icon12.gif  Any introduction to the code?[message #357677] Tue, 23 July 2019 01:45 Go to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Dear gentlemen,
We are just a small team on a mission trying to get into the C++ code of Ja2 1.13 hoping to fix some annoying bugs related to inventory managment.
We are capable to compile and run the code, but there are still a lot of unclear stuff for us.
Is here any introduction or general code structure description?
We are interested in location of log files for debugging, intermediate data output and for any software infrastructure available for debugging.
Thank you in advance for your help!

[Updated on: Tue, 23 July 2019 01:45]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357680 is a reply to message #357677] Tue, 23 July 2019 21:26 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Dear Sir/Madam, if you are interested in inventory management, you may want to search main trunk for The_Bob's commits as he made some fixes to inventory system.
I don't think you need any other debugging software apart from VS debugger which works well.
As far as I remember, debug logging goes to debug window in VS, but you need to enable various levels of debug info by using defines in the code and registering debug topics.
I don't think there's any introduction or code description, in general, if you are interested in inventory management, you just open Tactical folder and search for keywords you are interested in, and then start digging into the code. You probably need items.cpp file and all files containing "inventory" in them (look at those commits by The_Bob and see what files he changed).



Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357733 is a reply to message #357680] Tue, 30 July 2019 05:04 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
sevenfm wrote on Tue, 23 July 2019 21:26
Dear Sir/Madam, if you are interested in inventory management, you may want to search main trunk for The_Bob's commits as he made some fixes to inventory system.
I don't think you need any other debugging software apart from VS debugger which works well.
As far as I remember, debug logging goes to debug window in VS, but you need to enable various levels of debug info by using defines in the code and registering debug topics.
I don't think there's any introduction or code description, in general, if you are interested in inventory management, you just open Tactical folder and search for keywords you are interested in, and then start digging into the code. You probably need items.cpp file and all files containing "inventory" in them (look at those commits by The_Bob and see what files he changed).
Dear SevenFM, thank you very much for your reply!
The VS debugger works fine, but the debugging version of the code aborts its execution due to absence of *.ini files (ja2.ini, vfs_config.ini etc).
Are you aware where I have to place all the files for the _DEBUG project configuration?

Thanx again, bro!

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357734 is a reply to message #357733] Tue, 30 July 2019 09:32 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
You need to setup your solution configuration in VS to use your JA2 directory. There is a quick guide -> here.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357735 is a reply to message #357734] Wed, 31 July 2019 09:39 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
silversurfer wrote on Tue, 30 July 2019 09:32
You need to setup your solution configuration in VS to use your JA2 directory. There is a quick guide -> here.
Thank you very much for the advice!
Seems to me my problem was a wrong "Working directory" setting.
Now it looks like I'm capable to run, execute and debug the code.
I will appreciate if you can point me out any specific thread where you guys discuss a general development issues.
Or if you have any specific direction for the work, I'll be happy to help.

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357736 is a reply to message #357735] Wed, 31 July 2019 11:43 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
I don't think that there is any specific thread for development talk. Topics are usually discussed per thread. There is a general bug reports thread for 1.13 and a thread for "absurdly small code changes" that introduces small changes/fixes/features.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357753 is a reply to message #357680] Sat, 03 August 2019 12:08 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
sevenfm wrote on Tue, 23 July 2019 21:26
Dear Sir/Madam, if you are interested in inventory management, you may want to search main trunk for The_Bob's commits as he made some fixes to inventory system.
...
You probably need items.cpp file and all files containing "inventory" in them (look at those commits by The_Bob and see what files he changed).
Thanks! Exploring the revision history of items.cpp I see that last commit of The_Bob happened a while ago (20 Nov 2017). Unfortunately, I cant reproduce the problem on the exe-revisions after his changes. Hope this bug is gone (otherwise my wife will eat me alive).

By the way, are you aware about other bug described here: http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=354552 ?
First: is this a bug or a feature?
If this is bug, I'm capable to reproduce it on my PC. Did anyone try to fix it?

[Updated on: Sat, 03 August 2019 12:11]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357758 is a reply to message #357753] Sat, 03 August 2019 21:27 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
MH17 wrote on Sat, 03 August 2019 14:08
By the way, are you aware about other bug described here: http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=354552 ?
First: is this a bug or a feature?
If this is bug, I'm capable to reproduce it on my PC. Did anyone try to fix it?
Sorry, don't know anything about it, but I have reported a few reproducible bugs that noone could fix yet:
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&goto=357357&#msg_357357
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&goto=357365&#msg_357365
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&goto=357459&#msg_357459
Maybe you would be interested in fixing them?



Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357764 is a reply to message #357758] Sun, 04 August 2019 08:43 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
sevenfm wrote on Sat, 03 August 2019 21:27
MH17 wrote on Sat, 03 August 2019 14:08
By the way, are you aware about other bug described here: http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=354552 ?
First: is this a bug or a feature?
If this is bug, I'm capable to reproduce it on my PC. Did anyone try to fix it?
Sorry, don't know anything about it, but I have reported a few reproducible bugs that noone could fix yet:
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&goto=357357&#msg_357357
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&goto=357365&#msg_357365
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22776&goto=357459&#msg_357459
Maybe you would be interested in fixing them?
Hi! Yeah, I will try after finishing the aforementioned Problem with Squad Movement from the Strat Map.

At the moment I can say that the problem is related to default branch of operator "switch" in function "ReportMapScreenMovementError" (project "Strategic", file "Map Screen Interface.cpp", line 6279).

I tried to place a couple of breakpoints there to use F10/F11, but my VS debugger just hangs. I'm pretty sure you guys have some functions to perform an output of data into left-bottom window of strategic screen, do you? Or may be you got any classes or functions to dump necessary data into file on my HDD? It looks like there is function "LiveMessage" in file "Debug Control.cpp" exactly for that.

[Updated on: Sun, 04 August 2019 09:51]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357770 is a reply to message #357764] Sun, 04 August 2019 09:58 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Quote:
I tried to place a couple of breakpoints there to use F10/F11, but my VS debugger just hangs.
I think you can only debug the game in windowed mode.



Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357771 is a reply to message #357770] Sun, 04 August 2019 10:26 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
sevenfm wrote on Sun, 04 August 2019 09:58
Quote:
I tried to place a couple of breakpoints there to use F10/F11, but my VS debugger just hangs.
I think you can only debug the game in windowed mode.
aww
I love you, bro!!!

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357772 is a reply to message #357771] Sun, 04 August 2019 11:12 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
With regards to the bug reported here I can say that it comes from a wrong number of enemies, calculated by function "NumHostilesInSector" (file "Queen Command.cpp", line 148).

According to what I see, the function retrieves a number of enemies in sector from "SECTORINFO" data structure, defined in file "Campaign Types.h".
It produces a non-zero result for a sector which was swept off by a cheat code "Alt+O". eek

The non-zero value originates from a variable "pSector->ubNumCreatures" (file "Queen Command.cpp", line 175).
Most probably the cheat code failed to set the number of alive zombies to the zero after killing all of them. Hell!
Would anyone happen to know where I can find a functions, responsible for cheat-codes of the game?

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357774 is a reply to message #357772] Sun, 04 August 2019 12:54 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
When someone presses Alt + O the code block from line 4040 in "Tactical\Turn Based Input.cpp" is used. The function "ObliterateSector" will kill anything in the sector including zombies.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357781 is a reply to message #357774] Mon, 05 August 2019 10:36 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
silversurfer wrote on Sun, 04 August 2019 12:54
When someone presses Alt + O the code block from line 4040 in "Tactical\Turn Based Input.cpp" is used. The function "ObliterateSector" will kill anything in the sector including zombies.
Thank you very much, comrade! happy

Exploring the function "ObliterateSector" I see that it doesnt update the number of hostile units in sector (troops, tanks, creatures and so on) after applying the cheat code Alt+O to the game. In other words the variable:

std::vector<SECTORINFO> SectorInfo (256); 

declared in the file "Strategic\Queen Command.cpp" (line 75) after the cheat code Alt+O can hold a non-zero number of the creatures in its fields "ubNumCreatures" and "ubCreaturesInBattle".

Having this if I will try to send my troops out of the sector the function "NumHostilesInSector" will block my attempt, cause the sector is considered to remain hostile.

This is looks a bit strange to me because the number of enemies in similar functions "NumEnemiesInAnySector" (file "Strategic\Queen Command.cpp", line 192) or "NumNonPlayerTeamMembersInSector" (line 237) doesnt take into account the value "ubNumCreatures" in the vector "SectorInfo".

Moreover: in my opinion the functions "NumEnemiesInAnySector" and "NumHostilesInSector" are almost identical. May be it makes sense to get rid one of them?

Are there any ideas about the best way to fix it?

[Updated on: Mon, 05 August 2019 10:56]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357783 is a reply to message #357781] Mon, 05 August 2019 13:14 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
"Enemies" are Deidranna's troops. This is not necessarily the same as "Hostiles" in a sector. Deidranna has no creatures.

The events that kill the opponents should also lead to an update of the sector counters. Should... In the end it's like shooting them dead.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357784 is a reply to message #357781] Mon, 05 August 2019 14:41 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
@MH17
In Tactical\Overhead.cpp:
void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
{
	if ( !bMapZ ) // Battle ended Above-ground
	{
		SECTORINFO *pSectorInfo = &(SectorInfo[SECTOR( sMapX, sMapY )]);

		pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0;
		pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0;
	}
	else
	{
		UNDERGROUND_SECTORINFO *pSectorInfo;

		pSectorInfo = FindUnderGroundSector( sMapX, sMapY, bMapZ );
		pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0;
		pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0;
	}
}
which is called at the end of the battle in CheckForEndOfBattle()
// Kill all enemies. Sometime even after killing all the enemies, there appeares "in battle" enemies in sector info
RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );

Maybe it would be enough to add
pSectorInfo->ubNumCreatures = 0
pSectorInfo->ubCreaturesInBattle = 0
to RemoveStaticEnemiesFromSectorInfo() to fix the bug?

This still leaves question why this information is not updated when creature is killed.
Looks like this information should be updated in ProcessQueenCmdImplicationsOfDeath(), which updates sector info:
AdjustToNextAnimationFrame->CheckForAndHandleSoldierDeath->HandleSoldierDeath->HandleNPCTeamMemberDeath->ProcessQueenCmdImplicationsOfDeath
but it only updates sector data for all creatures except bloodcats (bugs, zombies...?), and for bloodcats it only decrements bBloodCats
if( pSector->bBloodCats )
{
	pSector->bBloodCats--;
}
and calls HandleBloodCatDeaths() (but only for UB)
#ifdef JA2UB						
	//JA25 UB
	//handle anything important when bloodcats die
	HandleBloodCatDeaths( pSector );
#endif
if we look at HandleBloodCatDeaths(), it only does quest/dialog related things.
So the best place to individually decrement ubNumCreatures and ubCreaturesInBattle should probably be in ProcessQueenCmdImplicationsOfDeath() when the game checks for creature type, but currently bloodcats are excluded (intentionally?)

@silversurfer, @Flugente can you comment on this?

[Updated on: Mon, 05 August 2019 17:57]




Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357785 is a reply to message #357784] Mon, 05 August 2019 18:58 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
I think that the exclusion of bloodcats is intentional. The player should be able to leave the sector unless he is already in combat with bloodcats. Function "NumHostilesInSector" also ignores bloodcats on purpose but counts creatures.

I don't think that function "ProcessQueenCmdImplicationsOfDeath" updates zombies at all. The switch for "pSoldier->ubSoldierClass" covers enemy soldiers, creatures and bandits. Zombies however should have "SOLDIER_CLASS_ZOMBIE". I don't see this covered anywhere in this function, above and below ground.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
icon14.gif  Re: Any introduction to the code?[message #357787 is a reply to message #357784] Tue, 06 August 2019 05:25 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
sevenfm wrote on Mon, 05 August 2019 14:41
@MH17
In Tactical\Overhead.cpp:
void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
{
	if ( !bMapZ ) // Battle ended Above-ground
	{
		SECTORINFO *pSectorInfo = &(SectorInfo[SECTOR( sMapX, sMapY )]);

		pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0;
		pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0;
	}
	else
	{
		UNDERGROUND_SECTORINFO *pSectorInfo;

		pSectorInfo = FindUnderGroundSector( sMapX, sMapY, bMapZ );
		pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0;
		pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0;
	}
}
which is called at the end of the battle in CheckForEndOfBattle()
// Kill all enemies. Sometime even after killing all the enemies, there appeares "in battle" enemies in sector info
RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );

Maybe it would be enough to add
pSectorInfo->ubNumCreatures = 0
pSectorInfo->ubCreaturesInBattle = 0
to RemoveStaticEnemiesFromSectorInfo() to fix the bug?

Thank you, bro!
Yes, it did help in my situation when I added these lines in the each branch of the if-operator.
Probably you guys can make a commit, but in my opinion it is only partial solution.
I think this way cause my girlfriend reports that she observed a very similar problem when zombies-option was totally OFF during all the game process.
She says, that after applying the Alt+O cheat code all enemies in tactical mode died, but their red markers on the strategic screen remained the same.
And the sector remained to be hostile.

Most probably, there is something else hidden deep in the code. And it is waiting for our attention.
At the moment I'm trying to reproduce the bug from her saved games.


Quote:
This still leaves question why this information is not updated when creature is killed.
I would like to know that too...
The function "RaiseZombies" correctly increases a counter of the raised deadmen (file "Rotting Corpses.cpp", line 2730) right in the sector data structure.

pSector->ubNumCreatures++;
pSector->ubCreaturesInBattle++;
Why we postpone the decrement of the counter to the end of the combat? I think we should decrease the counter in the moment when the creature died.

[Updated on: Tue, 06 August 2019 05:29]

Report message to a moderator

Corporal
icon9.gif  Re: Any introduction to the code?[message #357788 is a reply to message #357787] Tue, 06 August 2019 07:28 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Hello again, gentlemen!

As it was suggested in the previous post I have managed to reproduce a similar bug with the sector's enemy counters.

Problem description:
I moved my squad from A9 (Atremo Airport, Urban Chaos Mod) to sector B9, where I never ever been before. In the beginning there were 28 enemies.
Right after arrival I pressed Alt+O to kill all of them, but after using the cheat-code 14 soldiers left on the strategic map (as a red dots) together with my team (yellow dots).
But in the tactical screen (Alt+E) each visible enemy died. The zombi-option is OFF, noone of them raised up again.
Moreover, on the tactical screen for the DEBUG version of the code the bug has been announced by debug message "Sector troop counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!"
Direction of Work:
It makes me think that comrade SevenFM was right when he mentioned the function "ProcessQueenCmdImplicationsOfDeath" ("Strategic\Queen Command.cpp"), cause the function contains the debug message in line 1428.
Staying on the strategic map with the 14 enemies I tried to send my squad out and got the same old song: "Movement Orders? This is a hostile sector!", but after some walking around the code with debugger I found out that the reason is NOT related to sector counters!!! suprised All of them are correct and equal to zero!

As I see, like in the previous bug (related to zombi) the movement order was blocked by function "NumHostilesInSector" ("Strategic\Queen Command.cpp"). But this time problem comes from loop in line 179:
while( pGroup )

As I understand in this situation one of the enemy groups was not affected by the cheat-code and its size didnt change (still equal to 14).
I tried to have a look into "ObliterateSector" -> "EVENT_SoldierGotHit", but failed to find anything of interest.
I'd like to explore how the gamecode changes the number of enemy red markers on the strategic screen and how it modifies the number of groups/number of individuals in groups. Could you please tell me where it is located?
Thank you in advance!

[Updated on: Tue, 06 August 2019 07:34]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357790 is a reply to message #357788] Tue, 06 August 2019 19:16 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
It seems you had multiple groups of enemies, not all in the sector but some recently departed. They should appear after some time because reinforcements take time. At least that is my guess what happened here.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357791 is a reply to message #357790] Wed, 07 August 2019 07:51 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
silversurfer wrote on Tue, 06 August 2019 19:16
It seems you had multiple groups of enemies, not all in the sector but some recently departed. They should appear after some time because reinforcements take time. At least that is my guess what happened here.
Hi, SilverSurfer!
Yeah, I got two groups of enemies (with pTSoldier->ubGroupID equal to 23 and 24), each group has 14 soldiers.
But all of them are staying in the sector for sure, cause for each one of the 28 soldiers:
1. I checked flag "pTSoldier->bInSector", it is equal 1.
2. I manually found all the soldiers on the tactical map using cheatcode Alt+E.

After using Alt+O everyone dies in tactics, but in strategic map one of the groups stays untouched.
In order to find out which enemy group has managed to survive after Alt+O I tried to check the ubGroupID in "NumHostilesInSector" and suddenly it gave me ubGroupID is equal to 24.

Do you know where I can find a code responsible for update of gpGroupList->ubGroupID after the death of last soldier in the group? I believe the problem is going to be somewhere around.

UPD: After some walking around the code with debugger I can conclude, that one enemy group (with ubGroupID = 23) was correctly deleted in function "ProcessQueenCmdImplicationsOfDeath" (file "Queen Command.cpp", line 1371, does anyone understands its logic?). The second group (with ubGroupID = 24) left as it is despite the fact, that all the soldiers were killed by the cheat code Alt+O. It seems to me that the call of the function "ProcessQueenCmdImplicationsOfDeath" has been missed somewhere...

UPD 2: Finally: after some extra research I see, that the soldiers from one of the groups with ubGroupID = 24 just absent in vector MercSlots (file "Overhead.cpp"). I have no idea why instead of 24 there are soldiers with ubGroupID = 25. As a result a function "ExecuteOverhead" cant process the array properly. Does anyone know what is the purpose of the vector MercSlots? Any advices or recomendations will be highly appreciated!

[Updated on: Wed, 07 August 2019 15:18]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357801 is a reply to message #357791] Thu, 08 August 2019 11:35 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Dear comrades,
It seems to me I have managed to locate the problem and fix it.
The origin of the bug is situated in the function "PrepareEnemyForSectorBattle" (file "Queen Command.cpp", lines 960-1047) within a "while"-loop which assigns a correct GroupID to enemy soldiers generated for the tactical battlefield. In the situations when we have a many enemy groups in the sector the code assignment produces not correct results.

I have a version of the "Queen Command.cpp" ready for code review and commit. May I ask someone to do that or provide me with a valid password for the SVN?
Thank you!

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357802 is a reply to message #357801] Thu, 08 August 2019 11:43 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
@MH17 you can make a patch file with TortoiseSVN and post it here so silversurfer or other 1.13 coders could commit it.

[Updated on: Thu, 08 August 2019 12:00]




Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357803 is a reply to message #357802] Thu, 08 August 2019 12:12 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Thanks, bro!
Unfortunately I'm not on my PC at the moment, and I have no idea why the SVN doesnt allow me to create patches from here.
Please, have a look on the modified piece of code with the aforementioned "while"-loop, hope it will help.

	unsigned firstSlot = gTacticalStatus.Team[ENEMY_TEAM].bFirstID;
	unsigned lastSlot = gTacticalStatus.Team[ENEMY_TEAM].bLastID;
	unsigned slotsAvailable = lastSlot - firstSlot + 1;
	while( pGroup && sNumSlots > 0 )
	{
		if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle &&
				 pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
		{
			ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
			ubNumTroops = pGroup->pEnemyGroup->ubTroopsInBattle;
			ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
			ubNumTanks  = pGroup->pEnemyGroup->ubTanksInBattle;
			ubNumJeeps = pGroup->pEnemyGroup->ubJeepsInBattle;
			unsigned num = ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps;

			AssertGE((int)slotsAvailable, sNumSlots);

			for (unsigned slot = firstSlot;
				  (slot <= lastSlot) && num && sNumSlots;
				++slot)
			{
				pSoldier = &Menptr[ slot ];

				// Skip inactive and already grouped soldiers
				if (!pSoldier->bActive || pSoldier->ubGroupID)
				{
					// if this guy already has an ID, reduce the number of people who still need one
					--num;
					--sNumSlots;
					
					continue;
				}

				// At this point we should not have added more soldiers than are in slots
				AssertGT( sNumSlots, 0 );

				switch( pSoldier->ubSoldierClass )
				{
					case SOLDIER_CLASS_ADMINISTRATOR:
						if( ubNumAdmins )
						{
							num--;
							sNumSlots--;
							ubNumAdmins--;
							pSoldier->ubGroupID = pGroup->ubGroupID;
							firstSlot = slot + 1;
						}
						break;
					case SOLDIER_CLASS_ARMY:
						if( ubNumTroops )
						{
							num--;
							sNumSlots--;
							ubNumTroops--;
							pSoldier->ubGroupID = pGroup->ubGroupID;
							firstSlot = slot + 1;
						}
						break;
					case SOLDIER_CLASS_ELITE:
						if( ubNumElites )
						{
							num--;
							sNumSlots--;
							ubNumElites--;
							pSoldier->ubGroupID = pGroup->ubGroupID;
							firstSlot = slot + 1;
						}
						break;
					// silversurfer: bugfix for Jaggzilla bug #623
					// Mike or Iggy can be part of the enemy team and they are created from an Elite but they don't have SOLDIER_CLASS_ELITE.
					// Therefore once this for loop was done ubNumElites was still 1 which caused an assertion error.
					case SOLDIER_CLASS_NONE:
						if( ubNumElites )
						{
							if ( pSoldier->ubProfile == MIKE || pSoldier->ubProfile == IGGY )
							{
								num--;
								sNumSlots--;
								ubNumElites--;
								pSoldier->ubGroupID = pGroup->ubGroupID;
								firstSlot = slot + 1;
							}
						}
						break;
					case SOLDIER_CLASS_TANK:
						if( ubNumTanks )
						{
							num--;
							sNumSlots--;
							ubNumTanks--;
							pSoldier->ubGroupID = pGroup->ubGroupID;
							firstSlot = slot + 1;
						}
						break;
					case SOLDIER_CLASS_JEEP:
						if ( ubNumJeeps )
						{
							num--;
							sNumSlots--;
							ubNumJeeps--;
							pSoldier->ubGroupID = pGroup->ubGroupID;
							firstSlot = slot + 1;
						}
						break;
				}
			}

			// Flugente: instead of just crashing the game without any explanation to the user, ignore this issue if it still exists.
			// The worst that should happen is a warning that a soldier has no group id.
			/*AssertEQ( ubNumElites , 0);
			AssertEQ( ubNumTroops , 0);
			AssertEQ( ubNumAdmins , 0);
			AssertEQ( ubNumTanks , 0);
			AssertEQ( ubNumJeeps , 0);
			AssertEQ( num , 0);*/
		}
		pGroup = pGroup->next;
	}


And please, apply your changes from message #357784 (file "Overhead.cpp") to deal the with zombies:
pSectorInfo->ubNumCreatures = 0
pSectorInfo->ubCreaturesInBattle = 0

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357805 is a reply to message #357803] Thu, 08 August 2019 12:39 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Here's the patch with MH17's changes, if people more competent in strategic code are interested.
link removed

[Updated on: Thu, 08 August 2019 13:59]




Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357806 is a reply to message #357805] Thu, 08 August 2019 12:59 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Not sure about this code.
There is should be declaration of variables in the very beginning. Its the main point, they must be declared just one time.

[Updated on: Thu, 08 August 2019 13:02]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357807 is a reply to message #357806] Thu, 08 August 2019 13:10 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
MH17 wrote on Thu, 08 August 2019 14:59
Not sure about this code.
There is should be declaration of variables in the very beginning. Its the main point, they must be declared just one time.
You can simply post here your version of Queen Command.cpp then, I applied your patch according to your post:
Quote:
file "Queen Command.cpp", lines 960-1047

[Updated on: Thu, 08 August 2019 13:11]




Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357809 is a reply to message #357807] Thu, 08 August 2019 13:45 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Most probably I wasn't clear in my previous post.
Please, try to employ this piece of code:
Index: Queen Command.cpp
===================================================================
--- Queen Command.cpp	(revision 8684)
+++ Queen Command.cpp	(working copy)
@@ -945,28 +945,29 @@
 	sNumSlots = min( mapMaximumNumberOfEnemies, NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) );
 
 	pGroup = gpGroupList;
-	while( pGroup && sNumSlots > 0 )
+
+	unsigned firstSlot = gTacticalStatus.Team[ENEMY_TEAM].bFirstID;
+	unsigned lastSlot = gTacticalStatus.Team[ENEMY_TEAM].bLastID;
+	unsigned slotsAvailable = lastSlot - firstSlot + 1;
+	while (pGroup && sNumSlots > 0)
 	{
-		if ( pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle &&
-				 pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
+		if (pGroup->usGroupTeam != OUR_TEAM && !pGroup->fVehicle &&
+			pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ)
 		{
 			ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
 			ubNumTroops = pGroup->pEnemyGroup->ubTroopsInBattle;
 			ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
-			ubNumTanks  = pGroup->pEnemyGroup->ubTanksInBattle;
+			ubNumTanks = pGroup->pEnemyGroup->ubTanksInBattle;
 			ubNumJeeps = pGroup->pEnemyGroup->ubJeepsInBattle;
 			unsigned num = ubNumAdmins + ubNumTroops + ubNumElites + ubNumTanks + ubNumJeeps;
 
-			unsigned firstSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
-			unsigned lastSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bLastID;
-			unsigned slotsAvailable = lastSlot-firstSlot+1;
 			AssertGE((int)slotsAvailable, sNumSlots);
 
 			for (unsigned slot = firstSlot;
-				  (slot <= lastSlot) && num && sNumSlots;
+				(slot <= lastSlot) && num && sNumSlots;
 				++slot)
 			{
-				pSoldier = &Menptr[ slot ];
+				pSoldier = &Menptr[slot];
 
 				// Skip inactive and already grouped soldiers
 				if (!pSoldier->bActive || pSoldier->ubGroupID)
@@ -974,75 +975,81 @@
 					// if this guy already has an ID, reduce the number of people who still need one
 					--num;
 					--sNumSlots;
-					
+
 					continue;
 				}
 
 				// At this point we should not have added more soldiers than are in slots
-				AssertGT( sNumSlots, 0 );
+				AssertGT(sNumSlots, 0);
 
-				switch( pSoldier->ubSoldierClass )
+				switch (pSoldier->ubSoldierClass)
 				{
-					case SOLDIER_CLASS_ADMINISTRATOR:
-						if( ubNumAdmins )
-						{
-							num--;
-							sNumSlots--;
-							ubNumAdmins--;
-							pSoldier->ubGroupID = pGroup->ubGroupID;
-						}
-						break;
-					case SOLDIER_CLASS_ARMY:
-						if( ubNumTroops )
-						{
-							num--;
-							sNumSlots--;
-							ubNumTroops--;
-							pSoldier->ubGroupID = pGroup->ubGroupID;
-						}
-						break;
-					case SOLDIER_CLASS_ELITE:
-						if( ubNumElites )
-						{
-							num--;
-							sNumSlots--;
-							ubNumElites--;
-							pSoldier->ubGroupID = pGroup->ubGroupID;
-						}
-						break;
+				case SOLDIER_CLASS_ADMINISTRATOR:
+					if (ubNumAdmins)
+					{
+						num--;
+						sNumSlots--;
+						ubNumAdmins--;
+						pSoldier->ubGroupID = pGroup->ubGroupID;
+						firstSlot = slot + 1;
+					}
+					break;
+				case SOLDIER_CLASS_ARMY:
+					if (ubNumTroops)
+					{
+						num--;
+						sNumSlots--;
+						ubNumTroops--;
+						pSoldier->ubGroupID = pGroup->ubGroupID;
+						firstSlot = slot + 1;
+					}
+					break;
+				case SOLDIER_CLASS_ELITE:
+					if (ubNumElites)
+					{
+						num--;
+						sNumSlots--;
+						ubNumElites--;
+						pSoldier->ubGroupID = pGroup->ubGroupID;
+						firstSlot = slot + 1;
+					}
+					break;
 					// silversurfer: bugfix for Jaggzilla bug #623
 					// Mike or Iggy can be part of the enemy team and they are created from an Elite but they don't have SOLDIER_CLASS_ELITE.
 					// Therefore once this for loop was done ubNumElites was still 1 which caused an assertion error.
-					case SOLDIER_CLASS_NONE:
-						if( ubNumElites )
+				case SOLDIER_CLASS_NONE:
+					if (ubNumElites)
+					{
+						if (pSoldier->ubProfile == MIKE || pSoldier->ubProfile == IGGY)
 						{
-							if ( pSoldier->ubProfile == MIKE || pSoldier->ubProfile == IGGY )
-							{
-								num--;
-								sNumSlots--;
-								ubNumElites--;
-								pSoldier->ubGroupID = pGroup->ubGroupID;
-							}
-						}
-						break;
-					case SOLDIER_CLASS_TANK:
-						if( ubNumTanks )
-						{
 							num--;
 							sNumSlots--;
-							ubNumTanks--;
+							ubNumElites--;
 							pSoldier->ubGroupID = pGroup->ubGroupID;
+							firstSlot = slot + 1;
 						}
-						break;
-					case SOLDIER_CLASS_JEEP:
-						if ( ubNumJeeps )
-						{
-							num--;
-							sNumSlots--;
-							ubNumJeeps--;
-							pSoldier->ubGroupID = pGroup->ubGroupID;
-						}
-						break;
+					}
+					break;
+				case SOLDIER_CLASS_TANK:
+					if (ubNumTanks)
+					{
+						num--;
+						sNumSlots--;
+						ubNumTanks--;
+						pSoldier->ubGroupID = pGroup->ubGroupID;
+						firstSlot = slot + 1;
+					}
+					break;
+				case SOLDIER_CLASS_JEEP:
+					if (ubNumJeeps)
+					{
+						num--;
+						sNumSlots--;
+						ubNumJeeps--;
+						pSoldier->ubGroupID = pGroup->ubGroupID;
+						firstSlot = slot + 1;
+					}
+					break;
 				}
 			}
 

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357811 is a reply to message #357809] Thu, 08 August 2019 19:10 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
If I understand you correctly you don't want that for loop to start at the same point every time the while loop runs, right? Because then you would constantly decrement sNumSlots for soldiers that have been assigned already instead of assigning the rest of the soldiers to a group.

Wouldn't you need to increment firstSlot in this block as well?
				if (!pSoldier->bActive || pSoldier->ubGroupID)
				{
					// if this guy already has an ID, reduce the number of people who still need one
					--num;
					--sNumSlots;
					
					continue;
				}
Otherwise you may hit that soldier again.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357812 is a reply to message #357811] Thu, 08 August 2019 20:53 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Dear SllverSurfer,

I think you got the idea right.

As to your question: I'm not sure that within my plan to fix the bug the function needs the if-check within the while-loop at all.
I tried to run the code with few tests including that one described above (two different groups in sector B9) and I see that a condition of the if-operator never becomes true.

In other words we skip inactive soldiers and soldiers labelled on previous iterations of the while-loop moving the initial value of the index firstSlot.
Since I'm not capable to create a situation when the execution point drops within the if-check I dont think that I should modify it.

PS: I suggest that most probably your idea makes sense.

[Updated on: Thu, 08 August 2019 21:05]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357833 is a reply to message #357812] Sun, 11 August 2019 12:15 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
I couldn't apply the patch posted earlier so I made the changes manually. I also added SOLDIER_CLASS_ZOMBIE to function "ProcessQueenCmdImplicationsOfDeath" so the pSector->ubNumCreatures counter is decreased when a zombie dies. Changes are in r8686.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357836 is a reply to message #357833] Sun, 11 August 2019 14:57 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
silversurfer wrote on Sun, 11 August 2019 12:15
I couldn't apply the patch posted earlier so I made the changes manually. I also added SOLDIER_CLASS_ZOMBIE to function "ProcessQueenCmdImplicationsOfDeath" so the pSector->ubNumCreatures counter is decreased when a zombie dies. Changes are in r8686.
Hi, SilverSurfer!
My girlfriend sends you a lot of thanks for the update and many best wishes!
After taking down the inventory bug we will start an extensive testing session on different modes.

Report message to a moderator

Corporal
film28.png  Re: Any introduction to the code?[message #357939 is a reply to message #357833] Thu, 22 August 2019 11:35 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
silversurfer wrote on Sun, 11 August 2019 12:15
I couldn't apply the patch posted earlier so I made the changes manually. I also added SOLDIER_CLASS_ZOMBIE to function "ProcessQueenCmdImplicationsOfDeath" so the pSector->ubNumCreatures counter is decreased when a zombie dies. Changes are in r8686.

Hi, SilverSurfer!

It is a kinda frustrating for me to report that the commit r8686 didnt solve the problem with zombies.

My game setup: r8690 + Urban Chaos Mod
Description: after killing last zombie in sector D13 I still enjoy an issue with "Movement Orders? This is a hostile sector!".

Walking around the function "ProcessQueenCmdImplicationsOfDeath" with debugger I can see that pSector->ubNumCreatures counter is decreased when last zombie dies, but its value is still equal 30. And this creates a mess in function "NumHostilesInSector" which doesnt allow me to sent my troops out of sector on the global map.

May be it makes sense to implement a radical solution proposed by a fellow SevenFM in his message #357784 (reply to message #357781) where he suggests to change a function "RemoveStaticEnemiesFromSectorInfo"?

PS: I tried to test his patch in "RemoveStaticEnemiesFromSectorInfo":
pSectorInfo->ubNumCreatures = 0;
pSectorInfo->ubCreaturesInBattle = 0;
It works.

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357943 is a reply to message #357939] Fri, 23 August 2019 03:22 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Important update:

After some extra research I found out that there is something wrong with the sector counters in sector D13 (Urban Chaos mod), cause the value pSector->ubNumCreatures is equal 30 right in the moment when I enter the sector first time before any enemy was killed. At the same time another sector counter pSector->ubCreaturesInBattle is correct and equal 0.

BTW, in the _DEBUG mode before entering the tactical map I got a message "Strategic info warning: Sector 'in battle' counters are not clear when they should be" (file "strategic\prebattle interface.cpp", line 257).

Where the information could be kept?
Is this somehow related to the sector maps?

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357947 is a reply to message #357943] Fri, 23 August 2019 10:26 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
I don't have UC so I can't comment on map specific issues. I assume the ubNumCreatures is higher than 30 after you enter the sector or are there 30 zombies?
If there are e.g. 20 Zombies and the counter goes to 50 and after you kill them all the counter is reduced properly and goes back to 30 it means at least the fix for zombies in ProcessQueenCmdImplicationsOfDeath() is working. In this case maybe you can figure out where the 30 is coming from.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357949 is a reply to message #357947] Fri, 23 August 2019 12:56 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
silversurfer wrote on Fri, 23 August 2019 10:26
I don't have UC so I can't comment on map specific issues. I assume the ubNumCreatures is higher than 30 after you enter the sector or are there 30 zombies?
If there are e.g. 20 Zombies and the counter goes to 50 and after you kill them all the counter is reduced properly and goes back to 30 it means at least the fix for zombies in ProcessQueenCmdImplicationsOfDeath() is working. In this case maybe you can figure out where the 30 is coming from.
Hi, SilverSurfer!

Yeah, it looks like after your update the counter of zombies has been correctly increased and decreased.
But its initial value upon arriving my team into city sector D13 is equal to 30. It is before any zombie was generated and long before any enemy was killed.

My girlfriend just started the game and she never ever been before in this location during the short campaign.
This is Callisto Mine in UC (or Drassen Mine in the Vanilla).
Using cheat codes I couldn't find any zombies or monsters in the sector, just some enemy troops.

And very interesting moment: just look at the function "ValidateAndCorrectInBattleCounters" (file "strategic\prebattle interface.cpp").
This function sets some of combat counters to 0 in line 270.
May be it make sense to zeroize all of them?

All of this looks extremely strange to me.

[Updated on: Fri, 23 August 2019 12:57]

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357950 is a reply to message #357949] Fri, 23 August 2019 13:13 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
@MH17
ubNumCreatures may be initialized with some value because creatures are defined for this sector in xml or lua.
CreaturePlacements.xml has entry for d13, but I don't know how it works honestly.



Left this community.

Report message to a moderator

Lieutenant

Re: Any introduction to the code?[message #357952 is a reply to message #357950] Fri, 23 August 2019 14:50 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Pre-defined creature counters may be the problem. It could be that you can enter the sector and go as you please as long as no special condition applies or combat with the creatures is initiated. After combat is initiated with creatures (zombies in this case) the game thinks that there are still some left after you killed all zombies because the original counter was not zero. This is just a wild guess.

As far as I understand CreaturePlacements.xml is only for bugs and those are only enabled by ENABLE_CREPITUS in Ja2_Options.INI. If the pre-defined counter is the problem then this could be solved by using additional checks if crepitus are enabled and a bug infestation is active. But first one needs to find where this initial counter is set.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Any introduction to the code?[message #357958 is a reply to message #357952] Sat, 24 August 2019 10:29 Go to previous messageGo to next message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Thank you, guys for your insights.

silversurfer wrote on Fri, 23 August 2019 14:50
After combat is initiated with creatures (zombies in this case) the game thinks that there are still some left after you killed all zombies because the original counter was not zero. This is just a wild guess.
I believe this is exactly what I observe in the current game.

Checking an evolution of the campaign in different gamesaves I see following: when my girlfriend was fighting in Atremo (Omerta) the creature counters for D13 were all equal to zero (both pSector->ubNumCreatures and pSector->ubCreaturesInBattle). Then her team jumped via subway to Calisto (Drassen) and the counters have been changed somehow. suprised Here I have to emphasize: she haven't visited D13 yet, but its corresponding element in the vector std::vector<SECTORINFO> SectorInfo has been mysteriously modified.

When she begun to liberate Callisto starting from E13, then C13, C14, B14, B13 the counters for the D13 have already been equal to 30.

At the moment I have no idea where to look for the problem... angry

Report message to a moderator

Corporal
Re: Any introduction to the code?[message #357961 is a reply to message #357958] Sat, 24 August 2019 12:00 Go to previous messageGo to previous message
MH17 is currently offline MH17

 
Messages:46
Registered:November 2018
Location: Antarctica
Hello, fellows!

I think I have an idea why the enemy counters for D13 have been modified in the game process without visiting the sector.

Trying to reproduce the gameplay with zombie option ON, I found out very interesting issue. First of all lets have a look on the geography of our world in Urban Chaos mod.
City Callisto (or Drassen in Vanilla Ja2) has a subway station situated underground in sector D13. There is a mining factory on the surface of the sector, right above the station.

When we are fighting in the subway D13 with zombies a function "RaiseZombies" increases the sector counters for the sector D13 without making difference between surface and underground locations. When I used cheat codes to kill them the function "ObliterateSector" doesnt decrease the counters. Same thing happens when we kill the zombies manually.

And later, when we visit unattended sector D13 on the surface we cant avoid a problem, cause all the sector counters were set by previous battle in the subway. Hell!

Report message to a moderator

Corporal
Previous Topic: An easy way of editing the XML files in dev builds (XML Editor broken?)
Next Topic: How to change loading screens?
Goto Forum:
  


Current Time: Fri Apr 19 23:36:35 GMT+3 2024

Total time taken to generate the page: 0.02183 seconds