QTfrontend/selectWeapon.cpp
changeset 2471 1cfc9f897616
parent 2467 be6690c337fb
child 2860 13a53315ae18
equal deleted inserted replaced
2470:44b66fbf37da 2471:1cfc9f897616
    32 #include <math.h>
    32 #include <math.h>
    33 
    33 
    34 QImage getAmmoImage(int num)
    34 QImage getAmmoImage(int num)
    35 {
    35 {
    36 	static QImage ammo(":Ammos.png");
    36 	static QImage ammo(":Ammos.png");
    37     int x = floor((num * 32) / ammo.height()) * 32;
    37     int x = floor(num/(ammo.height()/32));
    38     if(x) x--;
    38     int y = (num-((ammo.height()/32)*x))*32;
    39 	return ammo.copy(x, num*32, 32, 32);
    39     x*=32;
       
    40 	return ammo.copy(x, y, 32, 32);
    40 }
    41 }
    41 
    42 
    42 SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QWidget* parent) :
    43 SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QWidget* parent) :
    43 	QWidget(parent)
    44 	QWidget(parent)
    44 {
    45 {