[-] Fixed incorrect update for Kill and XP variables when upgrading-to

This commit is contained in:
cybermind 2014-05-26 17:29:11 +06:00
parent b21dc46d49
commit 80ad72bcd4

View file

@ -128,9 +128,13 @@ static int TransformUnitIntoType(CUnit &unit, const CUnitType &newtype)
} else {
unit.Variable[i].Value = newstats.Variables[i].Value;
}
unit.Variable[i].Max = newstats.Variables[i].Max;
unit.Variable[i].Increase = newstats.Variables[i].Increase;
unit.Variable[i].Enable = newstats.Variables[i].Enable;
if (i == KILL_INDEX || i == XP_INDEX) {
unit.Variable[i].Value = unit.Variable[i].Max;
} else {
unit.Variable[i].Max = newstats.Variables[i].Max;
unit.Variable[i].Increase = newstats.Variables[i].Increase;
unit.Variable[i].Enable = newstats.Variables[i].Enable;
}
}
unit.Type = const_cast<CUnitType *>(&newtype);