internal void CancelConstruction() { if (this.IsConstructing) { bool wasUpgrading = IsUpgrading(); this.IsConstructing = false; if (wasUpgrading) { SetUpgradeLevel(UpgradeLevel); } Construction_Item bd = GetConstructionItemData(); Files.CSV_Logic.Resource rd = bd.GetBuildResource(UpgradeLevel + 1); int cost = bd.GetBuildCost(UpgradeLevel + 1); int multiplier = (CSV.Tables.Get(Gamefile.Globals).GetData("BUILD_CANCEL_MULTIPLIER") as Globals).NumberValue; int resourceCount = (int)((cost * multiplier * (long)1374389535) >> 32); resourceCount = Math.Max((resourceCount >> 5) + (resourceCount >> 31), 0); this.Level.Avatar.Resources.Plus(rd.GetGlobalID(), resourceCount); if (Builder_Village) { this.Level.BuilderVillageWorkerManager.DeallocateWorker(this); } else { this.Level.VillageWorkerManager.DeallocateWorker(this); } if (UpgradeLevel == -1) { this.Level.GameObjectManager.RemoveGameObject(this); } } }
internal void CancelConstruction() { if (this.IsConstructing) { bool wasUpgrading = IsUpgrading(); this.IsConstructing = false; if (wasUpgrading) { SetUpgradeLevel(UpgradeLevel); } Construction_Item bd = GetConstructionItemData(); Resource rd = bd.GetBuildResource(UpgradeLevel + 1); int cost = bd.GetBuildCost(UpgradeLevel + 1); int multiplier = (CSV.Tables.Get(Gamefile.Globals).GetData("BUILD_CANCEL_MULTIPLIER") as Globals).NumberValue; int resourceCount = (int)((cost * multiplier * (long)1374389535) >> 32); resourceCount = Math.Max((resourceCount >> 5) + (resourceCount >> 31), 0); //this.Level.CommodityCountChangeHelper(0, rd, resourceCount); //this.Level.WorkerManager.DeallocateWorker(this); if (UpgradeLevel == -1) { this.Level.GameObjectManager.RemoveGameObject(this); } } }