mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-27 21:49:10 +02:00
- Initializing movement points (t.#16)
- minor improvements
This commit is contained in:
parent
8421c901a4
commit
7b3c270dfc
@ -302,7 +302,7 @@ void CHeroList::draw()
|
|||||||
if (pom>25) pom=25;
|
if (pom>25) pom=25;
|
||||||
if (pom<0) pom=0;
|
if (pom<0) pom=0;
|
||||||
blitAtWR(mobile->ourImages[pom].bitmap,posmobx,posmoby+i*32); //move point
|
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>25) pom=25;
|
||||||
if (pom<0) pom=0;
|
if (pom<0) pom=0;
|
||||||
blitAtWR(mana->ourImages[pom].bitmap,posmanx,posmany+i*32); //mana
|
blitAtWR(mana->ourImages[pom].bitmap,posmanx,posmany+i*32); //mana
|
||||||
|
@ -8,7 +8,38 @@
|
|||||||
#include "mapHandler.h"
|
#include "mapHandler.h"
|
||||||
#include "CGameState.h"
|
#include "CGameState.h"
|
||||||
#include "CGameInterface.h"
|
#include "CGameInterface.h"
|
||||||
|
int CCallback::lowestSpeed(CHeroInstance * chi)
|
||||||
|
{
|
||||||
|
int min = 150;
|
||||||
|
for ( std::map<int,std::pair<CCreature*,int> >::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<int, PlayerState>::iterator i = gs->players.begin() ;
|
||||||
|
for ( std::map<int, PlayerState>::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)
|
bool CCallback::moveHero(int ID, int3 destPoint, int idtype)
|
||||||
{
|
{
|
||||||
if(ID<0 || ID>CGI->heroh->heroInstances.size())
|
if(ID<0 || ID>CGI->heroh->heroInstances.size())
|
||||||
|
@ -12,12 +12,14 @@ struct HeroMoveDetails
|
|||||||
class CCallback
|
class CCallback
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int player;
|
|
||||||
void newTurn();
|
void newTurn();
|
||||||
CCallback(CGameState * GS, int Player):gs(GS),player(Player){};
|
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:
|
protected:
|
||||||
CGameState * gs;
|
int player;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool moveHero(int ID, int3 destPoint, int idtype=0);//idtype: 0-position in vector; 1-ID of hero
|
bool moveHero(int ID, int3 destPoint, int idtype=0);//idtype: 0-position in vector; 1-ID of hero
|
||||||
|
@ -674,7 +674,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
|||||||
LOCPLINT->adventureInt->update(); //updating screen
|
LOCPLINT->adventureInt->update(); //updating screen
|
||||||
CGI->screenh->updateScreen();
|
CGI->screenh->updateScreen();
|
||||||
SDL_framerateDelay(mainFPSmng); //for animation purposes
|
SDL_framerateDelay(mainFPSmng); //for animation purposes
|
||||||
}
|
} //for(int i=1; i<32; i+=4)
|
||||||
//main moving done
|
//main moving done
|
||||||
//finishing move
|
//finishing move
|
||||||
if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
|
if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
|
||||||
|
1
CMT.cpp
1
CMT.cpp
@ -394,6 +394,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
|
|
||||||
while(1) //main game loop, one execution per turn
|
while(1) //main game loop, one execution per turn
|
||||||
{
|
{
|
||||||
|
cgi->consoleh->cb->newTurn();
|
||||||
for (int i=0;i<cgi->playerint.size();i++)
|
for (int i=0;i<cgi->playerint.size();i++)
|
||||||
{
|
{
|
||||||
cgi->state->currentPlayer=cgi->playerint[i]->playerID;
|
cgi->state->currentPlayer=cgi->playerint[i]->playerID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user