Home » MODDING HQ 1.13 » v1.13 General Development Talk » Any introduction to the code?
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 previous 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
 
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 21:05:34 GMT+2 2025

Total time taken to generate the page: 0.01001 seconds