Skip to content

Commit

Permalink
widget: Fix broken warning on host quitting multiplayer games.
Browse files Browse the repository at this point in the history
Probably broken in 6a71410.

Fixes ticket:4384.
  • Loading branch information
Cyp committed May 21, 2016
1 parent d3132c2 commit b93cac8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 44 deletions.
52 changes: 15 additions & 37 deletions src/ingameop.cpp
Expand Up @@ -29,6 +29,7 @@
#include "lib/framework/wzapp.h"
#include "lib/framework/strres.h"
#include "lib/widget/widget.h"
#include "lib/widget/label.h"
#include "lib/netplay/netplay.h"
#include "lib/ivis_opengl/piestate.h" // for getrendertype
#include "lib/sound/audio.h" // for sound.
Expand Down Expand Up @@ -84,20 +85,14 @@ static bool addIGTextButton(UDWORD id, UWORD x, UWORD y, UWORD width, const char

static bool addQuitOptions(void)
{
if (widgGetFromID(psWScreen, INTINGAMEOP))
{
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
}

if (widgGetFromID(psWScreen, INTINGAMEPOPUP))
{
widgDelete(psWScreen, INTINGAMEPOPUP); // get rid of the old stuff.
}
// get rid of the old stuff.
delete widgGetFromID(psWScreen, INTINGAMEOP);
delete widgGetFromID(psWScreen, INTINGAMEPOPUP);

WIDGET *parent = psWScreen->psForm;

// add form
IntFormAnimated *inGameOp = new IntFormAnimated(parent);
auto inGameOp = new IntFormAnimated(parent);
inGameOp->id = INTINGAMEOP;
inGameOp->setGeometry(INTINGAMEOP3_X, INTINGAMEOP3_Y, INTINGAMEOP3_W, INTINGAMEOP3_H);

Expand All @@ -106,23 +101,15 @@ static bool addQuitOptions(void)

if (NetPlay.isHost && bMultiPlayer && NetPlay.bComms) // only show for real MP games
{
IntFormAnimated *inGamePopup = new IntFormAnimated(parent);
inGamePopup->id = INTINGAMEOP;
inGamePopup->setGeometry(600, 26, 20 + D_W, 130);

W_BUTINIT sButInit;

sButInit.formID = INTINGAMEPOPUP;
sButInit.style = OPALIGN;
sButInit.width = 600;
sButInit.height = 10;
sButInit.x = 0;
sButInit.y = 8;
sButInit.pDisplay = displayTextOption;
sButInit.id = INTINGAMEOP_POPUP_MSG3;
sButInit.pText = _("WARNING: You're the host. If you quit, the game ends for everyone!");

widgAddButton(psWScreen, &sButInit);
auto inGamePopup = new IntFormAnimated(parent);
inGamePopup->id = INTINGAMEPOPUP;
inGamePopup->setGeometry((pie_GetVideoBufferWidth() - 600)/2, inGameOp->y() - 26 - 20, 600, 26);

auto label = new W_LABEL(inGamePopup);
label->setGeometry(0, 0, inGamePopup->width(), inGamePopup->height());
label->setString(_("WARNING: You're the host. If you quit, the game ends for everyone!"));
label->setTextAlignment(WLAB_ALIGNCENTRE);
label->setFont(font_medium, WZCOL_YELLOW);
}

return true;
Expand All @@ -131,10 +118,7 @@ static bool addQuitOptions(void)

static bool addSlideOptions(void)
{
if (widgGetFromID(psWScreen, INTINGAMEOP))
{
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
}
delete widgGetFromID(psWScreen, INTINGAMEOP); // get rid of the old stuff.

WIDGET *parent = psWScreen->psForm;

Expand Down Expand Up @@ -413,8 +397,6 @@ bool intCloseInGameOptions(bool bPutUpLoadSave, bool bResetMissionWidgets)
// process clicks made by user.
void intProcessInGameOptions(UDWORD id)
{


switch (id)
{
// NORMAL KEYS
Expand Down Expand Up @@ -493,8 +475,4 @@ void intProcessInGameOptions(UDWORD id)
default:
break;
}


}


11 changes: 4 additions & 7 deletions src/ingameop.h
Expand Up @@ -38,10 +38,6 @@ extern bool isInGamePopupUp;
// ////////////////////////////////////////////////////////////////////////////
// defines

// the screen itself.
#define INTINGAMEOP 10500
#define INTINGAMEPOPUP 77335

// position info for window.

// game options
Expand Down Expand Up @@ -74,7 +70,9 @@ extern bool isInGamePopupUp;

enum
{
INTINGAMEOP_QUIT = INTINGAMEOP + 1,
INTINGAMEOP = 10500,
INTINGAMEPOPUP,
INTINGAMEOP_QUIT,
INTINGAMEOP_QUIT_CONFIRM, ///< The all important quit button
INTINGAMEOP_RESUME,
INTINGAMEOP_LOAD_MISSION,
Expand Down Expand Up @@ -103,8 +101,7 @@ enum
INTINGAMEOP_TUI_TARGET_ORIGIN_SW, ///< Switch
INTINGAMEOP_POPUP_QUIT,
INTINGAMEOP_POPUP_MSG1,
INTINGAMEOP_POPUP_MSG2,
INTINGAMEOP_POPUP_MSG3
INTINGAMEOP_POPUP_MSG2
};


Expand Down

0 comments on commit b93cac8

Please sign in to comment.