시나리오 생성시 잘못된 도시를 입력한 경우에도 정상 빌드되도록 수정

This commit is contained in:
2018-06-18 02:23:30 +09:00
parent e2a1203b43
commit acb09bfe71
3 changed files with 11 additions and 6 deletions
+5 -1
View File
@@ -76,7 +76,11 @@ class CityHelper{
self::generateCache();
}
return self::$listInv[$cityName];
$city = self::$listInv[$cityName]??null;
if($city === null){
trigger_error("$cityName 에 해당하는 도시가 없습니다.");
}
return $city;
}
+4 -3
View File
@@ -177,6 +177,9 @@ class NPC{
}
$city = $this->locatedCity;
if($city !== null){
$city = CityHelper::getCityByName($city)['id']??null;
}
if($city === null){
if($nationID == 0 || !CityHelper::getAllNationCities($nationID)){
$cityObj = Util::choiceRandom(CityHelper::getAllCities());
@@ -187,9 +190,7 @@ class NPC{
'@phan-var array<string,string|int> $cityObj';
$city = $cityObj['id'];
}
else{
$city = CityHelper::getCityByName($city)['id'];
}
$experience = $age * 100;
$dedication = $age * 100;