- // as they look much better
- weapon_size.x = min(old_panel_size.x / columns, aspect * weapon_size.y);
- weapon_size.y = min(old_panel_size.y / rows, weapon_size.x / aspect);
+ if(rows > columns)
+ {
+ columns = ceil(weapon_count / rows);
+ rows = ceil(weapon_count / columns);
+ weapon_size.y = min(old_panel_size.y / rows, weapon_size.x / aspect);
+ weapon_size.x = min(old_panel_size.x / columns, aspect * weapon_size.y);
+ }
+ else
+ {
+ rows = ceil(weapon_count / columns);
+ columns = ceil(weapon_count / rows);
+ weapon_size.x = min(old_panel_size.x / columns, aspect * weapon_size.y);
+ weapon_size.y = min(old_panel_size.y / rows, weapon_size.x / aspect);
+ }