Skip to content

Commit

Permalink
ach upd.
Browse files Browse the repository at this point in the history
Исправлена ошибка распределения медалей на подкатегории для вкладки
"Награды", в случае если в клане не было медалей Инженер-механик или
Эксперт.
  • Loading branch information
Exinaus committed Sep 25, 2014
1 parent 85f024e commit 8d1b285
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions function/func_main.php
Expand Up @@ -644,6 +644,7 @@ function update_achievements_db($ach = array()) {
function achievements_split($res,$ach) {
$ret = array('sections' => array(), 'split' => array());
$counter = array('id' => array(), 'split' => array());
$num = $n = $m = 0;

//list of ach. in clan
//except 'class' section
Expand All @@ -665,10 +666,18 @@ function achievements_split($res,$ach) {
if(in_array($val['name'],$counter['id'])) {
$counter['split'][$val['section']][] = $val['name'];
}
//counters
if($val['section'] == 'expert') {
++$n;
}
if($val['section'] == 'mechanic') {
++$m;
}
}
//how many ach. in one section
$num = count($counter['split']['expert']);
if(count($counter['split']['mechanic']) > $num) { $num = count($counter['split']['mechanic']); }
$num = $n;
if($m > $num) { $num = $m; }
if($num == 0) { $num = 8; }

//chunk ach. to sections
foreach($counter['count'] as $id => $n) {
Expand Down

0 comments on commit 8d1b285

Please sign in to comment.