diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 6fb9f5b2..d53bb201 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -162,7 +162,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ); void RenderMercInventoryPanel(); void SetDroppableCheckboxesBasedOnMercsInventory(); -extern BOOLEAN InternalAddSoldierToSector( UINT16 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); +extern BOOLEAN InternalAddSoldierToSector( SoldierID ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); //array which keeps track of which item is in which slot. This is dependant on the selected merc, so //these temp values must be updated when different mercs are selected, and reset when a merc detailed diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index d7f8d043..a7fef9f1 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -201,7 +201,7 @@ INT32 iCurrentInventoryPoolPage = 0; INT32 iLastInventoryPoolPage = 0; INT32 sObjectSourceGridNo = -1;//shadooow: I don't see much of a sense in this, we have gpItemPointerSoldier and we can use gpItemPointerSoldier->sGridNo to do this, this is actually unused -INT16 sObjectSourseSoldierID = -1; +SoldierID sObjectSourseSoldierID = NOBODY; // number of unseen items in sector UINT32 uiNumberOfUnSeenItems = 0; @@ -2660,7 +2660,7 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt // anv: swap ownerships too if( pInventoryPoolList[ iSrcSlot ].soldierID == sObjectSourseSoldierID ) { - pInventoryPoolList[ iSrcSlot ].soldierID = (-1); + pInventoryPoolList[ iSrcSlot ].soldierID = NOBODY; } pInventoryPoolList[ iDestSlot ].soldierID = sObjectSourseSoldierID; } @@ -2674,10 +2674,10 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt // anv: disable soldier's ownership, as otherwise stacked backpacks would share it if( iDestSlot != (-1) && iSrcSlot != (-1) ) { - pInventoryPoolList[ iDestSlot ].soldierID = (-1); - pInventoryPoolList[ iSrcSlot ].soldierID = (-1); + pInventoryPoolList[ iDestSlot ].soldierID = NOBODY; + pInventoryPoolList[ iSrcSlot ].soldierID = NOBODY; iCurrentlyPickedUpItem = iDestSlot; - sObjectSourseSoldierID = (-1); + sObjectSourseSoldierID = NOBODY; } // stacking pInventorySlot->AddObjectsToStack(*pItemPtr); @@ -2689,9 +2689,9 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt // anv: swap ownerships too if( pInventoryPoolList[ iSrcSlot ].soldierID == sObjectSourseSoldierID ) { - pInventoryPoolList[ iSrcSlot ].soldierID = (-1); + pInventoryPoolList[ iSrcSlot ].soldierID = NOBODY; } - INT32 iTempSoldierID = pInventoryPoolList[ iDestSlot ].soldierID; + SoldierID iTempSoldierID = pInventoryPoolList[ iDestSlot ].soldierID; pInventoryPoolList[ iDestSlot ].soldierID = sObjectSourseSoldierID; sObjectSourseSoldierID = iTempSoldierID; iCurrentlyPickedUpItem = iDestSlot; @@ -5159,7 +5159,7 @@ void SortSectorInventoryStackAndMerge(bool ammoOnly ) for ( UINT32 uiLoop = 0; uiLoop < pInventoryPoolList.size(); uiLoop++ ) { // anv: disable soldier's ownership, as otherwise stacked backpacks would share it - pInventoryPoolList[ uiLoop ].soldierID = (-1); + pInventoryPoolList[ uiLoop ].soldierID = NOBODY; } // Run through sector inventory. diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 81a3e340..16c913bc 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -15770,7 +15770,7 @@ void ChangeSelectedInfoChar( INT16 bCharNumber, BOOLEAN fResetSelectedList ) fShowInventoryFlag = FALSE; } //shadooow: this resets the current highlight item selection to be redrawn again - HandleCompatibleAmmoUI(MercPtrs[gCharactersList[bCharNumber].usSolID], NO_SLOT, FALSE); + HandleCompatibleAmmoUI(gCharactersList[bCharNumber].usSolID, NO_SLOT, FALSE); if (gpItemPointer != NULL) { gfCheckForMouseOverItem = TRUE; diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 95917894..2a1a1ba5 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4292,7 +4292,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pTempItemPool->iItemIndex].object.ubNumberOfObjects, MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else @@ -4303,7 +4303,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else @@ -4413,7 +4413,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].object.ubNumberOfObjects, MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else @@ -4424,7 +4424,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 3cfe7e15..92ef5863 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -11478,7 +11478,7 @@ void RenderItemPickupMenu( ) !gfStealing && Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != -1 && + gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]) //swprintf(pStr, L"%s (%s)", ShortItemNames[pObject->usItem], MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); swprintf(pStr, L"(%s)", MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index defdd7d7..a397d28d 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -4209,7 +4209,7 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) { if(gWorldItems[wi].soldierID == pSoldier->ubID) { - gWorldItems[wi].soldierID = -1; + gWorldItems[wi].soldierID = NOBODY; } } MoveItemToLBEItem( pSoldier, BPACKPOCKPOS ); @@ -4231,7 +4231,7 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) //CHRISL: There's the remote chance that a non-LBE item might get associated with a merc. If that happens, we can // have a CTD, so lets resolve that here. if(Item[gWorldItems[wi].object.usItem].usItemClass != IC_LBEGEAR) - gWorldItems[wi].soldierID = -1; + gWorldItems[wi].soldierID = NOBODY; if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].fExists == TRUE && Item[gWorldItems[wi].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[wi].object.usItem].ubClassIndex].lbeClass == BACKPACK) { for (int x = 0; x < gWorldItems[wi].object.ubNumberOfObjects; ++x) { diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index 4bab504f..eee44c60 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -3901,7 +3901,7 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, pWorldItem_tmp[uiCount].usFlags = WORLD_ITEM_REACHABLE; pWorldItem_tmp[uiCount].bVisible = 1; pWorldItem_tmp[uiCount].bRenderZHeightAboveLevel = 0; - pWorldItem_tmp[uiCount].soldierID = -1; + pWorldItem_tmp[uiCount].soldierID = NOBODY; pWorldItem_tmp[uiCount].object = tmp.Inv[ i ]; } } @@ -4647,7 +4647,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI pWorldItem[uiCount].usFlags = WORLD_ITEM_REACHABLE; pWorldItem[uiCount].bVisible = 1; pWorldItem[uiCount].bRenderZHeightAboveLevel = 0; - pWorldItem[uiCount].soldierID = -1; + pWorldItem[uiCount].soldierID = NOBODY; pWorldItem[uiCount].object = newAmmoObj; fNewMagCreated = FALSE; @@ -4686,7 +4686,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI pWorldItem_tmp[uiCount].usFlags = WORLD_ITEM_REACHABLE; pWorldItem_tmp[uiCount].bVisible = 1; pWorldItem_tmp[uiCount].bRenderZHeightAboveLevel = 0; - pWorldItem_tmp[uiCount].soldierID = -1; + pWorldItem_tmp[uiCount].soldierID = NOBODY; pWorldItem_tmp[uiCount].object = newAmmoObj; fNewMagCreated = FALSE; diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index e5c9ec68..ef769a86 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1135,17 +1135,16 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U return(sGridNo); } -BOOLEAN InternalAddSoldierToSector(UINT16 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) +BOOLEAN InternalAddSoldierToSector(SoldierID ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) { - UINT8 ubDirection = 0; - UINT8 ubCalculatedDirection = 0; - SOLDIERTYPE *pSoldier = 0; - INT32 sGridNo = NOWHERE; - INT32 sExitGridNo = NOWHERE; + UINT8 ubDirection = 0; + UINT8 ubCalculatedDirection = 0; + INT32 sGridNo = NOWHERE; + INT32 sExitGridNo = NOWHERE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("InternalAddSoldierToSector")); - pSoldier = MercPtrs[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; if ( pSoldier->bActive ) { @@ -1332,7 +1331,7 @@ BOOLEAN InternalAddSoldierToSector(UINT16 ubID, BOOLEAN fCalculateDirection, BOO return( FALSE ); } -BOOLEAN AddSoldierToSector( UINT16 ubID ) +BOOLEAN AddSoldierToSector( SoldierID ubID ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierToSector")); return( InternalAddSoldierToSector( ubID, TRUE, FALSE, 0 , 0) ); diff --git a/Tactical/Soldier Add.h b/Tactical/Soldier Add.h index 4d4ba01b..32aa90dd 100644 --- a/Tactical/Soldier Add.h +++ b/Tactical/Soldier Add.h @@ -30,7 +30,7 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U // Adds a soldier ( already created in mercptrs[] array )! // Finds a good placement based on data in the loaded sector and if they are enemy's or not, etc... -BOOLEAN AddSoldierToSector( UINT16 ubID ); +BOOLEAN AddSoldierToSector( SoldierID ubID ); BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT16 ubID ); diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index f2bac848..adcb9671 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -256,7 +256,7 @@ void WORLDITEM::initialize() this->bRenderZHeightAboveLevel = 0; this->bVisible = 0; this->ubNonExistChance = 0; - this->soldierID = -1; + this->soldierID = NOBODY; this->object.initialize(); } @@ -270,7 +270,7 @@ WORLDITEM& WORLDITEM::operator=(OLD_WORLDITEM_101& src) this->bRenderZHeightAboveLevel = src.bRenderZHeightAboveLevel; this->bVisible = src.bVisible; this->ubNonExistChance = src.ubNonExistChance; - this->soldierID = -1; + this->soldierID = NOBODY; //convert the OBJECTTYPE this->object = src.oldObject; @@ -288,7 +288,7 @@ WORLDITEM& WORLDITEM::operator=(_OLD_WORLDITEM& src)//dnl ch42 280909 bRenderZHeightAboveLevel = src.bRenderZHeightAboveLevel; bVisible = src.bVisible; ubNonExistChance = src.ubNonExistChance; - soldierID = -1; + soldierID = NOBODY; object = src.object; } return(*this); diff --git a/Tactical/World Items.h b/Tactical/World Items.h index 04a07697..cd3ae1ee 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -72,7 +72,7 @@ public: //Because this value is zero in the saved maps, we can't change it to 100, hence the reversal method. //This check is only performed the first time a map is loaded. Later, it is entirely skipped. UINT8 ubNonExistChance; - INT16 soldierID; + SoldierID soldierID; char endOfPod; OBJECTTYPE object; }; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 6d3c28b2..74e67f99 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -3796,11 +3796,11 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo WORLDITEM wi = gWorldItems[iWorldIndex]; if (wi.fExists) { - INT16 soldierID = wi.soldierID; // bomb's owner - if (soldierID == -1) + SoldierID soldierID = wi.soldierID; // bomb's owner + if (soldierID == NOBODY) soldierID = wi.object[0]->data.misc.ubBombOwner - 2; // undo the hack - if (IsOurSoldier(gubPersonToSetOffExplosions) || IsOurSoldier(soldierID)) + if (IsOurSoldier(gubPersonToSetOffExplosions) || IsOurSoldier((SOLDIERTYPE*)soldierID)) { // we set off the bomb (could be failed disarm) or we own it, tell the other clients we are setting it off send_detonate_explosive(iWorldIndex,gubPersonToSetOffExplosions);