Skip to content

Instantly share code, notes, and snippets.

@abma
Last active December 20, 2015 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abma/6076088 to your computer and use it in GitHub Desktop.
Save abma/6076088 to your computer and use it in GitHub Desktop.
diff --git a/rts/Sim/Units/CommandAI/TransportCAI.cpp b/rts/Sim/Units/CommandAI/TransportCAI.cpp
index 3ac2f5d..cb0db19 100644
--- a/rts/Sim/Units/CommandAI/TransportCAI.cpp
+++ b/rts/Sim/Units/CommandAI/TransportCAI.cpp
@@ -230,6 +230,7 @@ void CTransportCAI::ExecuteLoadUnits(Command& c)
StopMove();
owner->script->TransportPickup(unit);
+ StopTransportee(*unit);
}
} else if (owner->moveType->progressState == AMoveType::Failed && sqDist < (
// if we're pretty close already but CGroundMoveType fails because i
@@ -256,6 +257,7 @@ void CTransportCAI::ExecuteLoadUnits(Command& c)
Command c2(CMD_LOAD_UNITS, c.options|INTERNAL_ORDER, unit->id);
commandQue.push_front(c2);
inCommand = false;
+ StopTransportee(*unit);
SlowUpdate();
return;
@@ -686,6 +688,7 @@ void CTransportCAI::UnloadLand(Command& c)
inCommand = true;
StopMove();
owner->script->TransportDrop(unit, pos);
+ StopTransportee(*unit);
}
}
}
@@ -744,6 +747,7 @@ void CTransportCAI::UnloadDrop(Command& c)
inCommand = true;
StopMove();
owner->script->TransportDrop(transportee, pos);
+ StopTransportee(*transportee);
}
}
}
@@ -829,6 +833,7 @@ void CTransportCAI::UnloadLandFlood(Command& c)
owner->script->TransportDrop(transList.front().unit, pos);
transport->DetachUnitFromAir(unit,pos);
+ StopTransportee(*unit);
FinishCommand();
if (transport->GetTransportedUnits().empty()) {
@@ -845,6 +850,7 @@ void CTransportCAI::UnloadLandFlood(Command& c)
StopMove();
owner->script->TransportDrop(transList.front().unit, pos);
transport->DetachUnitFromAir(unit, pos);
+ StopTransportee(*unit);
FinishCommand();
if (transport->GetTransportedUnits().empty()) {
@@ -1059,3 +1065,11 @@ bool CTransportCAI::AllowedCommand(const Command& c, bool fromSynced)
return true;
}
+
+void CTransportCAI::StopTransportee(CUnit& unit)
+{
+ unit.moveType->StopMoving();
+ unit.speed = ZeroVector;
+ unit.isMoving = false;
+}
+
diff --git a/rts/Sim/Units/CommandAI/TransportCAI.h b/rts/Sim/Units/CommandAI/TransportCAI.h
index 3aec921..b3b4dd0 100644
--- a/rts/Sim/Units/CommandAI/TransportCAI.h
+++ b/rts/Sim/Units/CommandAI/TransportCAI.h
@@ -71,6 +71,10 @@ private:
* units it carries.
*/
bool SpotIsClearIgnoreSelf(float3 pos, CUnit* unitToUnload);
+ /**
+ * Stop the transported unit moving
+ */
+ void StopTransportee(CUnit& unit);
std::list<float3> dropSpots;
bool isFirstIteration;
float3 startingDropPos;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment