정적 분석기 결과 반영. 주로 배열 초기화. 변수 이름 실수 수정.

This commit is contained in:
2018-04-06 20:06:28 +09:00
parent 2bce82c73e
commit ffc0fc0c6f
20 changed files with 109 additions and 94 deletions
+5 -2
View File
@@ -97,6 +97,7 @@ class NPC{
$name = 'ⓝ'.$this->name;
$pictureID = $this->pictureID;
if($env['show_img_level'] == 3 && $pictureID > 0){
$picture = "{$pictureID}.jpg";
}
@@ -107,11 +108,13 @@ class NPC{
$city = $this->locatedCity;
if($city === null){
if($nationID == 0){
$city = Util::choiceRandom(CityHelper::getAllCities())['id'];
$cityObj = Util::choiceRandom(CityHelper::getAllCities());
}
else{
$city = Util::choiceRandom(CityHelper::getAllNationCities($nationID))['id'];
$cityObj = Util::choiceRandom(CityHelper::getAllNationCities($nationID));
}
'@phan-var array<string,string|int> $cityObj';
$city = $cityObj['id'];
}
$experience = $age * 100;
+5 -4
View File
@@ -1,7 +1,6 @@
<?php
namespace sammo\Scenario;
use \sammo\DB;
use \sammo\Util;
class Nation{
private $id;
@@ -14,7 +13,7 @@ class Nation{
private $type;
private $nationLevel;
private $capital;
private $capital = null;
private $cities = [];
@@ -42,8 +41,10 @@ class Nation{
$this->type = $type;
$this->nationLevel = $nationLevel;
$this->cities = $cities;
$this->capital = count($cities)>0?$cities[0]:null;
if(count($cities)){
$this->capital = $this->cities[0];
}
}
public function setID(int $id){