From fbc543cf3f44f8d643a58bc1c23a07428771efbd Mon Sep 17 00:00:00 2001 From: Magnus Grimstvedt Saltnes Date: Wed, 24 Jun 2020 16:28:01 +0200 Subject: [PATCH] Corrects some code style issues. --- src/js/game/hud/parts/building_placer_logic.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/js/game/hud/parts/building_placer_logic.js b/src/js/game/hud/parts/building_placer_logic.js index 106e642c..9bf031c0 100644 --- a/src/js/game/hud/parts/building_placer_logic.js +++ b/src/js/game/hud/parts/building_placer_logic.js @@ -128,9 +128,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { if (!this.root.app.settings.getAllSettings().rotationByBuilding) { return this.currentBaseRotationGeneral; } - const building = this.currentMetaBuilding.get(); - if (building != undefined && this.preferredBaseRotations.hasOwnProperty(building.getId())) { - return this.preferredBaseRotations[building.getId()]; + const metaBuilding = this.currentMetaBuilding.get(); + if (metaBuilding && this.preferredBaseRotations.hasOwnProperty(metaBuilding.getId())) { + return this.preferredBaseRotations[metaBuilding.getId()]; } else { return this.currentBaseRotationGeneral; } @@ -138,14 +138,15 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { /** * Sets the base rotation for the current meta-building. + * @param {number} rotation The new rotation/angle. */ set currentBaseRotation(rotation) { if (!this.root.app.settings.getAllSettings().rotationByBuilding) { this.currentBaseRotationGeneral = rotation; } else { - const building = this.currentMetaBuilding.get(); - if (building != undefined) { - this.preferredBaseRotations[building.getId()] = rotation; + const metaBuilding = this.currentMetaBuilding.get(); + if (metaBuilding) { + this.preferredBaseRotations[metaBuilding.getId()] = rotation; } else { this.currentBaseRotationGeneral = rotation; }