From 673ffddf4aabb7bf0cf0fc10b5dd8164d1001ffb Mon Sep 17 00:00:00 2001 From: mateuszb Date: Fri, 30 Jan 2009 14:36:26 +0000 Subject: [PATCH] * creature info window contains info about modified speed * removed unwanted behavior - VCMI allows now for attacking when move action fails (command walk & attack) [to be tested as I'm not sure if I've done enough] * battle result window properly displayed --- CBattleInterface.cpp | 4 +++- CPlayerInterface.cpp | 12 ++++++++++++ server/CGameHandler.cpp | 12 ++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CBattleInterface.cpp b/CBattleInterface.cpp index c5ed8668a..d793a6f40 100644 --- a/CBattleInterface.cpp +++ b/CBattleInterface.cpp @@ -566,13 +566,14 @@ void CBattleInterface::show(SDL_Surface * to) } } + SDL_SetClipRect(to, &buf); //restoring previous clip_rect + //showing window with result of battle if(resWindow) { resWindow->show(to); } - SDL_SetClipRect(to, &buf); //restoring previous clip_rect //printing border around interface if(screen->w != 800 || screen->h !=600) @@ -2310,6 +2311,7 @@ void CBattleHex::clickRight(boost::logic::tribool down) pom->defenseBonus = h->getPrimSkillLevel(1); pom->luck = h->getCurrentLuck(); pom->morale = h->getCurrentMorale(); + pom->speedBonus = myst.speed() - myst.creature->speed; } pom->shotsLeft = myst.shots; diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 6e44c9bb2..70a4ae396 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -3328,6 +3328,18 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState //speed printAt(CGI->generaltexth->zelp[441].first,155,162,GEOR13,zwykly,bitmap); SDL_itoa(c->speed,pom,10); + if(State && State->speedBonus) + { + int hlp; + if(c->speed > 0) + hlp = log10f(c->speed)+2; + else + hlp = 2; + pom[hlp-1] = ' '; pom[hlp] = '('; + SDL_itoa(c->speed + State->speedBonus, pom+hlp+1, 10); + hlp += 2+(int)log10f(c->speed + State->speedBonus); + pom[hlp] = ')'; pom[hlp+1] = '\0'; + } printToWR(pom,276,175,GEOR13,zwykly,bitmap); diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index a856a534c..3c1c86272 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -1130,8 +1130,16 @@ upgend: CStack *curStack = gs->curB->getStack(ba.stackNumber), *stackAtEnd = gs->curB->getStackT(ba.additionalInfo); - if( curStack->position != ba.destinationTile //we wasn't able to reach destination tile - || BattleInfo::mutualPosition(ba.destinationTile,ba.additionalInfo) < 0 //destination tile is not neighbouring with enemy stack + if(curStack->position != ba.destinationTile) //we wasn't able to reach destination tile + { + tlog3<<"We cannot move this stack to its destination "<creature->namePl<creature->isDoubleWide()) + || (curStack->creature->isDoubleWide() + && (BattleInfo::mutualPosition(ba.destinationTile, ba.additionalInfo) < 0) + && (BattleInfo::mutualPosition(ba.destinationTile + (curStack->attackerOwned ? -1 : 1), ba.additionalInfo) < 0)) ) { sendDataToClients(ui16(3008)); //end movement and attack