Silence various warnings in builds removing content

The MAKEANDPLAY, NO_CUSTOM_LEVELS, and NO_EDITOR defines remove content
or features. However, they then raise several warnings because of some
cases, functions, or variables that end up not being used.

This silences them by using the UNUSED macro, or by adding a default
catch-all case if the define is defined (so unhandled cases will still
raise warnings in a build that doesn't have these defines).
This commit is contained in:
Misa
2023-02-04 00:14:04 -08:00
parent f2089c954f
commit b29f3e2fae
4 changed files with 30 additions and 5 deletions

View File

@@ -25,6 +25,7 @@
#include "RoomnameTranslator.h"
#include "Screen.h"
#include "Script.h"
#include "Unused.h"
#include "UtilityClass.h"
#include "VFormat.h"
#include "Vlogging.h"
@@ -4207,7 +4208,9 @@ void Game::deletesettings(void)
void Game::unlocknum( int t )
{
#if !defined(MAKEANDPLAY)
#ifdef MAKEANDPLAY
UNUSED(t);
#else
if (map.custommode)
{
//Don't let custom levels unlock things!
@@ -6821,6 +6824,11 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("ok"));
menuyoff = 50;
break;
#ifdef NO_CUSTOM_LEVELS
/* Silence warnings about unhandled cases. */
default:
break;
#endif
}
// Automatically center the menu. We must check the width of the menu with the initial horizontal spacing.
@@ -7198,7 +7206,9 @@ void Game::returntoingame(void)
void Game::unlockAchievement(const char* name)
{
#ifndef MAKEANDPLAY
#ifdef MAKEANDPLAY
UNUSED(name);
#else
if (map.custommode)
{
return;