From 912e71be537aec6a8b2681c8f0208107a379e216 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 7 Dec 2020 01:30:38 +0100 Subject: int8 enums fixed --- src/control/Garages.cpp | 6 +++--- src/control/Garages.h | 22 +++++++++++----------- src/control/Script3.cpp | 6 +++--- src/control/Script4.cpp | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index b27b3c20..6ca13014 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -192,7 +192,7 @@ void CGarages::Update(void) aGarages[GarageToBeTidied].TidyUpGarage(); } -int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X3, float Y3, float Z2, eGarageType type, int32 targetId) +int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X3, float Y3, float Z2, uint8 type, int32 targetId) { if (NumGarages >= NUM_GARAGES) { assert(0); @@ -293,7 +293,7 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X return NumGarages++; } -void CGarages::ChangeGarageType(int16 garage, eGarageType type, int32 mi) +void CGarages::ChangeGarageType(int16 garage, uint8 type, int32 mi) { CGarage* pGarage = &aGarages[garage]; pGarage->m_eGarageType = type; @@ -2074,7 +2074,7 @@ void CGarages::CloseHideOutGaragesBeforeSave() } } -int32 CGarages::CountCarsInHideoutGarage(eGarageType type) +int32 CGarages::CountCarsInHideoutGarage(uint8 type) { int32 total = 0; for (int i = 0; i < NUM_GARAGE_STORED_CARS; i++) { diff --git a/src/control/Garages.h b/src/control/Garages.h index 04c01719..85c52a4c 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -7,7 +7,7 @@ class CVehicle; class CCamera; -enum eGarageState : int8 +enum eGarageState { GS_FULLYCLOSED, GS_OPENED, @@ -18,7 +18,7 @@ enum eGarageState : int8 GS_AFTERDROPOFF, }; -enum eGarageType : int8 +enum eGarageType { GARAGE_NONE, GARAGE_MISSION, @@ -93,8 +93,8 @@ VALIDATE_SIZE(CStoredCar, 0x28); class CGarage { - eGarageType m_eGarageType; - eGarageState m_eGarageState; + uint8 m_eGarageType; + uint8 m_eGarageState; uint8 m_nMaxStoredCars; bool field_2; // unused bool m_bClosingWithoutTargetCar; @@ -227,8 +227,8 @@ public: #endif static void Update(void); - static int16 AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X3, float Y3, float Z2, eGarageType type, int32 targetId); - static void ChangeGarageType(int16, eGarageType, int32); + static int16 AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X3, float Y3, float Z2, uint8 type, int32 targetId); + static void ChangeGarageType(int16, uint8, int32); static void PrintMessages(void); static void TriggerMessage(const char* text, int16, uint16 time, int16); static void SetTargetCarForMissonGarage(int16, CVehicle*); @@ -265,9 +265,9 @@ private: static bool IsCarSprayable(CVehicle*); static float FindDoorHeightForMI(int32); static void CloseHideOutGaragesBeforeSave(void); - static int32 CountCarsInHideoutGarage(eGarageType); - static int32 GetBombTypeForGarageType(eGarageType type) { return type - GARAGE_BOMBSHOP1 + 1; } - static int32 GetCarsCollectedIndexForGarageType(eGarageType type) + static int32 CountCarsInHideoutGarage(uint8); + static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; } + static int32 GetCarsCollectedIndexForGarageType(uint8 type) { switch (type) { case GARAGE_COLLECTCARS_1: return 0; @@ -278,7 +278,7 @@ private: } return 0; } - static int32 FindSafeHouseIndexForGarageType(eGarageType type) + static int32 FindSafeHouseIndexForGarageType(uint8 type) { switch (type) { case GARAGE_HIDEOUT_ONE: return 0; @@ -296,7 +296,7 @@ private: } return -1; } - static bool IsThisGarageTypeSafehouse(eGarageType type) { return FindSafeHouseIndexForGarageType(type) >= 0; } + static bool IsThisGarageTypeSafehouse(uint8 type) { return FindSafeHouseIndexForGarageType(type) >= 0; } friend class cAudioManager; friend class CReplay; diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index 2bc29eb7..2fe8b41f 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -286,7 +286,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) float supX = *(float*)&ScriptParams[5]; float supY = *(float*)&ScriptParams[6]; float supZ = *(float*)&ScriptParams[7]; - ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], 0); + ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], 0); StoreParameters(&m_nIp, 1); return 0; } @@ -302,7 +302,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) float supX = *(float*)&ScriptParams[5]; float supY = *(float*)&ScriptParams[6]; float supZ = *(float*)&ScriptParams[7]; - ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], ScriptParams[9]); + ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], ScriptParams[9]); StoreParameters(&m_nIp, 1); return 0; } @@ -1848,7 +1848,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) } case COMMAND_CHANGE_GARAGE_TYPE: CollectParameters(&m_nIp, 2); - CGarages::ChangeGarageType(ScriptParams[0], (eGarageType)ScriptParams[1], 0); + CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0); return 0; /* case COMMAND_ACTIVATE_CRUSHER_CRANE: diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index b2e2aaa5..7de31528 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -1537,7 +1537,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case COMMAND_CHANGE_GARAGE_TYPE_WITH_CAR_MODEL: { CollectParameters(&m_nIp, 3); - CGarages::ChangeGarageType(ScriptParams[0], (eGarageType)ScriptParams[1], ScriptParams[2]); + CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], ScriptParams[2]); return 0; } case COMMAND_FIND_DRUG_PLANE_COORDINATES: -- cgit v1.2.3 From 4c0744260d2a7c1d9e015359edc58affb975fa03 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 7 Dec 2020 01:59:17 +0100 Subject: uint8 enums fixed --- src/control/AutoPilot.cpp | 6 +++--- src/control/AutoPilot.h | 12 ++++++------ src/control/CarAI.cpp | 4 ++-- src/control/CarAI.h | 4 ++-- src/control/Pickups.cpp | 2 +- src/control/Pickups.h | 4 ++-- src/control/Script.cpp | 4 ++-- src/control/Script4.cpp | 2 +- src/control/Script6.cpp | 2 +- src/control/SetPieces.cpp | 2 +- src/control/SetPieces.h | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/control') diff --git a/src/control/AutoPilot.cpp b/src/control/AutoPilot.cpp index 1b14e3d7..a899518b 100644 --- a/src/control/AutoPilot.cpp +++ b/src/control/AutoPilot.cpp @@ -109,9 +109,9 @@ void CAutoPilot::Load(uint8*& buf) m_nNextDirection = ReadSaveBuf(buf); m_nCurrentLane = ReadSaveBuf(buf); m_nNextLane = ReadSaveBuf(buf); - m_nDrivingStyle = (eCarDrivingStyle)ReadSaveBuf(buf); - m_nCarMission = (eCarMission)ReadSaveBuf(buf); - m_nTempAction = (eCarTempAction)ReadSaveBuf(buf); + m_nDrivingStyle = ReadSaveBuf(buf); + m_nCarMission = ReadSaveBuf(buf); + m_nTempAction = ReadSaveBuf(buf); m_nTimeTempAction = ReadSaveBuf(buf); m_fMaxTrafficSpeed = ReadSaveBuf(buf); m_nCruiseSpeed = ReadSaveBuf(buf); diff --git a/src/control/AutoPilot.h b/src/control/AutoPilot.h index 25feb72d..aa14ccdd 100644 --- a/src/control/AutoPilot.h +++ b/src/control/AutoPilot.h @@ -4,7 +4,7 @@ class CVehicle; struct CPathNode; -enum eCarMission : uint8 +enum eCarMission { MISSION_NONE, MISSION_CRUISE, @@ -35,7 +35,7 @@ enum eCarMission : uint8 MISSION_BLOCKPLAYER_FORWARDANDBACK }; -enum eCarTempAction : uint8 +enum eCarTempAction { TEMPACT_NONE, TEMPACT_WAIT, @@ -50,7 +50,7 @@ enum eCarTempAction : uint8 TEMPACT_SWERVERIGHT }; -enum eCarDrivingStyle : uint8 +enum eCarDrivingStyle { DRIVINGSTYLE_STOP_FOR_CARS, DRIVINGSTYLE_SLOW_DOWN_FOR_CARS, @@ -76,9 +76,9 @@ public: int8 m_nNextDirection; int8 m_nCurrentLane; int8 m_nNextLane; - eCarDrivingStyle m_nDrivingStyle; - eCarMission m_nCarMission; - eCarTempAction m_nTempAction; + uint8 m_nDrivingStyle; + uint8 m_nCarMission; + uint8 m_nTempAction; uint32 m_nTimeTempAction; float m_fMaxTrafficSpeed; uint8 m_nCruiseSpeed; diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index a3fcbf9a..e7f3a546 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -634,7 +634,7 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget) pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed); } -eCarMission CCarAI::FindPoliceCarMissionForWantedLevel() +uint8 CCarAI::FindPoliceCarMissionForWantedLevel() { switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel){ case 0: @@ -648,7 +648,7 @@ eCarMission CCarAI::FindPoliceCarMissionForWantedLevel() } } -eCarMission CCarAI::FindPoliceBoatMissionForWantedLevel() +uint8 CCarAI::FindPoliceBoatMissionForWantedLevel() { switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) { case 0: diff --git a/src/control/CarAI.h b/src/control/CarAI.h index d4af1806..dcd76d78 100644 --- a/src/control/CarAI.h +++ b/src/control/CarAI.h @@ -22,8 +22,8 @@ public: static void TellOccupantsToFleeCar(CVehicle*); static void TellCarToRamOtherCar(CVehicle*, CVehicle*); static void TellCarToBlockOtherCar(CVehicle*, CVehicle*); - static eCarMission FindPoliceCarMissionForWantedLevel(); - static eCarMission FindPoliceBoatMissionForWantedLevel(); + static uint8 FindPoliceCarMissionForWantedLevel(); + static uint8 FindPoliceBoatMissionForWantedLevel(); static int32 FindPoliceCarSpeedForWantedLevel(CVehicle*); static void MellowOutChaseSpeed(CVehicle*); static void MellowOutChaseSpeedBoat(CVehicle*); diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 1ff4f8f6..c136c99f 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -852,7 +852,7 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan if (slot >= NUMPICKUPS) return -1; - aPickUps[slot].m_eType = (ePickupType)type; + aPickUps[slot].m_eType = type; aPickUps[slot].m_bRemoved = false; aPickUps[slot].m_nQuantity = quantity; aPickUps[slot].m_nMoneySpeed = rate; diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 36179f66..af9503e0 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -1,7 +1,7 @@ #pragma once #include "Weapon.h" -enum ePickupType : uint8 +enum ePickupType { PICKUP_NONE = 0, PICKUP_IN_SHOP, @@ -43,7 +43,7 @@ public: int16 m_eModelIndex; uint16 m_nIndex; char m_sTextKey[8]; - ePickupType m_eType; + uint8 m_eType; bool m_bRemoved; uint8 m_bWasAmmoCollected:1; uint8 m_bWasControlMessageShown:1; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index be0e9bf0..ff72d664 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -4038,7 +4038,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(car); - car->AutoPilot.m_nDrivingStyle = (eCarDrivingStyle)ScriptParams[1]; + car->AutoPilot.m_nDrivingStyle = (uint8)ScriptParams[1]; return 0; } case COMMAND_SET_CAR_MISSION: @@ -4046,7 +4046,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(car); - car->AutoPilot.m_nCarMission = (eCarMission)ScriptParams[1]; + car->AutoPilot.m_nCarMission = (uint8)ScriptParams[1]; car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); car->bEngineOn = true; return 0; diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index 7de31528..9b8f854e 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -1513,7 +1513,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pVehicle); - pVehicle->SetStatus((eEntityStatus)ScriptParams[1]); + pVehicle->SetStatus(ScriptParams[1]); return 0; } case COMMAND_IS_CHAR_MALE: diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index 53464804..50a7f745 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -1409,7 +1409,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pVehicle); - pVehicle->AutoPilot.m_nTempAction = (eCarTempAction)ScriptParams[1]; + pVehicle->AutoPilot.m_nTempAction = (uint8)ScriptParams[1]; pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[2]; return 0; } diff --git a/src/control/SetPieces.cpp b/src/control/SetPieces.cpp index 9b4e0075..c5142a0a 100644 --- a/src/control/SetPieces.cpp +++ b/src/control/SetPieces.cpp @@ -29,7 +29,7 @@ void CSetPieces::AddOne(uint8 type, CVector2D vTriggerInf, CVector2D vTriggerSup { if (NumSetPieces >= NUM_SETPIECES) return; - aSetPieces[NumSetPieces].m_nType = (eSetPieceType)type; + aSetPieces[NumSetPieces].m_nType = type; aSetPieces[NumSetPieces].m_vTriggerInf.x = Min(vTriggerInf.x, vTriggerSup.x); aSetPieces[NumSetPieces].m_vTriggerInf.y = Min(vTriggerInf.y, vTriggerSup.y); aSetPieces[NumSetPieces].m_vTriggerSup.x = Max(vTriggerInf.x, vTriggerSup.x); diff --git a/src/control/SetPieces.h b/src/control/SetPieces.h index 5776d35a..5c228d4c 100644 --- a/src/control/SetPieces.h +++ b/src/control/SetPieces.h @@ -5,7 +5,7 @@ class CVehicle; class CCopPed; -enum eSetPieceType : uint8 +enum eSetPieceType { SETPIECE_NONE = 0, SETPIECE_TWOCOPCARSINALLEY, @@ -20,7 +20,7 @@ enum eSetPieceType : uint8 class CSetPiece { public: - eSetPieceType m_nType; + uint8 m_nType; uint32 m_nLastTimeCreated; CVector2D m_vTriggerInf; CVector2D m_vTriggerSup; -- cgit v1.2.3