From 983ed6c2a16307e4a60a9ba279e468f78f7460e1 Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Tue, 25 Feb 2020 17:06:45 +0000 Subject: [PATCH] Trim player include (#38324) * Remove player header include from output.h * Remove player.h include from map.h --- src/advanced_inv_listitem.h | 9 +-------- src/bodypart.cpp | 1 + src/character_martial_arts.cpp | 1 + src/clothing_mod.cpp | 1 + src/debug.cpp | 1 + src/help.cpp | 5 +++-- src/iexamine.cpp | 11 +++++++++++ src/map.cpp | 6 ++++++ src/map.h | 5 +---- src/output.h | 13 ++----------- 10 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/advanced_inv_listitem.h b/src/advanced_inv_listitem.h index 50da1e4e3982a..89e514fef3fa0 100644 --- a/src/advanced_inv_listitem.h +++ b/src/advanced_inv_listitem.h @@ -1,18 +1,11 @@ #pragma once #ifndef ADVANCED_INV_LISTITEM_H #define ADVANCED_INV_LISTITEM_H -#include "cursesdef.h" -#include "units.h" + #include "advanced_inv_area.h" -#include "color.h" -#include "player.h" -#include -#include #include #include -#include -#include // see item_factory.h class item_category; diff --git a/src/bodypart.cpp b/src/bodypart.cpp index d18b855d46f16..13364bc1d2498 100644 --- a/src/bodypart.cpp +++ b/src/bodypart.cpp @@ -10,6 +10,7 @@ #include "debug.h" #include "generic_factory.h" #include "json.h" +#include "pldata.h" side opposite_side( side s ) { diff --git a/src/character_martial_arts.cpp b/src/character_martial_arts.cpp index 755d946284928..7739f8005d2bc 100644 --- a/src/character_martial_arts.cpp +++ b/src/character_martial_arts.cpp @@ -1,6 +1,7 @@ #include "character_martial_arts.h" #include "action.h" +#include "character.h" #include "martialarts.h" #include "messages.h" #include "output.h" diff --git a/src/clothing_mod.cpp b/src/clothing_mod.cpp index 8438b557d4e63..6b0d761023ac7 100644 --- a/src/clothing_mod.cpp +++ b/src/clothing_mod.cpp @@ -1,5 +1,6 @@ #include "clothing_mod.h" +#include #include #include diff --git a/src/debug.cpp b/src/debug.cpp index 05dd52c74badb..aaeab8c1642b0 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include diff --git a/src/help.cpp b/src/help.cpp index f00c4ae70e7d7..546eb61c2d790 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -1,11 +1,12 @@ #include "help.h" -#include #include -#include #include +#include #include #include +#include +#include #include "action.h" #include "catacharset.h" diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 0bb3e725445f2..f6e376203ff0f 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4349,6 +4349,17 @@ static player &best_installer( player &p, player &null_player, int difficulty ) return p; } +template +inline void popup_player_or_npc( player &p, const char *player_mes, const char *npc_mes, + Args &&... args ) +{ + if( p.is_player() ) { + popup( player_mes, std::forward( args )... ); + } else { + popup( p.replace_with_npc_name( string_format( npc_mes, std::forward( args )... ) ) ); + } +} + void iexamine::autodoc( player &p, const tripoint &examp ) { enum options { diff --git a/src/map.cpp b/src/map.cpp index 6c3bb1e039a5d..b44be3402d31f 100755 --- a/src/map.cpp +++ b/src/map.cpp @@ -5599,6 +5599,12 @@ void map::draw( const catacurses::window &w, const tripoint ¢er ) } } +void map::drawsq( const catacurses::window &w, player &u, const tripoint &p, + bool invert, bool show_items ) const +{ + drawsq( w, u, p, invert, show_items, u.pos() + u.view_offset, false, false, false ); +} + void map::drawsq( const catacurses::window &w, player &u, const tripoint &p, const bool invert_arg, const bool show_items_arg, const tripoint &view_center, const bool low_light, const bool bright_light, const bool inorder ) const diff --git a/src/map.h b/src/map.h index 782e442c66e6c..8b6a6a87c26c8 100644 --- a/src/map.h +++ b/src/map.h @@ -32,7 +32,6 @@ #include "point.h" #include "mapdata.h" #include "vehicle_group.h" -#include "player.h" struct furn_t; struct ter_t; @@ -336,9 +335,7 @@ class map bool low_light = false, bool bright_light = false, bool inorder = false ) const; void drawsq( const catacurses::window &w, player &u, const tripoint &p, - bool invert = false, bool show_items = true ) const { - drawsq( w, u, p, invert, show_items, u.pos() + u.view_offset, false, false, false ); - } + bool invert = false, bool show_items = true ) const; /** * Add currently loaded submaps (in @ref grid) to the @ref mapbuffer. diff --git a/src/output.h b/src/output.h index 81d36d6448c9c..bc4cfaa362271 100644 --- a/src/output.h +++ b/src/output.h @@ -14,7 +14,8 @@ #include "catacharset.h" #include "color.h" #include "enums.h" -#include "player.h" +#include "item.h" +#include "point.h" #include "string_formatter.h" #include "translations.h" #include "units.h" @@ -455,16 +456,6 @@ inline void full_screen_popup( const char *mes, Args &&... args ) { popup( string_format( mes, std::forward( args )... ), PF_FULLSCREEN ); } -template -inline void popup_player_or_npc( player &p, const char *player_mes, const char *npc_mes, - Args &&... args ) -{ - if( p.is_player() ) { - popup( player_mes, std::forward( args )... ); - } else { - popup( p.replace_with_npc_name( string_format( npc_mes, std::forward( args )... ) ) ); - } -} /*@}*/ std::string format_item_info( const std::vector &vItemDisplay,