mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 22:41:57 +00:00
Fix incorrect display of ability to upgrade enemy units (#2308)
## Description: Fixes #2135. Adds an owner check to canUpgradeUnit to prevent enemy units from seemingly being able to be upgraded when Ctrl+clicked on ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: Lavodan
This commit is contained in:
@@ -902,6 +902,9 @@ export class PlayerImpl implements Player {
|
||||
if (this._gold < this.mg.config().unitInfo(unit.type()).cost(this)) {
|
||||
return false;
|
||||
}
|
||||
if (unit.owner() !== this) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user