File tree Expand file tree Collapse file tree 2 files changed +38
-24
lines changed
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate
Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate Expand file tree Collapse file tree 2 files changed +38
-24
lines changed Original file line number Diff line number Diff line change @@ -229,21 +229,28 @@ UpdateSleepTime RailedTransportAIUpdate::update( void )
229
229
// sanity
230
230
DEBUG_ASSERTCRASH ( waypoint, (" RailedTransportAIUpdate: Invalid target waypoint\n " ) );
231
231
232
- // how far away are we from the target waypoint
233
- const Coord3D *start = us->getPosition ();
234
- const Coord3D *end = waypoint->getLocation ();
235
- Coord3D v;
236
- v.x = end->x - start->x ;
237
- v.y = end->y - start->y ;
238
- v.z = end->z - start->z ;
239
- Real dist = v.length ();
240
- if ( dist <= 5 .0f || isIdle () )
232
+ if (waypoint)
241
233
{
234
+ // how far away are we from the target waypoint
235
+ const Coord3D *start = us->getPosition ();
236
+ const Coord3D *end = waypoint->getLocation ();
237
+ Coord3D v;
238
+ v.x = end->x - start->x ;
239
+ v.y = end->y - start->y ;
240
+ v.z = end->z - start->z ;
241
+ Real dist = v.length ();
242
+ if ( dist <= 5 .0f || isIdle () )
243
+ {
242
244
243
- // we are no longer in transit
244
- setInTransit ( FALSE );
245
+ // we are no longer in transit
246
+ setInTransit ( FALSE );
245
247
246
- } // end if
248
+ } // end if
249
+ }
250
+ else
251
+ {
252
+ setInTransit ( FALSE );
253
+ }
247
254
248
255
} // end if
249
256
Original file line number Diff line number Diff line change @@ -229,21 +229,28 @@ UpdateSleepTime RailedTransportAIUpdate::update( void )
229
229
// sanity
230
230
DEBUG_ASSERTCRASH ( waypoint, (" RailedTransportAIUpdate: Invalid target waypoint\n " ) );
231
231
232
- // how far away are we from the target waypoint
233
- const Coord3D *start = us->getPosition ();
234
- const Coord3D *end = waypoint->getLocation ();
235
- Coord3D v;
236
- v.x = end->x - start->x ;
237
- v.y = end->y - start->y ;
238
- v.z = end->z - start->z ;
239
- Real dist = v.length ();
240
- if ( dist <= 5 .0f || isIdle () )
232
+ if (waypoint)
241
233
{
234
+ // how far away are we from the target waypoint
235
+ const Coord3D *start = us->getPosition ();
236
+ const Coord3D *end = waypoint->getLocation ();
237
+ Coord3D v;
238
+ v.x = end->x - start->x ;
239
+ v.y = end->y - start->y ;
240
+ v.z = end->z - start->z ;
241
+ Real dist = v.length ();
242
+ if ( dist <= 5 .0f || isIdle () )
243
+ {
242
244
243
- // we are no longer in transit
244
- setInTransit ( FALSE );
245
+ // we are no longer in transit
246
+ setInTransit ( FALSE );
245
247
246
- } // end if
248
+ } // end if
249
+ }
250
+ else
251
+ {
252
+ setInTransit ( FALSE );
253
+ }
247
254
248
255
} // end if
249
256
You can’t perform that action at this time.
0 commit comments