From 457814265c57b48a42c4a9eec7e97dca972c5006 Mon Sep 17 00:00:00 2001 From: Flugente Date: Wed, 8 Jul 2015 19:54:54 +0000 Subject: [PATCH] New item tag: mines with 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 --- Tactical/Item Types.h | 3 ++- TileEngine/Explosion Control.cpp | 8 ++++++++ Utils/XML_Items.cpp | 29 ++++++++++++++++++----------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index e1d71ea76..5f64fbe93 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -1046,7 +1046,8 @@ typedef struct BOOLEAN robotremotecontrol; BOOLEAN camouflagekit; BOOLEAN locksmithkit; - BOOLEAN mine; + BOOLEAN mine; + BOOLEAN antitankmine; FLOAT alcohol; BOOLEAN hardware; BOOLEAN medical; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 32e42f028..05a99c27c 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -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 ) { diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index ae8de0ab9..a7f98d228 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -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%d\r\n", Item[cnt].percentapreduction ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentstatusdrainreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].grenadelauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].duckbill ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].glgrenade ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mine ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mortar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketlauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].singleshotrocketlauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketrifle); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cannon); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].duckbill ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].glgrenade ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mine ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].antitankmine ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mortar ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketlauncher ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].singleshotrocketlauncher ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketrifle); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cannon); for(UINT8 cnt2 = 0; cnt2 < MAX_DEFAULT_ATTACHMENTS; cnt2++){ if(Item[cnt].defaultattachments[cnt2] != 0){