File tree Expand file tree Collapse file tree 3 files changed +5
-8
lines changed
Expand file tree Collapse file tree 3 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -536,15 +536,15 @@ class AICommandInterface
536536 aiDoCommand (&parms);
537537 }
538538
539- inline void aiFollowExitProductionPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
539+ void aiFollowExitProductionPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
540540 {
541541 AICommandParms parms (AICMD_FOLLOW_EXITPRODUCTION_PATH, cmdSource);
542542 move_or_swap (parms.m_coords , *path);
543543 parms.m_obj = ignoreObject;
544544 aiDoCommand (&parms);
545545 }
546546
547- inline void aiFollowPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
547+ void aiFollowPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
548548 {
549549 AICommandParms parms (AICMD_FOLLOW_PATH, cmdSource);
550550 move_or_swap (parms.m_coords , *path);
Original file line number Diff line number Diff line change @@ -95,10 +95,7 @@ void AICommandParmsStorage::store(const AICommandParms& parms)
9595 m_obj = parms.m_obj ? parms.m_obj ->getID () : INVALID_ID;
9696 m_otherObj = parms.m_otherObj ? parms.m_otherObj ->getID () : INVALID_ID;
9797 m_teamName = parms.m_team ? parms.m_team ->getName () : AsciiString::TheEmptyString;
98- // We intentionally const_cast here so we can move the path coordinates into storage.
99- // AICommandParms is treated as a transient command container that is not reused after dispatch.
100- std::vector<Coord3D>& coords = const_cast <std::vector<Coord3D>&>(parms.m_coords );
101- move_or_swap (m_coords, coords);
98+ m_coords = parms.m_coords ;
10299 m_waypoint = parms.m_waypoint ;
103100 m_polygon = parms.m_polygon ;
104101 m_intValue = parms.m_intValue ; // / misc usage
Original file line number Diff line number Diff line change @@ -2620,7 +2620,7 @@ void AIUpdateInterface::aiDoCommand(const AICommandParms* parms)
26202620 break ;
26212621 case AICMD_FOLLOW_PATH:
26222622 {
2623- // Keep AICommandParms const; use a local copy of the coordinates when following the path .
2623+ // Copy coordinates to a local vector since privateFollowPath requires a non-const pointer .
26242624 std::vector<Coord3D> coords = parms->m_coords ;
26252625 privateFollowPath (&coords, parms->m_obj , parms->m_cmdSource , FALSE );
26262626 break ;
@@ -2630,7 +2630,7 @@ void AIUpdateInterface::aiDoCommand(const AICommandParms* parms)
26302630 break ;
26312631 case AICMD_FOLLOW_EXITPRODUCTION_PATH:
26322632 {
2633- // Keep AICommandParms const; use a local copy of the coordinates when following the exit path .
2633+ // Copy coordinates to a local vector since privateFollowPath requires a non-const pointer .
26342634 std::vector<Coord3D> coords = parms->m_coords ;
26352635 privateFollowPath (&coords, parms->m_obj , parms->m_cmdSource , TRUE );
26362636 break ;
You can’t perform that action at this time.
0 commit comments