diff --git a/CAdvmapInterface.cpp b/CAdvmapInterface.cpp index 561f19c50..ec48a642e 100644 --- a/CAdvmapInterface.cpp +++ b/CAdvmapInterface.cpp @@ -302,7 +302,7 @@ void CHeroList::draw() if (pom>25) pom=25; if (pom<0) pom=0; blitAtWR(mobile->ourImages[pom].bitmap,posmobx,posmoby+i*32); //move point - pom = (LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->mana)/10; + pom = (LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->mana)/5; //bylo: .../10; if (pom>25) pom=25; if (pom<0) pom=0; blitAtWR(mana->ourImages[pom].bitmap,posmanx,posmany+i*32); //mana diff --git a/CCallback.cpp b/CCallback.cpp index 5c5a680e2..b6b80176c 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -8,7 +8,38 @@ #include "mapHandler.h" #include "CGameState.h" #include "CGameInterface.h" +int CCallback::lowestSpeed(CHeroInstance * chi) +{ + int min = 150; + for ( std::map >::iterator i = chi->army.slots.begin(); + i!=chi->army.slots.end(); i++ ) + { + if (min>(*i).second.first->speed) + min = (*i).second.first->speed; + } + return min; +} +int CCallback::valMovePoints(CHeroInstance * chi) +{ + int ret = 1270+70*lowestSpeed(chi); + if (ret>2000) + ret=2000; + + //TODO: additional bonuses (but they aren't currently stored in chi) + return ret; +} +void CCallback::newTurn() +{ + //std::map::iterator i = gs->players.begin() ; + for ( std::map::iterator i=gs->players.begin() ; i!=gs->players.end();i++) + { + for (int j=0;j<(*i).second.heroes.size();j++) + { + (*i).second.heroes[j]->movement = valMovePoints((*i).second.heroes[j]); + } + } +} bool CCallback::moveHero(int ID, int3 destPoint, int idtype) { if(ID<0 || ID>CGI->heroh->heroInstances.size()) diff --git a/CCallback.h b/CCallback.h index 85da9e77a..878fedf5a 100644 --- a/CCallback.h +++ b/CCallback.h @@ -12,12 +12,14 @@ struct HeroMoveDetails class CCallback { private: - int player; void newTurn(); CCallback(CGameState * GS, int Player):gs(GS),player(Player){}; + CGameState * gs; + int lowestSpeed(CHeroInstance * chi); //speed of the slowest stack + int valMovePoints(CHeroInstance * chi); protected: - CGameState * gs; + int player; public: bool moveHero(int ID, int3 destPoint, int idtype=0);//idtype: 0-position in vector; 1-ID of hero diff --git a/CGameInterface.cpp b/CGameInterface.cpp index fc66d1a61..9a63ec116 100644 --- a/CGameInterface.cpp +++ b/CGameInterface.cpp @@ -674,7 +674,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details) LOCPLINT->adventureInt->update(); //updating screen CGI->screenh->updateScreen(); SDL_framerateDelay(mainFPSmng); //for animation purposes - } + } //for(int i=1; i<32; i+=4) //main moving done //finishing move if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl diff --git a/CMT.cpp b/CMT.cpp index 250071e3f..b5936e4f7 100644 --- a/CMT.cpp +++ b/CMT.cpp @@ -394,6 +394,7 @@ int _tmain(int argc, _TCHAR* argv[]) while(1) //main game loop, one execution per turn { + cgi->consoleh->cb->newTurn(); for (int i=0;iplayerint.size();i++) { cgi->state->currentPlayer=cgi->playerint[i]->playerID;