[+] Added ability to keep selected harvester when it enters mine

This commit is contained in:
cybermind 2015-02-18 21:21:12 +05:00
parent ec7c277249
commit d75ee25a90
2 changed files with 13 additions and 1 deletions

View file

@ -545,7 +545,13 @@ int COrder_Resource::StartGathering(CUnit &unit)
if (!resinfo.HarvestFromOutside) {
if (goal->Variable[MAXHARVESTERS_INDEX].Value == 0 || goal->Variable[MAXHARVESTERS_INDEX].Value > goal->InsideCount) {
this->ClearGoal();
int selected = unit.Selected;
unit.Remove(goal);
if (selected) {
unit.Removed = 0;
SelectUnit(unit);
unit.Removed = 1;
}
} else if (goal->Variable[MAXHARVESTERS_INDEX].Value <= goal->InsideCount) {
//Resource is full, wait
unit.Wait = 10;
@ -972,7 +978,13 @@ int COrder_Resource::MoveToDepot(CUnit &unit)
// Place unit inside the depot
if (unit.Wait) {
int selected = unit.Selected;
unit.Remove(&goal);
if (selected) {
unit.Removed = 0;
SelectUnit(unit);
unit.Removed = 1;
}
unit.Anim.CurrAnim = NULL;
}

View file

@ -611,7 +611,7 @@ void DrawShadow(const CUnitType &type, int frame, const PixelPos &screenPos)
*/
void ShowOrder(const CUnit &unit)
{
if (unit.Destroyed) {
if (unit.Destroyed || unit.Removed) {
return;
}
#ifndef DEBUG