diff --git a/index.php b/index.php index e5b76f3..0f77198 100644 --- a/index.php +++ b/index.php @@ -3,14 +3,18 @@ function update($data){ //echo count($data); for($i = 0;$i < count($data['buildings']);$i++){ //echo $i . "
"; - $data['buildings'][$i]['isUnderConstruction'] = false; + + $data['buildings'][$i]['isUnderConstruction'] = 0; $data['buildings'][$i]['constructionCounter'] = 0; $data['buildings'][$i]['constructionPercentage'] = 0; $data['buildings'][$i]['constructionProgress'] = null; $data['buildings'][$i]['constructionTotal'] = 0; $data['buildings'][$i]['constructionCounter'] = 0; + if($data['buildings'][$i]['acceptsWorkers'] > 0){ + $data['buildings'][$i]['jobsAvailable'] = $data['buildings'][$i]['acceptsWorkers']; + } + } - return $data; } @@ -19,6 +23,7 @@ function update($data){ $mcz = json_decode(base64_decode(file_get_contents($_FILES['mcz']['tmp_name'])),1); //echo json_encode($mcz['buildings'][259]); //echo json_encode(update($mcz['buildings'][261])) . "


"; + //echo json_encode($mcz); //echo json_encode(update($mcz)); echo base64_encode(json_encode(update($mcz))); }else{