From d6314f9564912393134d832b8cc268dd3dbfcbaa Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sat, 18 Apr 2020 12:29:28 +0200 Subject: Revert "Part one" This reverts commit 63951d9b957b30a110f42a03edb4833cbbaf380e. --- src/control/Darkel.h | 3 +-- src/control/PathFind.cpp | 35 ++++++++++++++--------------------- src/control/TrafficLights.cpp | 2 +- 3 files changed, 16 insertions(+), 24 deletions(-) (limited to 'src/control') diff --git a/src/control/Darkel.h b/src/control/Darkel.h index 14529c63..b6092dcb 100644 --- a/src/control/Darkel.h +++ b/src/control/Darkel.h @@ -1,10 +1,9 @@ #pragma once - #include "ModelIndices.h" -#include "WeaponType.h" class CVehicle; class CPed; +enum eWeaponType; enum { diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index cedef63c..9d0959a8 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1466,11 +1466,8 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta targetNode = FindNodeClosestToCoors(target, type, distLimit); else targetNode = forcedTargetNode; - if(targetNode < 0) { - *pNumNodes = 0; - if(pDist) *pDist = 100000.0f; - return; - } + if(targetNode < 0) + goto fail; // Find start int numPathsToTry; @@ -1489,28 +1486,19 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta numPathsToTry = 1; startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex]; } - if(numPathsToTry == 0) { - *pNumNodes = 0; - if(pDist) *pDist = 100000.0f; - return; - } + if(numPathsToTry == 0) + goto fail; if(startNodeId < 0){ // why only check node 0? - if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != - m_pathNodes[targetNode].group) { - *pNumNodes = 0; - if(pDist) *pDist = 100000.0f; - return; - } + if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != m_pathNodes[targetNode].group) + goto fail; }else{ - if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) { - *pNumNodes = 0; - if(pDist) *pDist = 100000.0f; - return; - } + if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) + goto fail; } + for(i = 0; i < 512; i++) m_searchNodes[i].next = nil; AddNodeToList(&m_pathNodes[targetNode], 0); @@ -1588,6 +1576,11 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta for(i = 0; i < numNodesToBeCleared; i++) apNodesToBeCleared[i]->distance = MAX_DIST; return; + +fail: + *pNumNodes = 0; + if(pDist) + *pDist = 100000.0f; } static CPathNode *pNodeList[32]; diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 70fcbc32..096bb484 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -8,7 +8,7 @@ #include "Clock.h" #include "Weather.h" #include "Timecycle.h" -#include "PointLights.h" +#include "Pointlights.h" #include "Shadows.h" #include "Coronas.h" #include "SpecialFX.h" -- cgit v1.2.3