1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
- 0.72d #27
- 0.73 #13
This commit is contained in:
mateuszb 2009-08-07 09:45:21 +00:00
parent 3d93e0acf0
commit 9d531b0d84
5 changed files with 21 additions and 21 deletions

View File

@ -86,11 +86,7 @@ CBattleInterface::CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, C
std::map<int, CStack> stacks = LOCPLINT->cb->battleGetStacks();
for(std::map<int, CStack>::iterator b=stacks.begin(); b!=stacks.end(); ++b)
{
std::pair <int, int> coords = CBattleHex::getXYUnitAnim(b->second.position, b->second.owner == attackingHeroInstance->tempOwner, &b->second);
creAnims[b->second.ID] = (new CCreatureAnimation(b->second.creature->animDefName));
creAnims[b->second.ID]->setType(2);
creAnims[b->second.ID]->pos = genRect(creAnims[b->second.ID]->fullHeight, creAnims[b->second.ID]->fullWidth, coords.first, coords.second);
creDir[b->second.ID] = b->second.owner==attackingHeroInstance->tempOwner;
newStack(b->second.ID);
}
//preparing menu background and terrain
std::vector< std::string > & backref = graphics->battleBacks[ LOCPLINT->cb->battleGetBattlefieldType() ];
@ -998,17 +994,21 @@ void CBattleInterface::bConsoleDownf()
console->scrollDown();
}
void CBattleInterface::newStack(CStack stack)
void CBattleInterface::newStack(int stackID)
{
creAnims[stack.ID] = new CCreatureAnimation(stack.creature->animDefName);
creAnims[stack.ID]->setType(2);
creDir[stack.ID] = stack.owner==attackingHeroInstance->tempOwner;
const CStack * newStack = LOCPLINT->cb->battleGetStackByID(stackID);
std::pair <int, int> coords = CBattleHex::getXYUnitAnim(newStack->position, newStack->owner == attackingHeroInstance->tempOwner, newStack);
creAnims[stackID] = (new CCreatureAnimation(newStack->creature->animDefName));
creAnims[stackID]->setType(2);
creAnims[stackID]->pos = genRect(creAnims[newStack->ID]->fullHeight, creAnims[newStack->ID]->fullWidth, coords.first, coords.second);
creDir[stackID] = newStack->owner == attackingHeroInstance->tempOwner;
}
void CBattleInterface::stackRemoved(CStack stack)
void CBattleInterface::stackRemoved(int stackID)
{
delete creAnims[stack.ID];
creAnims.erase(stack.ID);
delete creAnims[stackID];
creAnims.erase(stackID);
}
void CBattleInterface::stackActivated(int number)

View File

@ -281,8 +281,8 @@ public:
};
//call-ins
void newStack(CStack stack); //new stack appeared on battlefield
void stackRemoved(CStack stack); //stack disappeared from batlefiled
void newStack(int stackID); //new stack appeared on battlefield
void stackRemoved(int stackID); //stack disappeared from batlefiled
//void stackKilled(int ID, int dmg, int killed, int IDby, bool byShooting); //stack has been killed (but corpses remain)
void stackActivated(int number); //active stack has been changed
void stackMoved(int number, int destHex, bool endMoving, int distance); //stack with id number moved to destHex

View File

@ -976,14 +976,8 @@ void CPlayerInterface::battleStacksHealedRes(const std::vector<std::pair<ui32, u
void CPlayerInterface::battleNewStackAppeared(int stackID)
{
const CStack * newStack = cb->battleGetStackByID(stackID);
//changing necessary things in battle interface
std::pair <int, int> coords = CBattleHex::getXYUnitAnim(newStack->position, newStack->owner == battleInt->attackingHeroInstance->tempOwner, newStack);
battleInt->creAnims[newStack->ID] = (new CCreatureAnimation(newStack->creature->animDefName));
battleInt->creAnims[newStack->ID]->setType(2);
battleInt->creAnims[newStack->ID]->pos = genRect(battleInt->creAnims[newStack->ID]->fullHeight, battleInt->creAnims[newStack->ID]->fullWidth, coords.first, coords.second);
battleInt->creDir[newStack->ID] = newStack->owner == battleInt->attackingHeroInstance->tempOwner;
battleInt->newStack(stackID);
}
void CPlayerInterface::battleNewRound(int round) //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn

View File

@ -3125,6 +3125,9 @@ void CInGameConsole::keyPressed (const SDL_KeyboardEvent & key)
}
case SDLK_UP: //up arrow
{
if(previouslyEntered.size() == 0)
break;
if(prevEntDisp == -1)
{
prevEntDisp = previouslyEntered.size() - 1;

View File

@ -411,6 +411,9 @@ std::vector<int> BattleInfo::getAccessibility(int stackID, bool addOccupiable)
bool BattleInfo::isStackBlocked(int ID)
{
CStack *our = getStack(ID);
if(our->hasFeatureOfType(StackFeature::SIEGE_WEAPON)) //siege weapons cannot be blocked
return true;
for(unsigned int i=0; i<stacks.size();i++)
{
if( !stacks[i]->alive()