Home » MODDING HQ 1.13 » v1.13 General Development Talk » Any introduction to the code?
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 previous 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
 
Read Message icon12.gif
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 icon14.gif
Read Message icon9.gif
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 film28.png
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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: Wed Feb 12 15:13:57 GMT+2 2025

Total time taken to generate the page: 0.01095 seconds