Home » MODDING HQ 1.13 » v1.13 General Development Talk » Any introduction to the code?
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 previous message
Deleted.

 
Messages:2656
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

 
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 18:08:22 GMT+2 2025

Total time taken to generate the page: 0.00934 seconds