summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp2
-rw-r--r--src/control/Script.cpp3
-rw-r--r--src/control/TrafficLights.cpp7
3 files changed, 5 insertions, 7 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 963ef693..c1d89884 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -498,8 +498,6 @@ CCarCtrl::GenerateOneRandomCar()
directionCurrentLinkY = pCurrentLink->GetDirY() * pVehicle->AutoPilot.m_nCurrentDirection;
directionNextLinkX = pNextLink->GetDirX() * pVehicle->AutoPilot.m_nNextDirection;
directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection;
- pCurNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nCurrentRouteNode];
- pNextNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
}
#else
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirX();
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 50dc6b7b..3bcfa745 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -5661,8 +5661,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- UpdateCompareFlag(pVehicle->bIsInWater);
+ UpdateCompareFlag(pVehicle && pVehicle->bIsInWater);
return 0;
}
case COMMAND_GET_CLOSEST_CHAR_NODE:
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index f2dd6814..500d6af2 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -137,7 +137,7 @@ void
CTrafficLights::ScanForLightsOnMap(void)
{
int x, y;
- int i, j, l;
+ int i, j, k, l;
CPtrNode *node;
for(x = 0; x < NUMSECTORS_X; x++)
@@ -188,8 +188,9 @@ CTrafficLights::ScanForLightsOnMap(void)
for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){
j = ThePaths.m_pathNodes[i].firstLink + l;
if(ThePaths.ConnectionCrossesRoad(j)){
- dist2 = Abs(ThePaths.m_pathNodes[j].GetX() - light->GetPosition().x) +
- Abs(ThePaths.m_pathNodes[j].GetY() - light->GetPosition().y);
+ k = ThePaths.ConnectedNode(j);
+ dist2 = Abs(ThePaths.m_pathNodes[k].GetX() - light->GetPosition().x) +
+ Abs(ThePaths.m_pathNodes[k].GetY() - light->GetPosition().y);
if(dist1 < 15.0f || dist2 < 15.0f)
ThePaths.ConnectionSetTrafficLight(j);
}