diff --git a/CBattleInterface.cpp b/CBattleInterface.cpp index ed28b7372..7932157d6 100644 --- a/CBattleInterface.cpp +++ b/CBattleInterface.cpp @@ -185,6 +185,17 @@ void CBattleInterface::bSurrenderf() void CBattleInterface::bFleef() { + for(int i=0; iobjsToBlit.size(); ++i) + { + if( dynamic_cast( LOCPLINT->objsToBlit[i] ) ) + { + LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+i); + } + } + deactivate(); + + LOCPLINT->adventureInt->activate(); + delete this; } void CBattleInterface::bAutofightf() diff --git a/CCallback.cpp b/CCallback.cpp index 644dab3f2..6c0d1cd01 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -435,9 +435,27 @@ int CCallback::swapCreatures(const CGObjectInstance *s1, const CGObjectInstance if(!S2->slots[p2].first) S2->slots.erase(p2); if(s1->tempOwnerplayerint[s1->tempOwner]->garrisonChanged(s1); + { + for(int b=0; bplayerint.size(); ++b) + { + if(CGI->playerint[b]->playerID == s1->tempOwner) + { + CGI->playerint[b]->garrisonChanged(s1); + break; + } + } + } if((s2->tempOwnerplayerint[s2->tempOwner]->garrisonChanged(s2); + { + for(int b=0; bplayerint.size(); ++b) + { + if(CGI->playerint[b]->playerID == s2->tempOwner) + { + CGI->playerint[b]->garrisonChanged(s2); + break; + } + } + } return 0; } } @@ -607,7 +625,14 @@ void CScriptCallback::heroVisitCastle(CGObjectInstance * ob, int heroID) if(n = dynamic_cast(ob)) { n->visitingHero = CGI->state->getHero(heroID,0); - CGI->playerint[getHeroOwner(heroID)]->heroVisitsTown(CGI->state->getHero(heroID,0),n); + for(int b=0; bplayerint.size(); ++b) + { + if(CGI->playerint[b]->playerID == getHeroOwner(heroID)) + { + CGI->playerint[b]->heroVisitsTown(CGI->state->getHero(heroID,0),n); + break; + } + } } else return; diff --git a/CGameState.cpp b/CGameState.cpp index 431a8d047..22265d62c 100644 --- a/CGameState.cpp +++ b/CGameState.cpp @@ -86,13 +86,23 @@ void CGameState::battle(CCreatureSet * army1, CCreatureSet * army2, int3 tile, C curB->activeStack = i; if(stacks[i]->alive) //niech interfejs ruszy oddzialem { - if(CGI->playerint[(stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner)]->human) + unsigned char owner = (stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner); + unsigned char serialOwner = -1; + for(int g=0; gplayerint.size(); ++g) { - ((CPlayerInterface*)CGI->playerint[(stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner)])->activeStack(stacks[i]->ID); + if(CGI->playerint[g]->playerID == owner) + { + serialOwner = g; + break; + } + } + if(CGI->playerint[serialOwner]->human) + { + ((CPlayerInterface*)CGI->playerint[serialOwner])->activeStack(stacks[i]->ID); } else { - //CGI->playerint[(stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner)]->activeStack(stacks[i]->ID); + //CGI->playerint[serialOwner]->activeStack(stacks[i]->ID); } } //sprawdzic czy po tej akcji ktoras strona nie wygrala bitwy diff --git a/hch/CAmbarCendamo.h b/hch/CAmbarCendamo.h index 1e41a6705..2aab7a02f 100644 --- a/hch/CAmbarCendamo.h +++ b/hch/CAmbarCendamo.h @@ -16,13 +16,13 @@ enum EDefType {TOWN_DEF, HERO_DEF, CREATURES_DEF, SEERHUT_DEF, RESOURCE_DEF, TER class CAmbarCendamo { public: -/////////////////zmienne skladowe +/////////////////member variables Mapa map; std::ifstream * is; // stream used to read map file int andame; // length of map file unsigned char * bufor; // here we store map bytecode std::vector defs; -/////////////////funkcje skladowe +/////////////////member functions CAmbarCendamo (const char * tie); // c-tor; tie is the path of the map file CAmbarCendamo (unsigned char * map); // c-tor; map is pointer to array containing map; it is not copied, so don't delete ~CAmbarCendamo (); // d-tor diff --git a/hch/CCreatureHandler.cpp b/hch/CCreatureHandler.cpp index df2adb61b..95eeaf65b 100644 --- a/hch/CCreatureHandler.cpp +++ b/hch/CCreatureHandler.cpp @@ -777,9 +777,7 @@ int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y) i, add, FullHeight,FullWidth, TotalRowLength, // dlugosc przeczytanego segmentu NextSpriteOffset, RowAdd; - std::ifstream Fdef; unsigned char SegmentType, SegmentLength, BL, BR; - unsigned char * TempDef; //memory std::string FTemp; @@ -794,21 +792,8 @@ int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y) TopMargin = readNormalNr(i,4,FDef);i+=4; RightMargin = FullWidth - SpriteWidth - LeftMargin; BottomMargin = FullHeight - SpriteHeight - TopMargin; - - BMPHeader tb; - tb.x = FullWidth; - tb.y = FullHeight; - tb.dataSize2 = tb.dataSize1 = tb.x*tb.y; - tb.fullSize = tb.dataSize1+436; - tb._h3=tb.fullSize-36; - //add = (int)(4*(((float)1) - ((int)(((int)((float)FullWidth/(float)4))-((float)FullWidth/(float)4))))); add = 4 - FullWidth%4; - /*if (add==4) - add=0;*/ //moved to defcompression dependent block - - //ret = SDL_CreateRGBSurface(SDL_SWSURFACE, FullWidth, FullHeight, 8, 0, 0, 0, 0); - //int tempee2 = readNormalNr(0,4,((unsigned char *)tempee.c_str())); int BaseOffsetor = BaseOffset = i; diff --git a/hch/CDefHandler.cpp b/hch/CDefHandler.cpp index 3a18576db..31ab9ee41 100644 Binary files a/hch/CDefHandler.cpp and b/hch/CDefHandler.cpp differ