From 77fadf561d12976f9256ecaaf82b6e18e19ad2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= <mwu-tow@gazeta.pl> Date: Fri, 15 Feb 2008 18:40:58 +0000 Subject: [PATCH] * added visitDir bitfield in CGDefInfo specifying from which directions object can be visited * fixed crashbug in heroList (showing after dismissing hero) --- CPlayerInterface.cpp | 11 ++++++++++- hch/CDefObjInfoHandler.cpp | 4 ++++ hch/CDefObjInfoHandler.h | 2 ++ hch/CObjectHandler.h | 5 +++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 83ac83975..10b1340c7 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -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 { diff --git a/hch/CDefObjInfoHandler.cpp b/hch/CDefObjInfoHandler.cpp index af29bafa0..acd9ec269 100644 --- a/hch/CDefObjInfoHandler.cpp +++ b/hch/CDefObjInfoHandler.cpp @@ -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; diff --git a/hch/CDefObjInfoHandler.h b/hch/CDefObjInfoHandler.h index fef592b6e..55fdfd77c 100644 --- a/hch/CDefObjInfoHandler.h +++ b/hch/CDefObjInfoHandler.h @@ -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 { diff --git a/hch/CObjectHandler.h b/hch/CObjectHandler.h index f883a5b6a..b17ceb332 100644 --- a/hch/CObjectHandler.h +++ b/hch/CObjectHandler.h @@ -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;