refac: RSC

This commit is contained in:
2024-03-09 05:26:13 +00:00
parent c9afc111cc
commit 3ba5793755
4 changed files with 28 additions and 30 deletions
+6 -6
View File
@@ -23,11 +23,11 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
){
super();
this._raw = raw;
this._city = new WeakRef(must(resourceController.getCity(raw.cityID)));
this._nation = new WeakRef(must(resourceController.getNation(raw.nationID)));
this._city = new WeakRef(must(resourceController.city(raw.cityID)));
this._nation = new WeakRef(must(resourceController.nation(raw.nationID)));
if(raw.troopID){
this._troop = new WeakRef(must(resourceController.getTroop(raw.troopID, raw.nationID)));
this._troop = new WeakRef(must(resourceController.troop(raw.troopID, raw.nationID)));
}
}
@@ -56,7 +56,7 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
if(city instanceof City){
return city;
}
const cityObj = this.resourceController.getCity(city);
const cityObj = this.resourceController.city(city);
if(!cityObj){
throw new InvalidArgument(`City not found: ${city}`);
}
@@ -96,7 +96,7 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
if(troop instanceof Troop){
return troop;
}
const troopObj = this.resourceController.getTroop(troop, this._raw.nationID);
const troopObj = this.resourceController.troop(troop, this._raw.nationID);
if(!troopObj){
throw new InvalidArgument(`Troop not found: ${troop}`);
}
@@ -115,7 +115,7 @@ export class General extends LazyEntityUpdater<IGeneralEntity> {
if(nation instanceof Nation){
return nation;
}
const nationObj = this.resourceController.getNation(nation);
const nationObj = this.resourceController.nation(nation);
if(!nationObj){
throw new InvalidArgument(`Nation not found: ${nation}`);
}