1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +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) SDL_Surface * CPlayerInterface::drawHeroInfoWin(const CGHeroInstance * curh)
{ {
char * buf = new char[10]; 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)); SDL_SetColorKey(ret,SDL_SRCCOLORKEY,SDL_MapRGB(ret->format,0,255,255));
blueToPlayersAdv(ret,playerID,1); blueToPlayersAdv(ret,playerID,1);
printAt(curh->name,75,15,GEOR13,zwykly,ret); printAt(curh->name,75,15,GEOR13,zwykly,ret);
@ -1875,6 +1875,13 @@ void CHeroList::genList()
} }
void CHeroList::select(int which) 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()) if (which>=items.size())
return; return;
selected = which; selected = which;
@ -2012,6 +2019,8 @@ void CHeroList::updateHList()
{ {
items.clear(); items.clear();
genList(); genList();
if(selected>=items.size())
select(items.size()-1);
} }
void CHeroList::updateMove(const CGHeroInstance* which) //draws move points bar void CHeroList::updateMove(const CGHeroInstance* which) //draws move points bar
{ {

View File

@ -13,6 +13,10 @@ bool CGDefInfo::isVisitable()
} }
return false; 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 bool DefObjInfo::operator==(const std::string & por) const
{ {
return this->defName == por; return this->defName == por;

View File

@ -10,6 +10,7 @@ public:
unsigned char visitMap[6]; unsigned char visitMap[6];
unsigned char blockMap[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 id, subid; //of object described by this defInfo
int terrainAllowed, //on which terrain it is possible to place object int terrainAllowed, //on which terrain it is possible to place object
terrainMenu; //in which menus in map editor object will be showed terrainMenu; //in which menus in map editor object will be showed
@ -24,6 +25,7 @@ public:
else else
return subid<por.subid; return subid<por.subid;
} }
CGDefInfo();
}; };
struct DefObjInfo struct DefObjInfo
{ {

View File

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