removed redundant checks

This commit is contained in:
Nikolay Korolev 2020-04-24 01:40:12 +03:00
parent 0fc505926f
commit bed41e1bec

View File

@ -256,10 +256,6 @@ void CUpsideDownCarCheck::UpdateTimers()
{ {
uint32 timeStep = CTimer::GetTimeStepInMilliseconds(); uint32 timeStep = CTimer::GetTimeStepInMilliseconds();
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
#ifdef FIX_BUGS
if (m_sCars[i].m_nVehicleIndex == -1)
continue;
#endif
CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex); CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex);
if (v){ if (v){
if (IsCarUpsideDown(m_sCars[i].m_nVehicleIndex)) if (IsCarUpsideDown(m_sCars[i].m_nVehicleIndex))
@ -2308,10 +2304,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
assert(pCurrent); // GetIndex(0) doesn't look good assert(pCurrent); // GetIndex(0) doesn't look good
int handle = CPools::GetVehiclePool()->GetIndex(pCurrent); int handle = CPools::GetVehiclePool()->GetIndex(pCurrent);
if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript){ if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript){
#ifdef FIX_BUGS
if (CTheScripts::StoreVehicleIndex != -1)
#endif
{
CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
if (pOld){ if (pOld){
CCarCtrl::RemoveFromInterestingVehicleList(pOld); CCarCtrl::RemoveFromInterestingVehicleList(pOld);
@ -2323,7 +2315,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR); CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
} }
} }
}
CTheScripts::StoreVehicleIndex = handle; CTheScripts::StoreVehicleIndex = handle;
switch (pCurrent->VehicleCreatedBy){ switch (pCurrent->VehicleCreatedBy){
@ -2364,10 +2355,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
assert(pCurrent); // Here pCurrent shouldn't be NULL anyway assert(pCurrent); // Here pCurrent shouldn't be NULL anyway
int handle = CPools::GetVehiclePool()->GetIndex(pCurrent); int handle = CPools::GetVehiclePool()->GetIndex(pCurrent);
if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript) { if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript) {
#ifdef FIX_BUGS
if (CTheScripts::StoreVehicleIndex != -1)
#endif
{
CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
if (pOld){ if (pOld){
CCarCtrl::RemoveFromInterestingVehicleList(pOld); CCarCtrl::RemoveFromInterestingVehicleList(pOld);
@ -2379,7 +2366,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR); CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
} }
} }
}
CTheScripts::StoreVehicleIndex = handle; CTheScripts::StoreVehicleIndex = handle;
switch (pCurrent->VehicleCreatedBy) { switch (pCurrent->VehicleCreatedBy) {