havent studied very deeply, but a small suggestion - learn to use and exploit "switch" statement
see this
int setXP(int iDN)
{
if (iDN >= 05) return 380; // 350, 340, 330, 320
if (iDN == 04) return 330; // 300, 290, 280, 270
if (iDN == 03) return 270; // 250, 240, 230, 220
if (iDN == 02) return 220; // 200, 190, 180, 170
if (iDN == 01) return 160; // 150, 140, 130, 120
if (iDN == 00) return 110; // 100, 090, 080, 070
if (iDN == -1) return 60; // 060, 050, 050, 040
if (iDN == -2) return 50; // 050, 040, 040, 030
if (iDN == -3) return 40; // 040, 040, 030
if (iDN == -4) return 20; // 020, 020, 020
return 1;
}
to
int setXP(int iDN)
{
switch(iDN)
{
case 5: return 380;
case 4: return 330;
case 3: return 270;
case 2: return 220;
case 1: return 160;
case 0: return 110;
case -1: return 60;
case -2: return 50;
case -3: return 40;
case -4: return 20;
}
return 1;
}
especially useable it is if you would need to declare a variable like this
int n = GetLocalInt(something);
if(n == 2)
if(n == 6)
vs
switch(GetLocalInt(something))
{
case 2:
case 6:
}
More here.
EDIT: not saying your way is wrong, just offering an alternative and sometimes better way to do this.
Modifié par Shadooow, 13 août 2014 - 09:32 .