mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Fixed all warnings "take address of temporary".
This commit is contained in:
parent
9775f88045
commit
eecb470e74
@ -1617,7 +1617,8 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
{
|
||||
int x = 14 + ((*it/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(*it%BFIELD_WIDTH) + pos.x;
|
||||
int y = 86 + 42 * (*it/BFIELD_WIDTH) + pos.y;
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &genRect(cellShade->h, cellShade->w, x, y));
|
||||
SDL_Rect temp_rect = genRect(cellShade->h, cellShade->w, x, y);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &temp_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1625,7 +1626,8 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
{
|
||||
int x = 14 + ((b/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(b%BFIELD_WIDTH) + pos.x;
|
||||
int y = 86 + 42 * (b/BFIELD_WIDTH) + pos.y;
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &genRect(cellShade->h, cellShade->w, x, y));
|
||||
SDL_Rect temp_rect = genRect(cellShade->h, cellShade->w, x, y);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &temp_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1812,7 +1814,8 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
for(std::list<SBattleEffect>::iterator it = battleEffects.begin(); it!=battleEffects.end(); ++it)
|
||||
{
|
||||
SDL_Surface * bitmapToBlit = it->anim->ourImages[(it->frame)%it->anim->ourImages.size()].bitmap;
|
||||
SDL_BlitSurface(bitmapToBlit, NULL, to, &genRect(bitmapToBlit->h, bitmapToBlit->w, it->x, it->y));
|
||||
SDL_Rect temp_rect = genRect(bitmapToBlit->h, bitmapToBlit->w, it->x, it->y);
|
||||
SDL_BlitSurface(bitmapToBlit, NULL, to, &temp_rect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3451,7 +3454,8 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
|
||||
amountBG = amountEffNeutral;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(amountBG, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[ID]->pos.x + xAdd, creAnims[ID]->pos.y + 260));
|
||||
SDL_Rect temp_rect = genRect(amountNormal->h, amountNormal->w, creAnims[ID]->pos.x + xAdd, creAnims[ID]->pos.y + 260);
|
||||
SDL_BlitSurface(amountBG, NULL, to, &temp_rect);
|
||||
//blitting amount
|
||||
CSDL_Ext::printAtMiddle(
|
||||
makeNumberShort(stack->count),
|
||||
@ -3559,7 +3563,8 @@ void CBattleInterface::redrawBackgroundWithHexes(const CStack * activeStack)
|
||||
int j = hex.getX()-1; //column
|
||||
int x = 58 + (i%2==0 ? 22 : 0) + 44*j;
|
||||
int y = 86 + 42 * i;
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, backgroundWithHexes, &genRect(cellShade->h, cellShade->w, x, y));
|
||||
SDL_Rect temp_rect = genRect(cellShade->h, cellShade->w, x, y);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, backgroundWithHexes, &temp_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3864,31 +3869,29 @@ void CBattleHero::show(SDL_Surface *to)
|
||||
//animation of flag
|
||||
if(flip)
|
||||
{
|
||||
SDL_Rect temp_rect = genRect(
|
||||
flag->ourImages[flagAnim].bitmap->h,
|
||||
flag->ourImages[flagAnim].bitmap->w,
|
||||
pos.x + 61,
|
||||
pos.y + 39);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(
|
||||
flag->ourImages[flagAnim].bitmap,
|
||||
NULL,
|
||||
screen,
|
||||
&genRect(
|
||||
flag->ourImages[flagAnim].bitmap->h,
|
||||
flag->ourImages[flagAnim].bitmap->w,
|
||||
pos.x + 61,
|
||||
pos.y + 39
|
||||
)
|
||||
);
|
||||
&temp_rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_Rect temp_rect = genRect(
|
||||
flag->ourImages[flagAnim].bitmap->h,
|
||||
flag->ourImages[flagAnim].bitmap->w,
|
||||
pos.x + 72,
|
||||
pos.y + 39);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(
|
||||
flag->ourImages[flagAnim].bitmap,
|
||||
NULL,
|
||||
screen,
|
||||
&genRect(
|
||||
flag->ourImages[flagAnim].bitmap->h,
|
||||
flag->ourImages[flagAnim].bitmap->w,
|
||||
pos.x + 72,
|
||||
pos.y + 39
|
||||
)
|
||||
);
|
||||
&temp_rect);
|
||||
}
|
||||
++flagAnimCount;
|
||||
if(flagAnimCount%4==0)
|
||||
@ -4250,7 +4253,8 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
|
||||
if(owner->attackingHeroInstance) //a hero attacked
|
||||
{
|
||||
SDL_BlitSurface(graphics->portraitLarge[owner->attackingHeroInstance->portrait], NULL, background, &genRect(64, 58, 21, 38));
|
||||
SDL_Rect temp_rect = genRect(64, 58, 21, 38);
|
||||
SDL_BlitSurface(graphics->portraitLarge[owner->attackingHeroInstance->portrait], NULL, background, &temp_rect);
|
||||
//setting attackerName
|
||||
attackerName = owner->attackingHeroInstance->name;
|
||||
}
|
||||
@ -4266,13 +4270,15 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
bestMonsterID = it->second->type->idNumber;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(graphics->bigImgs[bestMonsterID], NULL, background, &genRect(64, 58, 21, 38));
|
||||
SDL_Rect temp_rect = genRect(64, 58, 21, 38);
|
||||
SDL_BlitSurface(graphics->bigImgs[bestMonsterID], NULL, background, &temp_rect);
|
||||
//setting attackerName
|
||||
attackerName = CGI->creh->creatures[bestMonsterID]->namePl;
|
||||
}
|
||||
if(owner->defendingHeroInstance) //a hero defended
|
||||
{
|
||||
SDL_BlitSurface(graphics->portraitLarge[owner->defendingHeroInstance->portrait], NULL, background, &genRect(64, 58, 392, 38));
|
||||
SDL_Rect temp_rect = genRect(64, 58, 392, 38);
|
||||
SDL_BlitSurface(graphics->portraitLarge[owner->defendingHeroInstance->portrait], NULL, background, &temp_rect);
|
||||
//setting defenderName
|
||||
defenderName = owner->defendingHeroInstance->name;
|
||||
}
|
||||
@ -4288,7 +4294,8 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
bestMonsterID = it->second->type->idNumber;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(graphics->bigImgs[bestMonsterID], NULL, background, &genRect(64, 58, 392, 38));
|
||||
SDL_Rect temp_rect = genRect(64, 58, 392, 38);
|
||||
SDL_BlitSurface(graphics->bigImgs[bestMonsterID], NULL, background, &temp_rect);
|
||||
//setting defenderName
|
||||
defenderName = CGI->creh->creatures[bestMonsterID]->namePl;
|
||||
}
|
||||
@ -4701,7 +4708,8 @@ void CStackQueue::StackBox::showAll( SDL_Surface *to )
|
||||
{
|
||||
graphics->blueToPlayersAdv(bg, my->owner);
|
||||
//SDL_UpdateRect(bg, 0, 0, 0, 0);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(bg, NULL, to, &genRect(bg->h, bg->w, pos.x, pos.y));
|
||||
SDL_Rect temp_rect = genRect(bg->h, bg->w, pos.x, pos.y);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(bg, NULL, to, &temp_rect);
|
||||
//blitAt(bg, pos, to);
|
||||
blitAt(graphics->bigImgs[my->getCreature()->idNumber], pos.x +9, pos.y + 1, to);
|
||||
printAtMiddleLoc(makeNumberShort(my->count), pos.w/2, pos.h - 12, FONT_MEDIUM, zwykly, to);
|
||||
|
@ -56,29 +56,38 @@ void CCursorHandler::draw1()
|
||||
if(!Show) return;
|
||||
int x = xpos, y = ypos;
|
||||
shiftPos(x, y);
|
||||
SDL_BlitSurface(screen, &genRect(40,40,x,y), help, &genRect(40,40,0,0));
|
||||
|
||||
SDL_Rect temp_rect1 = genRect(40,40,x,y);
|
||||
SDL_Rect temp_rect2 = genRect(40,40,0,0);
|
||||
SDL_BlitSurface(screen, &temp_rect1, help, &temp_rect2);
|
||||
// if (dndImage)
|
||||
// blitAt(dndImage, x - dndImage->w/2, y - dndImage->h/2);
|
||||
// else
|
||||
// blitAt(cursors[mode]->ourImages[number].bitmap,x,y);
|
||||
|
||||
if (dndImage)
|
||||
SDL_BlitSurface(dndImage, NULL, screen, &genRect(40, 40, x - dndImage->w/2, y - dndImage->h/2));
|
||||
else
|
||||
SDL_BlitSurface(cursors[mode]->ourImages[number].bitmap, NULL, screen, &genRect(40,40,x,y));
|
||||
if (dndImage) {
|
||||
SDL_Rect temp_rect =genRect(40, 40, x - dndImage->w/2, y - dndImage->h/2);
|
||||
SDL_BlitSurface(dndImage, NULL, screen, &temp_rect);
|
||||
} else {
|
||||
SDL_Rect temp_rect = genRect(40,40,x,y);
|
||||
SDL_BlitSurface(cursors[mode]->ourImages[number].bitmap, NULL, screen, &temp_rect);
|
||||
}
|
||||
}
|
||||
void CCursorHandler::draw2()
|
||||
{
|
||||
if(!Show) return;
|
||||
int x = xpos, y = ypos;
|
||||
shiftPos(x, y);
|
||||
SDL_BlitSurface(help, NULL, screen, &genRect(40, 40, x, y));
|
||||
|
||||
SDL_Rect temp_rect = genRect(40, 40, x, y);
|
||||
SDL_BlitSurface(help, NULL, screen, &temp_rect);
|
||||
//blitAt(help,x,y);
|
||||
}
|
||||
|
||||
void CCursorHandler::draw(SDL_Surface *to)
|
||||
{
|
||||
CSDL_Ext::blitSurface(cursors[mode]->ourImages[number].bitmap, 0, to, &genRect(40, 40, xpos, ypos));
|
||||
SDL_Rect temp_rect = genRect(40, 40, xpos, ypos);
|
||||
CSDL_Ext::blitSurface(cursors[mode]->ourImages[number].bitmap, 0, to, &temp_rect);
|
||||
}
|
||||
|
||||
void CCursorHandler::shiftPos( int &x, int &y )
|
||||
|
@ -123,7 +123,8 @@ void CClient::waitForMoveAndSend(int color)
|
||||
{
|
||||
assert(vstd::contains(battleints, color));
|
||||
BattleAction ba = battleints[color]->activeStack(gs->curB->getStack(gs->curB->activeStack, false));
|
||||
*serv << &MakeAction(ba);
|
||||
MakeAction temp_action(ba);
|
||||
*serv << &temp_action;
|
||||
return;
|
||||
}HANDLE_EXCEPTION
|
||||
tlog1 << "We should not be here!" << std::endl;
|
||||
@ -170,7 +171,8 @@ void CClient::save(const std::string & fname)
|
||||
return;
|
||||
}
|
||||
|
||||
*serv << &SaveGame(fname);
|
||||
SaveGame save_game(fname);
|
||||
*serv << &save_game;
|
||||
}
|
||||
|
||||
#include <fstream>
|
||||
@ -538,7 +540,8 @@ void CClient::stopConnection()
|
||||
{
|
||||
tlog0 << "Connection has been requested to be closed.\n";
|
||||
boost::unique_lock<boost::mutex>(*serv->wmx);
|
||||
*serv << &CloseServer();
|
||||
CloseServer close_server;
|
||||
*serv << &close_server;
|
||||
tlog0 << "Sent closing signal to the server\n";
|
||||
}
|
||||
|
||||
|
@ -512,9 +512,10 @@ void CMapHandler::terrainRect( int3 top_tile, unsigned char anim, const std::vec
|
||||
sr.h=sr.w=32;
|
||||
|
||||
//blit terrain with river/road
|
||||
if(tile.terbitmap) //if custom terrain graphic - use it
|
||||
CSDL_Ext::blitSurface(tile.terbitmap, &genRect(sr.h, sr.w, 0, 0), extSurf, &sr);
|
||||
else //use default terrain graphic
|
||||
if(tile.terbitmap) { //if custom terrain graphic - use it
|
||||
SDL_Rect temp_rect = genRect(sr.h, sr.w, 0, 0);
|
||||
CSDL_Ext::blitSurface(tile.terbitmap, &temp_rect, extSurf, &sr);
|
||||
} else //use default terrain graphic
|
||||
blitterWithRotation(terrainGraphics[tinfo.tertype][tinfo.terview],rtile, extSurf, sr, tinfo.siodmyTajemniczyBajt%4);
|
||||
if(tinfo.nuine) //print river if present
|
||||
blitterWithRotationAndAlpha(staticRiverDefs[tinfo.nuine-1]->ourImages[tinfo.rivDir].bitmap,rtile, extSurf, sr, (tinfo.siodmyTajemniczyBajt>>2)%4);
|
||||
@ -685,10 +686,10 @@ void CMapHandler::terrainRect( int3 top_tile, unsigned char anim, const std::vec
|
||||
if (pos.x < 0 || pos.x >= sizes.x ||
|
||||
pos.y < 0 || pos.y >= sizes.y)
|
||||
{
|
||||
|
||||
SDL_Rect temp_rect = genRect(sr.h, sr.w, 0, 0);
|
||||
|
||||
CSDL_Ext::blitSurface(ttiles[pos.x][pos.y][top_tile.z].terbitmap,
|
||||
&genRect(sr.h, sr.w, 0, 0),extSurf,&sr);
|
||||
&temp_rect,extSurf,&sr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2902,6 +2902,8 @@ bool CGameHandler::queryReply( ui32 qid, ui32 answer )
|
||||
return true;
|
||||
}
|
||||
|
||||
static EndAction end_action;
|
||||
|
||||
bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
{
|
||||
tlog1 << "\tMaking action of type " << ba.actionType << std::endl;
|
||||
@ -2911,15 +2913,17 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
{
|
||||
case BattleAction::END_TACTIC_PHASE: //wait
|
||||
{
|
||||
sendAndApply(&StartAction(ba));
|
||||
sendAndApply(&EndAction());
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action);
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
case BattleAction::WALK: //walk
|
||||
{
|
||||
sendAndApply(&StartAction(ba)); //start movement
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action); //start movement
|
||||
moveStack(ba.stackNumber,ba.destinationTile); //move
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
case BattleAction::DEFEND: //defend
|
||||
@ -2934,8 +2938,9 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
}
|
||||
case BattleAction::WAIT: //wait
|
||||
{
|
||||
sendAndApply(&StartAction(ba));
|
||||
sendAndApply(&EndAction());
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action);
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
case BattleAction::RETREAT: //retreat/flee
|
||||
@ -2964,7 +2969,8 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
break;
|
||||
case BattleAction::WALK_AND_ATTACK: //walk or attack
|
||||
{
|
||||
sendAndApply(&StartAction(ba)); //start movement and attack
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action); //start movement and attack
|
||||
int startingPos = gs->curB->getStack(ba.stackNumber)->position;
|
||||
int distance = moveStack(ba.stackNumber, ba.destinationTile);
|
||||
CStack *curStack = gs->curB->getStack(ba.stackNumber),
|
||||
@ -2980,7 +2986,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
tlog3 << problem << std::endl;
|
||||
complain(problem);
|
||||
ok = false;
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2993,14 +2999,14 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
{
|
||||
complain(boost::str(boost::format("walk and attack error: no stack at additionalInfo tile (%d)!\n") % ba.additionalInfo));
|
||||
ok = false;
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
|
||||
if( !CStack::isMeleeAttackPossible(curStack, stackAtEnd) )
|
||||
{
|
||||
complain("Attack cannot be performed!");
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -3042,7 +3048,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
moveStack(ba.stackNumber, startingPos);
|
||||
//NOTE: curStack->ID == ba.stackNumber (rev 1431)
|
||||
}
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
case BattleAction::SHOOT: //shoot
|
||||
@ -3052,7 +3058,8 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
if( !gs->curB->battleCanShoot(curStack, ba.destinationTile) )
|
||||
break;
|
||||
|
||||
sendAndApply(&StartAction(ba)); //start shooting
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action); //start shooting
|
||||
|
||||
BattleAttack bat;
|
||||
bat.flags |= BattleAttack::SHOT;
|
||||
@ -3080,12 +3087,13 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
handleAfterAttackCasting(bat);
|
||||
}
|
||||
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
case BattleAction::CATAPULT: //catapult
|
||||
{
|
||||
sendAndApply(&StartAction(ba));
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action);
|
||||
const CGHeroInstance * attackingHero = gs->curB->heroes[ba.side];
|
||||
CHeroHandler::SBallisticsLevelInfo sbi = VLC->heroh->ballistics[attackingHero->getSecSkillLevel(CGHeroInstance::BALLISTICS)];
|
||||
|
||||
@ -3182,12 +3190,13 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
|
||||
sendAndApply(&ca);
|
||||
}
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
case BattleAction::STACK_HEAL: //healing with First Aid Tent
|
||||
{
|
||||
sendAndApply(&StartAction(ba));
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action);
|
||||
const CGHeroInstance * attackingHero = gs->curB->heroes[ba.side];
|
||||
CStack *healer = gs->curB->getStack(ba.stackNumber),
|
||||
*destStack = gs->curB->getStackT(ba.destinationTile);
|
||||
@ -3220,7 +3229,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
}
|
||||
|
||||
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3232,7 +3241,9 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
||||
void CGameHandler::playerMessage( ui8 player, const std::string &message )
|
||||
{
|
||||
bool cheated=true;
|
||||
sendAndApply(&PlayerMessage(player,message));
|
||||
PlayerMessage temp_message(player,message);
|
||||
|
||||
sendAndApply(&temp_message);
|
||||
if(message == "vcmiistari") //give all spells and 999 mana
|
||||
{
|
||||
SetMana sm;
|
||||
@ -3353,7 +3364,8 @@ void CGameHandler::playerMessage( ui8 player, const std::string &message )
|
||||
cheated = false;
|
||||
if(cheated)
|
||||
{
|
||||
sendAndApply(&SystemMessage(VLC->generaltexth->allTexts[260]));
|
||||
SystemMessage temp_message(VLC->generaltexth->allTexts[260]);
|
||||
sendAndApply(&temp_message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3665,11 +3677,12 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
|
||||
return false;
|
||||
}
|
||||
|
||||
sendAndApply(&StartAction(ba)); //start spell casting
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action); //start spell casting
|
||||
|
||||
handleSpellCasting (ba.additionalInfo, skill, ba.destinationTile, ba.side, h->tempOwner, h, secondHero, h->getPrimSkillLevel(2), SpellCasting::HERO_CASTING, NULL);
|
||||
|
||||
sendAndApply(&EndAction());
|
||||
sendAndApply(&end_action);
|
||||
if( !gs->curB->getStack(gs->curB->activeStack, false)->alive() )
|
||||
{
|
||||
battleMadeAction.setn(true);
|
||||
@ -4610,8 +4623,10 @@ void CGameHandler::makeStackDoNothing(const CStack * next)
|
||||
doNothing.destinationTile = -1;
|
||||
doNothing.side = !next->attackerOwned;
|
||||
doNothing.stackNumber = next->ID;
|
||||
sendAndApply(&StartAction(doNothing));
|
||||
sendAndApply(&EndAction());
|
||||
|
||||
StartAction start_action(doNothing);
|
||||
sendAndApply(&start_action);
|
||||
sendAndApply(&end_action);
|
||||
}
|
||||
|
||||
bool CGameHandler::insertNewStack(const StackLocation &sl, const CCreature *c, TQuantity count)
|
||||
@ -4815,8 +4830,10 @@ void CGameHandler::runBattle()
|
||||
ba.additionalInfo = 1;
|
||||
ba.side = !next->attackerOwned;
|
||||
ba.stackNumber = next->ID;
|
||||
sendAndApply(&StartAction(ba));
|
||||
sendAndApply(&EndAction());
|
||||
|
||||
StartAction start_action(ba);
|
||||
sendAndApply(&start_action);
|
||||
sendAndApply(&end_action);
|
||||
checkForBattleEnd(stacks); //check if this "action" ended the battle (not likely but who knows...)
|
||||
continue;
|
||||
}
|
||||
|
@ -10,14 +10,18 @@
|
||||
|
||||
|
||||
#define PLAYER_OWNS(id) (gh->getPlayerAt(c)==gh->getOwner(id))
|
||||
#define ERROR_AND_RETURN do {if(c) *c << &SystemMessage("You are not allowed to perform this action!"); \
|
||||
tlog1<<"Player is not allowed to perform this action!\n"; \
|
||||
return false;} while(0)
|
||||
#define ERROR_AND_RETURN \
|
||||
do { if(c) { \
|
||||
SystemMessage temp_message("You are not allowed to perform this action!"); \
|
||||
*c << &temp_message; \
|
||||
} \
|
||||
tlog1<<"Player is not allowed to perform this action!\n"; \
|
||||
return false;} while(0)
|
||||
|
||||
#define WRONG_PLAYER_MSG(expectedplayer) do {std::ostringstream oss;\
|
||||
oss << "You were identified as player " << (int)gh->getPlayerAt(c) << " while expecting " << (int)expectedplayer;\
|
||||
tlog1 << oss.str() << std::endl; \
|
||||
if(c) *c << &SystemMessage(oss.str());} while(0)
|
||||
if(c) { SystemMessage temp_message(oss.str()); *c << &temp_message; } } while(0)
|
||||
|
||||
#define ERROR_IF_NOT_OWNS(id) do{if(!PLAYER_OWNS(id)){WRONG_PLAYER_MSG(gh->getOwner(id)); ERROR_AND_RETURN; }}while(0)
|
||||
#define ERROR_IF_NOT(player) do{if(player != gh->getPlayerAt(c)){WRONG_PLAYER_MSG(player); ERROR_AND_RETURN; }}while(0)
|
||||
@ -276,4 +280,4 @@ bool SetSelection::applyGh( CGameHandler *gh )
|
||||
}
|
||||
gh->sendAndApply(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user