From 0c2cf02ca646467a6baa24f395a23ae6b4649761 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Sat, 23 Feb 2008 19:20:41 +0000 Subject: [PATCH] =?UTF-8?q?*=20given=20hero=20is=20placed=20in=20the=20tow?= =?UTF-8?q?n=20entrance=20Wsp=C3=B3lne=20zmiany=20*=20some=20objects=20suc?= =?UTF-8?q?h=20as=20river=20delta=20won't=20be=20blitted=20"on"=20hero=20*?= =?UTF-8?q?=20tiles=20under=20FoW=20are=20inaccessible=20*=20giving=20rand?= =?UTF-8?q?om=20hero=20on=20RoE=20maps=20*=20improved=20protection=20again?= =?UTF-8?q?st=20hero=20duplication=20*=20fixed=20starting=20values=20of=20?= =?UTF-8?q?primary=20abilities=20of=20random=20heroes=20on=20RoE/AB=20maps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CCallback.cpp | 3 ++- CGameState.h | 1 + CMT.cpp | 2 +- CPathfinder.cpp | 3 +++ CPlayerInterface.cpp | 54 +++++++++++++++++++++--------------------- hch/CAmbarCendamo.cpp | 10 ++++++-- hch/CObjectHandler.cpp | 4 ++++ map.h | 2 +- mapHandler.cpp | 12 ++++++---- 9 files changed, 54 insertions(+), 37 deletions(-) diff --git a/CCallback.cpp b/CCallback.cpp index 898cf347b..fd9a1fa6d 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -618,8 +618,9 @@ void CScriptCallback::stopHeroVisitCastle(CGObjectInstance * ob, int heroID) CGTownInstance * n; if(n = dynamic_cast(ob)) { - if(n->visitingHero->type->ID == heroID) + if(n->visitingHero && n->visitingHero->type->ID == heroID) n->visitingHero = NULL; + return; } else return; diff --git a/CGameState.h b/CGameState.h index 7010b855e..6ee8675e7 100644 --- a/CGameState.h +++ b/CGameState.h @@ -55,6 +55,7 @@ private: } public: friend CCallback; + friend CPathfinder;; friend CLuaCallback; friend int _tmain(int argc, _TCHAR* argv[]); friend void initGameState(CGameInfo * cgi); diff --git a/CMT.cpp b/CMT.cpp index 0d09bf26c..eeb94d3e2 100644 --- a/CMT.cpp +++ b/CMT.cpp @@ -62,7 +62,7 @@ CGameInfo* CGI; #endif #define CHUNK 16384 -const char * NAME = "VCMI 0.53c \"Tirion\" Techdemo"; +const char * NAME = "VCMI 0.54 \"Tirion\" Techdemo"; SDL_Color playerColorPalette[256]; //palette to make interface colors good diff --git a/CPathfinder.cpp b/CPathfinder.cpp index ad260c14a..b2d1a157f 100644 --- a/CPathfinder.cpp +++ b/CPathfinder.cpp @@ -4,6 +4,7 @@ #include "CGameInfo.h" #include "hch\CAmbarCendamo.h" #include "mapHandler.h" +#include "CGameState.h" using namespace boost::logic; int3 CPath::startPos() { @@ -64,6 +65,8 @@ CPath * CPathfinder::getPath(int3 src, int3 dest, const CGHeroInstance * hero, u graph[i][j].accesible = false; else if ((!blockLandSea) && (CGI->mh->ttiles[i][j][src.z].terType!=EterrainType::water)) graph[i][j].accesible = false; + if(graph[i][j].accesible) + graph[i][j].accesible = CGI->state->players[hero->tempOwner].fogOfWarMap[i][j][src.z]; } } diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 4cb91c3a8..9e6ced4bd 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -843,33 +843,33 @@ void CPlayerInterface::yourTurn() for(;makingTurn;) // main loop { //updating water tiles - int wnumber = -1; - for(int s=0; smh->reader->defs.size(); ++s) - { - if(CGI->mh->reader->defs[s]->defName==std::string("WATRTL.DEF")) - { - wnumber = s; - break; - } - } - if(wnumber>=0) - { - for(int g=0; gmh->reader->defs[wnumber]->ourImages.size(); ++g) - { - SDL_Color tab[32]; - for(int i=0; i<32; ++i) - { - tab[i] = CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap->format->palette->colors[224 + (i+1)%32]; - } - //SDL_SaveBMP(CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap,"t1.bmp"); - for(int i=0; i<32; ++i) - { - CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap->format->palette->colors[224 + i] = tab[i]; - } - //SDL_SaveBMP(CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap,"t2.bmp"); - CSDL_Ext::update(CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap); - } - } + //int wnumber = -1; + //for(int s=0; smh->reader->defs.size(); ++s) + //{ + // if(CGI->mh->reader->defs[s]->defName==std::string("WATRTL.DEF")) + // { + // wnumber = s; + // break; + // } + //} + //if(wnumber>=0) + //{ + // for(int g=0; gmh->reader->defs[wnumber]->ourImages.size(); ++g) + // { + // SDL_Color tab[32]; + // for(int i=0; i<32; ++i) + // { + // tab[i] = CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap->format->palette->colors[160 + (i+1)%32]; + // } + // //SDL_SaveBMP(CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap,"t1.bmp"); + // for(int i=0; i<32; ++i) + // { + // CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap->format->palette->colors[160 + i] = tab[i]; + // } + // //SDL_SaveBMP(CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap,"t2.bmp"); + // CSDL_Ext::update(CGI->mh->reader->defs[wnumber]->ourImages[g].bitmap); + // } + //} //water tiles updated CGI->screenh->updateScreen(); int tv = th.getDif(); diff --git a/hch/CAmbarCendamo.cpp b/hch/CAmbarCendamo.cpp index 927393491..5f2b74f27 100644 --- a/hch/CAmbarCendamo.cpp +++ b/hch/CAmbarCendamo.cpp @@ -194,7 +194,7 @@ void CAmbarCendamo::deh3m() map.players[pom].AITactic = bufor[i++]; if(map.version == Eformat::SoD || map.version == Eformat::WoG) - i++; + map.players[pom].p7= bufor[i++]; map.players[pom].allowedFactions = 0; map.players[pom].allowedFactions += bufor[i++]; @@ -1012,7 +1012,13 @@ void CAmbarCendamo::deh3m() spec->power = -1; spec->knowledge = -1; } - + } + else + { + spec->attack = -1; + spec->defence = -1; + spec->power = -1; + spec->knowledge = -1; } i+=16; nobj->info = spec; diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index 9c92892d4..2b3d380e8 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -127,6 +127,10 @@ bool CGObjectInstance::operator<(const CGObjectInstance & cmp) const //screen p return true; if(this->pos.y>cmp.pos.y) return false; + if(cmp.ID==34 && ID!=34) + return true; + if(cmp.ID!=34 && ID==34) + return false; if(!defInfo->isVisitable() && cmp.defInfo->isVisitable()) return true; if(!cmp.defInfo->isVisitable() && defInfo->isVisitable()) diff --git a/map.h b/map.h index 9fde9c8b4..37795b833 100644 --- a/map.h +++ b/map.h @@ -70,7 +70,7 @@ struct SheroName //name of starting hero }; struct PlayerInfo { - int p8, p9; + int p7, p8, p9; bool canHumanPlay; bool canComputerPlay; unsigned int AITactic; //(00 - random, 01 - warrior, 02 - builder, 03 - explorer) diff --git a/mapHandler.cpp b/mapHandler.cpp index c05803376..7a38f8f17 100644 --- a/mapHandler.cpp +++ b/mapHandler.cpp @@ -786,21 +786,21 @@ void CMapHandler::init() borderAndTerrainBitmapInit(); std::cout<<"\tPreparing FoW, roads, rivers,borders: "<map.players[i].generateHeroAtMainTown && reader->map.players[i].hasMainTown) + if((reader->map.players[i].generateHeroAtMainTown && reader->map.players[i].hasMainTown) || (reader->map.players[i].hasMainTown && reader->map.version==RoE)) { int3 hpos = reader->map.players[i].posOfMainTown; - hpos.x+=1; hpos.y+=1; + hpos.x+=1;// hpos.y+=1; int j; for(j=0;jscenarioOps.playerInfos.size();j++) if(CGI->scenarioOps.playerInfos[j].color==i) break; if(j==CGI->scenarioOps.playerInfos.size()) continue; - int h = CGI->scenarioOps.playerInfos[j].hero; - if(h<0) + int h; //= CGI->scenarioOps.playerInfos[j].hero; + //if(h<0) h=pickHero(i); CGHeroInstance * nnn = (CGHeroInstance*)createObject(34,h,hpos,i); nnn->defInfo->handler = CGI->heroh->flags1[0]; @@ -808,6 +808,7 @@ void CMapHandler::init() CGI->objh->objInstances.push_back(nnn); } } + std::cout<<"\tGiving starting heroes: "<defInfo = new CGDefInfo(); nobj->defInfo->id = 34; nobj->defInfo->subid = subid; + nobj->defInfo->printPriority = 0; nobj->type = CGI->heroh->heroes[subid]; for(int i=0;i<6;i++) {