New item tag: mines with <antitankmine> set to 1 will be activated by vehicles or robots.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7906 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-07-08 19:54:54 +00:00
parent 25f04ef661
commit 457814265c
3 changed files with 28 additions and 12 deletions
+2 -1
View File
@@ -1046,7 +1046,8 @@ typedef struct
BOOLEAN robotremotecontrol;
BOOLEAN camouflagekit;
BOOLEAN locksmithkit;
BOOLEAN mine;
BOOLEAN mine;
BOOLEAN antitankmine;
FLOAT alcohol;
BOOLEAN hardware;
BOOLEAN medical;
+8
View File
@@ -4529,6 +4529,14 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8
{
if (fAllBombs || (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE)
{
// Flugente: if this is a anti-tank mine, only detonate it if the person triggering it is (in) a vehicle, or if we detonate everything unconditional
if ( !fAllBombs && ubID != NOBODY && Item[pObj->usItem].antitankmine )
{
// if this is not a vehicle, not a robot and not a tank, don't activate
if ( !(MercPtrs[ubID]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ubID] ) && !TANK( MercPtrs[ubID] ) )
continue;
}
// Snap: if we do set off our own trap (e.g. by trying to disarm it), we pay!
/*if (!fAllBombs && MercPtrs[ ubID ]->bTeam != gbPlayerNum )
{
+18 -11
View File
@@ -209,6 +209,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
strcmp(name, "CamouflageKit") == 0 ||
strcmp(name, "LocksmithKit") == 0 ||
strcmp(name, "Mine") == 0 ||
strcmp(name, "antitankmine" ) == 0 ||
strcmp(name, "GasCan") == 0 ||
strcmp(name, "ContainsLiquid") == 0 ||
strcmp(name, "Rock") == 0 ||
@@ -1134,7 +1135,12 @@ itemEndElementHandle(void *userData, const XML_Char *name)
{
pData->curElement = ELEMENT;
pData->curItem.mine = (BOOLEAN) atol(pData->szCharData);
}
}
else if ( strcmp( name, "antitankmine" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curItem.antitankmine = (BOOLEAN)atol( pData->szCharData );
}
else if(strcmp(name, "GasCan") == 0)
{
pData->curElement = ELEMENT;
@@ -1950,18 +1956,19 @@ BOOLEAN WriteItemStats()
FilePrintf(hFile,"\t\t<PercentAPReduction>%d</PercentAPReduction>\r\n", Item[cnt].percentapreduction );
FilePrintf(hFile,"\t\t<PercentStatusDrainReduction>%d</PercentStatusDrainReduction>\r\n", Item[cnt].percentstatusdrainreduction );
FilePrintf(hFile,"\t\t<DamageBonus>%d</DamageBonus>\r\n", Item[cnt].damagebonus );
FilePrintf(hFile,"\t\t<DamageBonus>%d</DamageBonus>\r\n", Item[cnt].damagebonus );
FilePrintf(hFile,"\t\t<MeleeDamageBonus>%d</MeleeDamageBonus>\r\n", Item[cnt].meleedamagebonus );
FilePrintf(hFile,"\t\t<GrenadeLauncher>%d</GrenadeLauncher>\r\n", Item[cnt].grenadelauncher );
FilePrintf(hFile,"\t\t<Duckbill>%d</Duckbill>\r\n", Item[cnt].duckbill );
FilePrintf(hFile,"\t\t<GLGrenade>%d</GLGrenade>\r\n", Item[cnt].glgrenade );
FilePrintf(hFile,"\t\t<Mine>%d</Mine>\r\n", Item[cnt].mine );
FilePrintf(hFile,"\t\t<Mortar>%d</Mortar>\r\n", Item[cnt].mortar );
FilePrintf(hFile,"\t\t<RocketLauncher>%d</RocketLauncher>\r\n", Item[cnt].rocketlauncher );
FilePrintf(hFile,"\t\t<SingleShotRocketLauncher>%d</SingleShotRocketLauncher>\r\n", Item[cnt].singleshotrocketlauncher );
FilePrintf(hFile,"\t\t<DiscardedLauncherItem>%d</DiscardedLauncherItem>\r\n", Item[cnt].discardedlauncheritem );
FilePrintf(hFile,"\t\t<RocketRifle>%d</RocketRifle>\r\n", Item[cnt].rocketrifle);
FilePrintf(hFile,"\t\t<Cannon>%d</Cannon>\r\n", Item[cnt].cannon);
FilePrintf(hFile,"\t\t<Duckbill>%d</Duckbill>\r\n", Item[cnt].duckbill );
FilePrintf(hFile,"\t\t<GLGrenade>%d</GLGrenade>\r\n", Item[cnt].glgrenade );
FilePrintf(hFile,"\t\t<Mine>%d</Mine>\r\n", Item[cnt].mine );
FilePrintf(hFile,"\t\t<antitankmine>%d</antitankmine>\r\n", Item[cnt].antitankmine );
FilePrintf(hFile,"\t\t<Mortar>%d</Mortar>\r\n", Item[cnt].mortar );
FilePrintf(hFile,"\t\t<RocketLauncher>%d</RocketLauncher>\r\n", Item[cnt].rocketlauncher );
FilePrintf(hFile,"\t\t<SingleShotRocketLauncher>%d</SingleShotRocketLauncher>\r\n", Item[cnt].singleshotrocketlauncher );
FilePrintf(hFile,"\t\t<DiscardedLauncherItem>%d</DiscardedLauncherItem>\r\n", Item[cnt].discardedlauncheritem );
FilePrintf(hFile,"\t\t<RocketRifle>%d</RocketRifle>\r\n", Item[cnt].rocketrifle);
FilePrintf(hFile,"\t\t<Cannon>%d</Cannon>\r\n", Item[cnt].cannon);
for(UINT8 cnt2 = 0; cnt2 < MAX_DEFAULT_ATTACHMENTS; cnt2++){
if(Item[cnt].defaultattachments[cnt2] != 0){