diff --git a/Editor/Editor Undo.cpp b/Editor/Editor Undo.cpp index 46a3062a..fb0b1a29 100644 --- a/Editor/Editor Undo.cpp +++ b/Editor/Editor Undo.cpp @@ -509,7 +509,11 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) { // this loop won't execute for single-tile structures; for multi-tile structures, we have to // add to the undo list all the other tiles covered by the structure +#if 0//dnl ch83 080114 iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; +#else + iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]); +#endif AddToUndoList( iCoveredMapIndex ); } pStructure = pStructure->pNext; @@ -537,11 +541,19 @@ void CheckMapIndexForMultiTileStructures( UINT32 usMapIndex ) // for multi-tile structures we have to add, to the undo list, all the other tiles covered by the structure if (pStructure->fFlags & STRUCTURE_BASE_TILE) { +#if 0//dnl ch83 080114 iCoveredMapIndex = usMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; +#else + iCoveredMapIndex = AddPosRelToBase(usMapIndex, pStructure->pDBStructureRef->ppTile[ubLoop]); +#endif } else { +#if 0//dnl ch83 080114 iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; +#else + iCoveredMapIndex = AddPosRelToBase(pStructure->sBaseGridNo, pStructure->pDBStructureRef->ppTile[ubLoop]); +#endif } AddToUndoList( iCoveredMapIndex ); } diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 5ff3e7e6..045c6066 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -659,9 +659,11 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef ) for (ubLoop = 0; ubLoop < pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++) { ppTile = pDBStructureRef->ppTile; - +#if 0//dnl ch83 080114 sTileGridNo = pCorpseDef->sGridNo + ppTile[ ubLoop ]->sPosRelToBase; - +#else + sTileGridNo = AddPosRelToBase(pCorpseDef->sGridNo, ppTile[ubLoop]); +#endif //Remove blood RemoveBlood( sTileGridNo, pCorpseDef->bLevel ); } diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 1aae29f3..f9a27f86 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -838,7 +838,11 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe { if ( !(ppTile[ ubLoop ]->fFlags & TILE_ON_ROOF ) ) { +#if 0//dnl ch83 080114 sStructGridNo = pBase->sGridNo + ppTile[ubLoop]->sPosRelToBase; +#else + sStructGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); +#endif // there might be two structures in this tile, one on each level, but we just want to // delete one on each pass @@ -1461,8 +1465,11 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++) { +#if 0//dnl ch83 080114 sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase; - +#else + sNewGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); +#endif // look in adjacent tiles for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ ) { diff --git a/TileEngine/Render Fun.cpp b/TileEngine/Render Fun.cpp index 4fa62e70..26dc5a37 100644 --- a/TileEngine/Render Fun.cpp +++ b/TileEngine/Render Fun.cpp @@ -216,8 +216,11 @@ void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo ) for ( ubLoop = 0; ubLoop < pBase->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++ ) { ppTile = pBase->pDBStructureRef->ppTile; +#if 0//dnl ch83 080114 sGridNo = pBase->sGridNo + ppTile[ ubLoop ]->sPosRelToBase; - +#else + sGridNo = AddPosRelToBase(pBase->sGridNo, ppTile[ubLoop]); +#endif if (sGridNo < 0 || sGridNo > WORLD_MAX) { continue; diff --git a/TileEngine/Structure Internals.h b/TileEngine/Structure Internals.h index 3d86fe57..d3980a9a 100644 --- a/TileEngine/Structure Internals.h +++ b/TileEngine/Structure Internals.h @@ -123,6 +123,8 @@ extern UINT8 AtHeight[PROFILE_Z_SIZE]; #define TILE_ON_ROOF 0x01 #define TILE_PASSABLE 0x02 +#define AddPosRelToBase(sBaseGridNo, pTile) (pTile->sPosRelToBase ? (sBaseGridNo + pTile->bXPosRelToBase + pTile->bYPosRelToBase * WORLD_COLS) : sBaseGridNo)//dnl ch83 080114 + typedef struct TAG_STRUCTURE_TILE { INT16 sPosRelToBase; // "single-axis" diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index f00daeaf..1139bc8d 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -636,7 +636,11 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC INT32 sOtherGridNo; ppTile = pDBStructureRef->ppTile; +#if 0//dnl ch83 080114 sGridNo = sBaseGridNo + ppTile[ubTileIndex]->sPosRelToBase; +#else + sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubTileIndex]); +#endif if (sGridNo < 0 || sGridNo > WORLD_MAX) { return( FALSE ); @@ -742,11 +746,16 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC } for (bLoop2 = 0; bLoop2 < pDBStructure->ubNumberOfTiles; bLoop2++) { +#if 0//dnl ch83 080114 if ( sBaseGridNo + ppTile[bLoop2]->sPosRelToBase == sOtherGridNo) { // obstacle will straddle wall! return( FALSE ); } +#else + if(AddPosRelToBase(sBaseGridNo, ppTile[bLoop2]) == sOtherGridNo) + return(FALSE);// obstacle will straddle wall! +#endif } } } @@ -988,7 +997,11 @@ STRUCTURE * InternalAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRU MemFree( ppStructure ); return( NULL ); } +#if 0//dnl ch83 080114 ppStructure[ubLoop]->sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase; +#else + ppStructure[ubLoop]->sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); +#endif if (ubLoop != BASE_TILE) { #ifdef JA2EDITOR @@ -1196,7 +1209,11 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure ) // Free all the tiles for (ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++) { +#if 0//dnl ch83 080114 sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase; +#else + sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]); +#endif // there might be two structures in this tile, one on each level, but we just want to // delete one on each pass pCurrent = FindStructureByID( sGridNo, usStructureID );