File tree Expand file tree Collapse file tree 5 files changed +10
-10
lines changed
Dependencies/Utility/Utility
GeneralsMD/Code/GameEngine Expand file tree Collapse file tree 5 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 4949#define nullptr 0
5050#endif
5151
52- // TheSuperHackers @performance bobtista 25/11/2025 Helper to move-assign from pointer : uses std::move in C++11, swap in C++98
52+ // TheSuperHackers @performance bobtista 25/11/2025 Helper to move-assign from reference : uses std::move in C++11, swap in C++98
5353template <typename T>
54- inline void move_assign_from_pointer (T& dest, T* src)
54+ inline void move_or_swap (T& dest, T& src)
5555{
5656#if __cplusplus >= 201103L
57- dest = std::move (* src);
57+ dest = std::move (src);
5858#else
5959 // Use swap to emulate move semantics for VC6 compatibility
60- dest.swap (* src);
60+ dest.swap (src);
6161#endif
6262}
Original file line number Diff line number Diff line change @@ -539,15 +539,15 @@ class AICommandInterface
539539 inline void aiFollowExitProductionPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
540540 {
541541 AICommandParms parms (AICMD_FOLLOW_EXITPRODUCTION_PATH, cmdSource);
542- move_assign_from_pointer (parms.m_coords , path);
542+ move_or_swap (parms.m_coords , * path);
543543 parms.m_obj = ignoreObject;
544544 aiDoCommand (&parms);
545545 }
546546
547547 inline void aiFollowPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
548548 {
549549 AICommandParms parms (AICMD_FOLLOW_PATH, cmdSource);
550- move_assign_from_pointer (parms.m_coords , path);
550+ move_or_swap (parms.m_coords , * path);
551551 parms.m_obj = ignoreObject;
552552 aiDoCommand (&parms);
553553 }
Original file line number Diff line number Diff line change @@ -818,7 +818,7 @@ void AIStateMachine::loadPostProcess( void )
818818 */
819819void AIStateMachine::setGoalPath ( std::vector<Coord3D>* path )
820820{
821- move_assign_from_pointer (m_goalPath, path);
821+ move_or_swap (m_goalPath, * path);
822822}
823823
824824#ifdef STATE_MACHINE_DEBUG
Original file line number Diff line number Diff line change @@ -553,15 +553,15 @@ class AICommandInterface
553553 inline void aiFollowExitProductionPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
554554 {
555555 AICommandParms parms (AICMD_FOLLOW_EXITPRODUCTION_PATH, cmdSource);
556- move_assign_from_pointer (parms.m_coords , path);
556+ move_or_swap (parms.m_coords , * path);
557557 parms.m_obj = ignoreObject;
558558 aiDoCommand (&parms);
559559 }
560560
561561 inline void aiFollowPath ( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource )
562562 {
563563 AICommandParms parms (AICMD_FOLLOW_PATH, cmdSource);
564- move_assign_from_pointer (parms.m_coords , path);
564+ move_or_swap (parms.m_coords , * path);
565565 parms.m_obj = ignoreObject;
566566 aiDoCommand (&parms);
567567 }
Original file line number Diff line number Diff line change @@ -823,7 +823,7 @@ void AIStateMachine::loadPostProcess( void )
823823 */
824824void AIStateMachine::setGoalPath ( std::vector<Coord3D>* path )
825825{
826- move_assign_from_pointer (m_goalPath, path);
826+ move_or_swap (m_goalPath, * path);
827827}
828828
829829#ifdef STATE_MACHINE_DEBUG
You can’t perform that action at this time.
0 commit comments