check the RestrictOwnerType building rules against the player that is building, not against ThisPlayer

This commit is contained in:
Tim Felgentreff 2015-09-06 12:33:27 +02:00
parent b8a4a7c43d
commit d9fa95118f

View file

@ -140,9 +140,9 @@ bool CBuildRestrictionDistance::Check(const CUnit *builder, const CUnitType &typ
(this->RestrictType == table[i]->Type || (!this->RestrictType && this->RestrictTypeOwner.size() > 0)) &&
// RestrictTypeOwner is not set or unit belongs to a suitable player
(this->RestrictTypeOwner.size() == 0 ||
(!this->RestrictTypeOwner.compare("self") && ThisPlayer == table[i]->Player) ||
(!this->RestrictTypeOwner.compare("allied") && (ThisPlayer == table[i]->Player || ThisPlayer->IsAllied(*table[i]->Player))) ||
(!this->RestrictTypeOwner.compare("enemy") && ThisPlayer->IsEnemy(*table[i]->Player)))) {
(!this->RestrictTypeOwner.compare("self") && builder->Player == table[i]->Player) ||
(!this->RestrictTypeOwner.compare("allied") && (builder->Player == table[i]->Player || builder->Player->IsAllied(*table[i]->Player))) ||
(!this->RestrictTypeOwner.compare("enemy") && builder->Player->IsEnemy(*table[i]->Player)))) {
switch (this->DistanceType) {
case GreaterThan :
@ -182,7 +182,7 @@ bool CBuildRestrictionHasUnit::Check(const CUnit *builder, const CUnitType &type
{
Vec2i pos1(0, 0);
Vec2i pos2(0, 0);
int count = ThisPlayer->GetUnitTotalCount(*this->RestrictType);
int count = builder->Player->GetUnitTotalCount(*this->RestrictType);
switch (this->CountType)
{
case LessThan: return count < this->Count;