supply에서 reference로 참조해야하는 것을 value로 참조한 문제 해결

This commit is contained in:
2018-04-02 02:05:50 +09:00
parent 6e876d3b9c
commit 427532f0a5
3 changed files with 16 additions and 9 deletions
-1
View File
@@ -74,7 +74,6 @@ for($i=0; $i < $gencount; $i++) {
if($general['block'] > 0) { $style .= "background-color:red;"; } if($general['block'] > 0) { $style .= "background-color:red;"; }
if($general['npc'] >= 2) { $style .= "color:cyan;"; } if($general['npc'] >= 2) { $style .= "color:cyan;"; }
elseif($general['npc'] == 1) { $style .= "color:skyblue;"; } elseif($general['npc'] == 1) { $style .= "color:skyblue;"; }
if($general['con'] > $admin['conlimit']) { $style .= "color:red;"; }
echo " echo "
<option value={$general['no']} $style>{$general['name']}</option>"; <option value={$general['no']} $style>{$general['name']}</option>";
+8 -4
View File
@@ -250,22 +250,26 @@ function checkSupply($connect) {
$queue = new \SplQueue(); $queue = new \SplQueue();
foreach(getAllNationStaticInfo() as $nation){ foreach(getAllNationStaticInfo() as $nation){
$queue->enqueue($cities[$nation['capital']]); $city = $cities[$nation['capital']];
$city['supply'] = true;
$queue->enqueue($city);
} }
while(!$queue->isEmpty()){ while(!$queue->isEmpty()){
$city = $queue->dequeue(); $city = $queue->dequeue();
$city['supply'] = true;
foreach(array_keys(CityConst::byID($city['id'])->path) as $connCityID){ foreach(array_keys(CityConst::byID($city['id'])->path) as $connCityID){
$connCity = $cities[$connCityID]; if(!key_exists($connCityID, $cities)){
continue;
}
$connCity = &$cities[$connCityID];
if($connCity['nation'] != $city['nation']){ if($connCity['nation'] != $city['nation']){
continue; continue;
} }
if($connCity['supply']){ if($connCity['supply']){
continue; continue;
} }
$connCity['supply'] = true;
$queue->enqueue($connCity); $queue->enqueue($connCity);
} }
} }
+8 -4
View File
@@ -374,7 +374,7 @@ function processRiceIncome($connect) {
// 실지급율 // 실지급율
$ratio = $realoutcome / $originoutcome; $ratio = $realoutcome / $originoutcome;
} }
$adminLog[count($adminLog)] = StringUtil::Fill2($nation['name'],12," ")." // 세곡 : ".StringUtil::Fill2($income,6," ")." // 세출 : ".StringUtil::Fill2($originoutcome,6," ")." // 실제 : ".tab2($realoutcome,6," ")." // 지급율 : ".tab2(round($ratio*100,2),5," ")." % // 결과곡 : ".tab2($nation['rice'],6," "); $adminLog[] = StringUtil::Fill2($nation['name'],12," ")." // 세곡 : ".StringUtil::Fill2($income,6," ")." // 세출 : ".StringUtil::Fill2($originoutcome,6," ")." // 실제 : ".tab2($realoutcome,6," ")." // 지급율 : ".tab2(round($ratio*100,2),5," ")." % // 결과곡 : ".tab2($nation['rice'],6," ");
$query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'"; $query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'";
$coreresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $coreresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -412,6 +412,10 @@ function processRiceIncome($connect) {
} }
function getRiceIncome($connect, $nationNo, $rate, $admin_rate, $type) { function getRiceIncome($connect, $nationNo, $rate, $admin_rate, $type) {
$level2 = [];
$level3 = [];
$level4 = [];
$query = "select no,city from general where nation='$nationNo' and level=4"; // 태수 $query = "select no,city from general where nation='$nationNo' and level=4"; // 태수
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
@@ -452,9 +456,9 @@ function getRiceIncome($connect, $nationNo, $rate, $admin_rate, $type) {
$tax1 *= (1 + $city['secu']/$city['secu2']/10); //치안에 따라 최대 10% 추가 $tax1 *= (1 + $city['secu']/$city['secu2']/10); //치안에 따라 최대 10% 추가
$tax2 *= (1 + $city['secu']/$city['secu2']/10); //치안에 따라 최대 10% 추가 $tax2 *= (1 + $city['secu']/$city['secu2']/10); //치안에 따라 최대 10% 추가
//도시 관직 추가 세수 //도시 관직 추가 세수
if($level4[$city['gen1']] == $city['city']) { $tax1 *= 1.05; $tax2 *= 1.05; } if(Util::array_get($level4[$city['gen1']]) == $city['city']) { $tax1 *= 1.05; $tax2 *= 1.05; }
if($level3[$city['gen2']] == $city['city']) { $tax1 *= 1.05; $tax2 *= 1.05; } if(Util::array_get($level3[$city['gen2']]) == $city['city']) { $tax1 *= 1.05; $tax2 *= 1.05; }
if($level2[$city['gen3']] == $city['city']) { $tax1 *= 1.05; $tax2 *= 1.05; } if(Util::array_get($level2[$city['gen3']]) == $city['city']) { $tax1 *= 1.05; $tax2 *= 1.05; }
//수도 추가 세수 130%~105% //수도 추가 세수 130%~105%
if($city['city'] == $nation['capital']) { $tax1 *= 1+(1/3/$nation['level']); $tax2 *= 1+(1/3/$nation['level']); } if($city['city'] == $nation['capital']) { $tax1 *= 1+(1/3/$nation['level']); $tax2 *= 1+(1/3/$nation['level']); }
$income[0] += $tax1; $income[0] += $tax1;