Browse Source

* fix for 0.72d #26 (flying creatures will be blitted over all other creatures, obstacles and wall)

mateuszb 16 years ago
parent
commit
22e9098752
1 changed files with 9 additions and 1 deletions
  1. 9 1
      client/CBattleInterface.cpp

+ 9 - 1
client/CBattleInterface.cpp

@@ -1572,13 +1572,17 @@ void CBattleInterface::show(SDL_Surface * to)
 			creAnims[stackDeadByHex[b][v]]->nextFrame(to, creAnims[stackDeadByHex[b][v]]->pos.x, creAnims[stackDeadByHex[b][v]]->pos.y, creDir[stackDeadByHex[b][v]], animCount, false); //increment always when moving, never if stack died
 		}
 	}
+	std::vector<int> flyingStacks; //flying stacks should be displayed later, over other stacks and obstacles
 	for(int b=0; b<BFIELD_SIZE; ++b) //showing alive stacks
 	{
 		for(size_t v=0; v<stackAliveByHex[b].size(); ++v)
 		{
 			int curStackID = stackAliveByHex[b][v];
 			
-			showAliveStack(stackAliveByHex[b][v], stacks, to);
+			if(!stacks[curStackID].hasFeatureOfType(StackFeature::FLYING) || creAnims[curStackID]->getType() != 0)
+				showAliveStack(curStackID, stacks, to);
+			else
+				flyingStacks.push_back(curStackID);
 		}
 
 		//showing obstacles
@@ -1598,6 +1602,10 @@ void CBattleInterface::show(SDL_Surface * to)
 		//showing wall pieces
 		showPieceOfWall(to, b, stacks);
 	}
+	
+	for(int b=0; b<flyingStacks.size(); ++b) //showing flyign stacks
+		showAliveStack(flyingStacks[b], stacks, to);
+
 	//units shown
 
 	//showing hero animations