mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Fix an infinite loop when setting up path for Vehicle
This commit is contained in:
parent
944e0f24ae
commit
cd65424b00
1 changed files with 13 additions and 14 deletions
|
@ -3465,27 +3465,26 @@ void Vehicle::SetupPath(cVehicleSpline *pPath, SimpleEntity *se)
|
|||
|
||||
vLastOrigin = se->origin;
|
||||
|
||||
for (ent = se; ent != NULL; ent = ent->Next(), i++) {
|
||||
for (ent = se; ent; ent = ent->Next(), i++) {
|
||||
Vector vDelta = vLastOrigin - ent->origin;
|
||||
float vTmp[4];
|
||||
|
||||
if (vDelta.length() == 0 && i > 1) {
|
||||
Com_Printf("^~^~^Warning: Vehicle Driving with a Path that contains 2 equal points\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
fCurLength += vDelta.length();
|
||||
|
||||
vTmp[0] = fCurLength;
|
||||
VectorCopy(ent->origin, vTmp + 1);
|
||||
|
||||
if (ent->IsSubclassOfVehiclePoint()) {
|
||||
pPath->Add(vTmp, static_cast<VehiclePoint*>(ent)->spawnflags);
|
||||
} else {
|
||||
pPath->Add(vTmp, 0);
|
||||
}
|
||||
fCurLength += vDelta.length();
|
||||
|
||||
vLastOrigin = ent->origin;
|
||||
vTmp[0] = fCurLength;
|
||||
VectorCopy(ent->origin, vTmp + 1);
|
||||
|
||||
if (ent->IsSubclassOfVehiclePoint()) {
|
||||
pPath->Add(vTmp, static_cast<VehiclePoint*>(ent)->spawnflags);
|
||||
} else {
|
||||
pPath->Add(vTmp, 0);
|
||||
}
|
||||
|
||||
vLastOrigin = ent->origin;
|
||||
}
|
||||
|
||||
if (ent == se && i > 1) {
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue