1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

* added visitDir bitfield in CGDefInfo specifying from which directions object can be visited

* fixed crashbug in heroList (showing after dismissing hero)
This commit is contained in:
Michał W. Urbańczyk 2008-02-15 18:40:58 +00:00
parent d5a4dcc6cd
commit 77fadf561d
4 changed files with 19 additions and 3 deletions

View File

@ -1380,7 +1380,7 @@ SDL_Surface * CPlayerInterface::drawPrimarySkill(const CGHeroInstance *curh, SDL
SDL_Surface * CPlayerInterface::drawHeroInfoWin(const CGHeroInstance * curh)
{
char * buf = new char[10];
SDL_Surface * ret = copySurface(hInfo);
SDL_Surface * ret = SDL_DisplayFormat(hInfo);
SDL_SetColorKey(ret,SDL_SRCCOLORKEY,SDL_MapRGB(ret->format,0,255,255));
blueToPlayersAdv(ret,playerID,1);
printAt(curh->name,75,15,GEOR13,zwykly,ret);
@ -1875,6 +1875,13 @@ void CHeroList::genList()
}
void CHeroList::select(int which)
{
if (which<0)
{
selected = which;
LOCPLINT->adventureInt->selection.selected = LOCPLINT->adventureInt->terrain.currentPath = NULL;
draw();
LOCPLINT->adventureInt->infoBar.draw(NULL);
}
if (which>=items.size())
return;
selected = which;
@ -2012,6 +2019,8 @@ void CHeroList::updateHList()
{
items.clear();
genList();
if(selected>=items.size())
select(items.size()-1);
}
void CHeroList::updateMove(const CGHeroInstance* which) //draws move points bar
{

View File

@ -13,6 +13,10 @@ bool CGDefInfo::isVisitable()
}
return false;
}
CGDefInfo::CGDefInfo()
{
visitDir = (8|16|32|64|128); //4,5,6,7,8 - any not-from-up direction
}
bool DefObjInfo::operator==(const std::string & por) const
{
return this->defName == por;

View File

@ -10,6 +10,7 @@ public:
unsigned char visitMap[6];
unsigned char blockMap[6];
unsigned char visitDir; //directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
int id, subid; //of object described by this defInfo
int terrainAllowed, //on which terrain it is possible to place object
terrainMenu; //in which menus in map editor object will be showed
@ -24,6 +25,7 @@ public:
else
return subid<por.subid;
}
CGDefInfo();
};
struct DefObjInfo
{

View File

@ -329,8 +329,9 @@ public:
class CGHeroInstance : public CGObjectInstance
{
public:
int moveDir;
int moveDir; //format: 123
// 8 4
// 765
bool isStanding;
bool flagPrinted;
CHero * type;