[-] Fixed mine resource displaying decoration

This commit is contained in:
cybermind 2015-02-22 17:36:05 +05:00
parent 1781674279
commit 59430f91a2
2 changed files with 5 additions and 2 deletions

View file

@ -715,6 +715,9 @@ static int CclSetResourcesHeld(lua_State *l)
lua_pop(l, 1);
const int value = LuaToNumber(l, 2);
unit->ResourcesHeld = value;
unit->Variable[GIVERESOURCE_INDEX].Value = value;
unit->Variable[GIVERESOURCE_INDEX].Max = value;
unit->Variable[GIVERESOURCE_INDEX].Enable = 1;
return 0;
}

View file

@ -1560,7 +1560,7 @@ void UpdateUnitVariables(CUnit &unit)
for (int i = 0; i < NVARALREADYDEFINED; i++) { // default values
if (i == ARMOR_INDEX || i == PIERCINGDAMAGE_INDEX || i == BASICDAMAGE_INDEX
|| i == MANA_INDEX || i == KILL_INDEX || i == XP_INDEX
|| i == MANA_INDEX || i == KILL_INDEX || i == XP_INDEX || i == GIVERESOURCE_INDEX
|| i == BLOODLUST_INDEX || i == HASTE_INDEX || i == SLOW_INDEX
|| i == INVISIBLE_INDEX || i == UNHOLYARMOR_INDEX || i == HP_INDEX
|| i == SHIELD_INDEX || i == POINTS_INDEX || i == MAXHARVESTERS_INDEX
@ -1585,7 +1585,7 @@ void UpdateUnitVariables(CUnit &unit)
// Resources.
if (unit.Type->GivesResource) {
unit.Variable[GIVERESOURCE_INDEX].Value = unit.ResourcesHeld;
unit.Variable[GIVERESOURCE_INDEX].Max = 0x7FFFFFFF;
unit.Variable[GIVERESOURCE_INDEX].Max = unit.ResourcesHeld > unit.Variable[GIVERESOURCE_INDEX].Max ? 0x7FFFFFFF : unit.Variable[GIVERESOURCE_INDEX].Max;
}
if (unit.Type->Harvester && unit.CurrentResource) {
unit.Variable[CARRYRESOURCE_INDEX].Value = unit.ResourcesHeld;