[-] Fixed bug when research don't modify the stats of non-ready buildings
This commit is contained in:
parent
92d8da8469
commit
aae9643d4a
3 changed files with 7 additions and 6 deletions
src
|
@ -281,7 +281,7 @@ extern CUnit *FindIdleWorker(const CPlayer &player, const CUnit *last);
|
|||
extern bool FindTerrainType(int movemask, int resmask, int range,
|
||||
const CPlayer &player, const Vec2i &startPos, Vec2i *pos);
|
||||
|
||||
extern void FindUnitsByType(const CUnitType &type, std::vector<CUnit *> &units);
|
||||
extern void FindUnitsByType(const CUnitType &type, std::vector<CUnit *> &units, bool everybody = false);
|
||||
|
||||
/// Find all units of this type of the player
|
||||
extern void FindPlayerUnitsByType(const CPlayer &player, const CUnitType &type, std::vector<CUnit *> &units);
|
||||
|
|
|
@ -509,15 +509,16 @@ CUnit *FindIdleWorker(const CPlayer &player, const CUnit *last)
|
|||
/**
|
||||
** Find all units of type.
|
||||
**
|
||||
** @param type type of unit requested
|
||||
** @param units array in which we have to store the units
|
||||
** @param type type of unit requested
|
||||
** @param units array in which we have to store the units
|
||||
** @param everybody if true, include all units
|
||||
*/
|
||||
void FindUnitsByType(const CUnitType &type, std::vector<CUnit *> &units)
|
||||
void FindUnitsByType(const CUnitType &type, std::vector<CUnit *> &units, bool everybody)
|
||||
{
|
||||
for (CUnitManager::Iterator it = UnitManager.begin(); it != UnitManager.end(); ++it) {
|
||||
CUnit &unit = **it;
|
||||
|
||||
if (unit.Type == &type && !unit.IsUnusable()) {
|
||||
if (unit.Type == &type && !unit.IsUnusable(everybody)) {
|
||||
units.push_back(&unit);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -597,7 +597,7 @@ static void ApplyUpgradeModifier(CPlayer &player, const CUpgradeModifier *um)
|
|||
if (varModified) {
|
||||
std::vector<CUnit *> unitupgrade;
|
||||
|
||||
FindUnitsByType(*UnitTypes[z], unitupgrade);
|
||||
FindUnitsByType(*UnitTypes[z], unitupgrade, true);
|
||||
for (size_t j = 0; j != unitupgrade.size(); ++j) {
|
||||
CUnit &unit = *unitupgrade[j];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue