From 9471ac4ff507fb49c1f563c59f9ba6e400026dcb Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 8 Feb 2019 18:18:56 -0500 Subject: [PATCH] Rearrange some macros. No functional change intended. --- commandline.cpp | 2 +- help.cpp | 2 +- hyper.h | 8 -------- hyper_function.h | 18 ++++++++++++++++++ quit.cpp | 2 -- sysconfig.h | 40 ++++++++++++++++++++-------------------- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/commandline.cpp b/commandline.cpp index c8d366bb..be0035c2 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -39,7 +39,7 @@ eMonster readMonster(const string& ss) { void initializeCLI() { printf("HyperRogue by Zeno Rogue , version " VER "\n"); -#ifndef NOLICENSE +#if !NOLICENSE printf("released under GNU General Public License version 2 and thus\n"); printf("comes with absolutely no warranty; see COPYING for details\n"); #endif diff --git a/help.cpp b/help.cpp index d4ca3a7a..968176f9 100644 --- a/help.cpp +++ b/help.cpp @@ -137,7 +137,7 @@ void buildCredits() { help += XLAT("game design, programming, texts and graphics by Zeno Rogue \n\n"); if(lang() != 0) help += XLAT("add credits for your translation here"); -#ifndef NOLICENSE +#if !NOLICENSE help += XLAT( "released under GNU General Public License version 2 and thus " "comes with absolutely no warranty; see COPYING for details\n\n" diff --git a/hyper.h b/hyper.h index 0c98cce0..ab352426 100644 --- a/hyper.h +++ b/hyper.h @@ -7,9 +7,7 @@ #define VERNUM_HEX 0xA505 #include -#if !ISSTEAM #include "hyper_function.h" -#endif namespace hr { @@ -18,12 +16,6 @@ void ignore(T&&) { // placate GCC's overzealous -Wunused-result } -#if USE_STDFUNCTION -using std::function; -#else -template using function = hyper_function; -#endif - // functions and types used from the standard library using std::vector; using std::map; diff --git a/hyper_function.h b/hyper_function.h index 9a64e57c..97a71d18 100644 --- a/hyper_function.h +++ b/hyper_function.h @@ -1,11 +1,25 @@ #pragma once +#if USE_STDFUNCTION + +#include +namespace hr { + using std::function; +} // namespace hr + +#else + #include #include +namespace hr { + template class hyper_function; +template +using function = hyper_function; + template struct hyper_function_state_base { virtual R call(Args...) const = 0; @@ -59,3 +73,7 @@ public: return ptr_ != nullptr; } }; + +} // namespace hr + +#endif diff --git a/quit.cpp b/quit.cpp index daf15aa9..e9a09ae2 100644 --- a/quit.cpp +++ b/quit.cpp @@ -160,9 +160,7 @@ hint hints[] = { "Try the Orb Strategy mode!") ); dialog::addBreak(50); -#ifdef INF dialog::addItem(XLAT("Orb Strategy mode"), 'z'); -#endif }, []() { #if CAP_INV diff --git a/sysconfig.h b/sysconfig.h index 9ea6cebf..67c630c9 100644 --- a/sysconfig.h +++ b/sysconfig.h @@ -13,18 +13,6 @@ #define ISWINDOWS 1 #endif -#if ISSTEAM -#define NOLICENSE -#endif - -#ifndef USE_STDFUNCTION -#define USE_STDFUNCTION ISSTEAM -#endif - -#ifndef CAP_SHADER -#define CAP_SHADER CAP_GL -#endif - // OS settings #ifndef ISMAC @@ -51,6 +39,10 @@ #define ISANDROID 0 #endif +#ifndef ISSTEAM +#define ISSTEAM 0 +#endif + #ifndef ISWEB #define ISWEB 0 #endif @@ -72,18 +64,30 @@ #define CAP_FRAMELIMIT (!ISMOBWEB) -#if ISMOBILE==1 +#if ISMOBILE #define EXTERNALFONT #endif -#ifndef CAP_FILES -#define CAP_FILES 1 +#ifndef NOLICENSE +#define NOLICENSE ISSTEAM +#endif + +#ifndef USE_STDFUNCTION +#define USE_STDFUNCTION ISSTEAM +#endif + +#ifndef CAP_SHADER +#define CAP_SHADER CAP_GL #endif #ifndef CAP_ANIMATIONS #define CAP_ANIMATIONS (!CAP_MINI) #endif +#ifndef CAP_FILES +#define CAP_FILES 1 +#endif + #ifndef CAP_INV #define CAP_INV 1 #endif @@ -237,16 +241,12 @@ #define CAP_SHMUP 1 #endif -#ifdef ISSTEAM -#define CAP_ACHIEVE 1 -#endif - #ifndef CAP_BITFIELD #define CAP_BITFIELD (!ISWEB) #endif #ifndef CAP_ACHIEVE -#define CAP_ACHIEVE 0 +#define CAP_ACHIEVE ISSTEAM #endif #ifndef CAP_SHMUP_GOOD