1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

1.Pandora and Event now give experience correctly

2.Better, but not complete handling for big exp values
This commit is contained in:
DjWarmonger 2009-08-17 10:02:29 +00:00
parent 495f7d0b06
commit fbc117b034
7 changed files with 12 additions and 8 deletions

View File

@ -88,7 +88,7 @@ public:
void setBlockVis(int objid, bool bv){};
void setOwner(int objid, ui8 owner){};
void setHoverName(int objid, MetaString * name){};
void setObjProperty(int objid, int prop, int val){};
void setObjProperty(int objid, int prop, si64 val){};
void changePrimSkill(int ID, int which, si64 val, bool abs=false){};
void changeSecSkill(int ID, int which, int val, bool abs=false){};
void showInfoDialog(InfoWindow *iw){};

View File

@ -383,13 +383,17 @@ unsigned int CHeroHandler::level (ui64 experience)
int i;
if (experience <= expPerLevel.back())
{
for(i = expPerLevel.size()-1; experience < expPerLevel[i]; i--);
//i = expPerLevel.size() - 1;
//while (experience <= reqExp (i))
// i--;
for (i = expPerLevel.size()-1; experience < expPerLevel[i]; i--);
return i + 1;
}
else
{
//for(i = expPerLevel.size(); experience > reqExp(i); i++);
i = expPerLevel.size();
i = expPerLevel.size() - 1;
while (experience > reqExp (i))
i++;
return i;

View File

@ -93,7 +93,7 @@ class DLL_EXPORT CHeroHandler
public:
std::vector<CHero*> heroes; //changed from nodrze
std::vector<CHeroClass *> heroClasses;
std::vector<int> expPerLevel; //expPerLEvel[i] is amount of exp needed to reach level i; if it is not in this vector, multiplicate last value by 1,2 to get next value
std::vector<ui64> expPerLevel; //expPerLEvel[i] is amount of exp needed to reach level i; if it is not in this vector, multiplicate last value by 1,2 to get next value
struct SBallisticsLevelInfo
{

View File

@ -2882,7 +2882,7 @@ void CGPandoraBox::giveContents( const CGHeroInstance *h, bool afterBattle ) con
//give exp
if(gainedExp)
cb->changePrimSkill(h->id,5,gainedExp,false);
cb->changePrimSkill(h->id,4,gainedExp,false);
//give prim skills
for(int i=0; i<primskills.size(); i++)
if(primskills[i])

View File

@ -64,7 +64,7 @@ public:
virtual void setBlockVis(int objid, bool bv)=0;
virtual void setOwner(int objid, ui8 owner)=0;
virtual void setHoverName(int objid, MetaString * name)=0;
virtual void setObjProperty(int objid, int prop, int val)=0;
virtual void setObjProperty(int objid, int prop, si64 val)=0;
virtual void changePrimSkill(int ID, int which, si64 val, bool abs=false)=0;
virtual void changeSecSkill(int ID, int which, int val, bool abs=false)=0;
virtual void showInfoDialog(InfoWindow *iw)=0;

View File

@ -1575,7 +1575,7 @@ int CGameHandler::getSelectedHero()
return IGameCallback::getSelectedHero(getCurrentPlayer())->id;
}
void CGameHandler::setObjProperty( int objid, int prop, int val )
void CGameHandler::setObjProperty( int objid, int prop, si64 val )
{
SetObjectProperty sob;
sob.id = objid;

View File

@ -107,7 +107,7 @@ public:
void setBlockVis(int objid, bool bv);
void setOwner(int objid, ui8 owner);
void setHoverName(int objid, MetaString * name);
void setObjProperty(int objid, int prop, int val);
void setObjProperty(int objid, int prop, si64 val);
void changePrimSkill(int ID, int which, si64 val, bool abs=false);
void changeSecSkill(int ID, int which, int val, bool abs=false);
void showInfoDialog(InfoWindow *iw);