From d971cf7702100e13e81209e738fff090cd72cad2 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 26 Sep 2015 21:17:12 +0000 Subject: [PATCH] Wrap game-specific types in game-specific preprocessor guards These types are not used in common code, and in some cases would provoke a -Wodr warning if they were used. --- common/main/kconfig.h | 5 ++++- common/main/mission.h | 2 ++ common/main/multi.h | 2 ++ common/main/playsave.h | 2 ++ common/main/powerup.h | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/main/kconfig.h b/common/main/kconfig.h index 0882da4ec..51b8d5fa4 100644 --- a/common/main/kconfig.h +++ b/common/main/kconfig.h @@ -35,6 +35,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. struct d_event; +#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) struct control_info { template struct ramp_controls_t @@ -80,6 +81,9 @@ struct control_info { array mouse_axis, raw_mouse_axis; }; +extern control_info Controls; +#endif + #define CONTROL_USING_JOYSTICK 1 #define CONTROL_USING_MOUSE 2 #define MOUSEFS_DELTA_RANGE 512 @@ -91,7 +95,6 @@ struct control_info { #define MAX_CONTROLS 60 // there are actually 48, so this leaves room for more #endif -extern control_info Controls; extern void kconfig_read_controls(const d_event &event, int automap_flag); extern void kconfig(int n, const char *title); diff --git a/common/main/mission.h b/common/main/mission.h index 8d0b36f67..2d37788bd 100644 --- a/common/main/mission.h +++ b/common/main/mission.h @@ -113,6 +113,7 @@ public: std::string::const_iterator filename; // filename without extension }; +#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) struct Mission : Mission_path { std::unique_ptr secret_level_table; // originating level no for each secret level @@ -161,6 +162,7 @@ extern Mission_ptr Current_mission; // current mission #endif #define PLAYING_BUILTIN_MISSION (Current_mission->builtin_hogsize != 0) #define ANARCHY_ONLY_MISSION (1 == Current_mission->anarchy_only_flag) +#endif //values for d1 built-in mission #define BIMD1_LAST_LEVEL 27 diff --git a/common/main/multi.h b/common/main/multi.h index 46937e370..142295855 100644 --- a/common/main/multi.h +++ b/common/main/multi.h @@ -608,6 +608,7 @@ extern char RefuseThisPlayer,WaitForRefuseAnswer,RefuseTeam,RefusePlayerName[12] extern fix64 RefuseTimeLimit; #define REFUSE_INTERVAL (F1_0*8) +#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) struct bit_game_flags { unsigned closed : 1; unsigned : 1; @@ -666,6 +667,7 @@ static inline packed_game_flags pack_game_flags(const bit_game_flags *flags) 0; return p; } +#endif #define NETGAME_NAME_LEN 15 diff --git a/common/main/playsave.h b/common/main/playsave.h index 29632935b..11a82218b 100644 --- a/common/main/playsave.h +++ b/common/main/playsave.h @@ -25,6 +25,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #pragma once +#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) #if defined(DXX_BUILD_DESCENT_I) #include "pstypes.h" #include "player.h" @@ -161,3 +162,4 @@ void read_netgame_profile(struct netgame_info *ng); void write_netgame_profile(struct netgame_info *ng); #endif +#endif diff --git a/common/main/powerup.h b/common/main/powerup.h index fdc882ef9..098d3db99 100644 --- a/common/main/powerup.h +++ b/common/main/powerup.h @@ -32,6 +32,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifdef __cplusplus #include "fwdobject.h" +#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) enum powerup_type_t : uint8_t { POW_EXTRA_LIFE = 0, @@ -94,7 +95,6 @@ enum powerup_type_t : uint8_t #endif }; -#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) #if defined(DXX_BUILD_DESCENT_I) #define VULCAN_AMMO_MAX (392*2) #define MAX_POWERUP_TYPES 29