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:
parent
495f7d0b06
commit
fbc117b034
@ -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){};
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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])
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user