diff --git a/Source/CUnit.cpp b/Source/CUnit.cpp index bd85bc9..f546f47 100644 --- a/Source/CUnit.cpp +++ b/Source/CUnit.cpp @@ -58,6 +58,8 @@ void CUnit::mine(std::string action, int baseIndex) void CUnit::unsetTargetUnit() { + int queueIndex = Util::getQueueIndex(this->targetUnit); + if(queueIndex > -1) + Macro::queue.at(queueIndex).inProgress = 0; this->targetUnit = UnitTypes::None; - Macro::queue.at(Util::getQueueIndex(this->targetUnit)).inProgress = 0; } \ No newline at end of file diff --git a/Source/Macro.cpp b/Source/Macro.cpp index 597013c..aedef3a 100644 --- a/Source/Macro.cpp +++ b/Source/Macro.cpp @@ -178,6 +178,11 @@ void Macro::freeUnit(int index) if (base > -1) players.at(selfID).bases.at(base).subtractWorker(players.at(selfID).units.at(index).action); } + if (players.at(selfID).units.at(index).action == "expand") + { + stopProduction = 0; + } + players.at(selfID).units.at(index).action = ""; players.at(selfID).units.at(index).miningBase = -1; players.at(selfID).units.at(index).target = TilePosition(-1, -1); diff --git a/Source/Util.cpp b/Source/Util.cpp index 45d89b8..80ce1c7 100644 --- a/Source/Util.cpp +++ b/Source/Util.cpp @@ -200,6 +200,7 @@ int Util::getQueueIndex(UnitType ut) return i; } } + return -1; }