소스 검색

* 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

mateuszb 16 년 전
부모
커밋
673ffddf4a
3개의 변경된 파일25개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      CBattleInterface.cpp
  2. 12 0
      CPlayerInterface.cpp
  3. 10 2
      server/CGameHandler.cpp

+ 3 - 1
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;

+ 12 - 0
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);
 
 

+ 10 - 2
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 "<<curStack->creature->namePl<<std::endl;
+							}
+
+							if( (BattleInfo::mutualPosition(ba.destinationTile, ba.additionalInfo) < 0 //destination tile is not neighbouring with enemy stack
+									&& !curStack->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