Skip to content

Commit

Permalink
Do not allow storing templates or loading of stored templates in camp…
Browse files Browse the repository at this point in the history
…aign.

Since templates are stored in the savegame anyway, having stored template
support in campaigns is mostly superfluous, and a cause for bugs.
  • Loading branch information
perim committed Jun 13, 2017
1 parent 123ded5 commit d935f57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
26 changes: 19 additions & 7 deletions src/design.cpp
Expand Up @@ -538,7 +538,7 @@ bool intAddDesign(bool bShowCentreScreen)
sButInit.pDisplay = intDisplayButtonHilight;
sButInit.UserData = PACKDWORD_TRI(0, IMAGE_DES_SAVEH, IMAGE_DES_SAVE);

if (!widgAddButton(psWScreen, &sButInit))
if (bMultiPlayer && !widgAddButton(psWScreen, &sButInit))
{
return false;
}
Expand Down Expand Up @@ -3020,7 +3020,10 @@ void intProcessDesign(UDWORD id)
intSetButtonFlash(IDDES_WPABUTTON, true);
intSetButtonFlash(IDDES_WPBBUTTON, true);

widgHide(psWScreen, IDDES_STOREBUTTON);
if (bMultiPlayer)
{
widgHide(psWScreen, IDDES_STOREBUTTON);
}
}
else
{
Expand Down Expand Up @@ -3068,8 +3071,11 @@ void intProcessDesign(UDWORD id)
intSetButtonFlash(IDDES_WPBBUTTON, true);
}

widgReveal(psWScreen, IDDES_STOREBUTTON);
updateStoreButton(sCurrDesign.stored);
if (bMultiPlayer)
{
widgReveal(psWScreen, IDDES_STOREBUTTON);
updateStoreButton(sCurrDesign.stored);
}
}
}

Expand Down Expand Up @@ -3967,11 +3973,17 @@ static bool saveTemplate()
{
if (!intValidTemplate(&sCurrDesign, aCurrName, false, selectedPlayer))
{
widgHide(psWScreen, IDDES_STOREBUTTON);
if (bMultiPlayer)
{
widgHide(psWScreen, IDDES_STOREBUTTON);
}
return false;
}
widgReveal(psWScreen, IDDES_STOREBUTTON);
updateStoreButton(sCurrDesign.stored); // Change the buttons icon
if (bMultiPlayer)
{
widgReveal(psWScreen, IDDES_STOREBUTTON);
updateStoreButton(sCurrDesign.stored); // Change the buttons icon
}

/* if first (New Design) button selected find empty template
* else find current button template
Expand Down
6 changes: 1 addition & 5 deletions src/init.cpp
Expand Up @@ -1202,17 +1202,13 @@ bool stageThreeInitialise()

if (bMultiPlayer)
{
// FIXME Is this really needed?
debug(LOG_WZ, "multiGameInit()\n");
multiGameInit();
cmdDroidMultiExpBoost(true);
initTemplates();
}

preProcessVisibility();

// Load any stored templates; these need to be available ASAP
initTemplates();

prepareScripts(getLevelLoadType() == GTYPE_SAVE_MIDMISSION || getLevelLoadType() == GTYPE_SAVE_START);

if (!fpathInitialise())
Expand Down

0 comments on commit d935f57

Please sign in to comment.