Skip to content

Commit

Permalink
Trim player include (#38324)
Browse files Browse the repository at this point in the history
* Remove player header include from output.h

* Remove player.h include from map.h
  • Loading branch information
kevingranade authored Feb 25, 2020
1 parent 3d7a03b commit 983ed6c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 25 deletions.
9 changes: 1 addition & 8 deletions src/advanced_inv_listitem.h
Original file line number Diff line number Diff line change
@@ -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 <array>
#include <functional>
#include <list>
#include <string>
#include <vector>
#include <utility>

// see item_factory.h
class item_category;
Expand Down
1 change: 1 addition & 0 deletions src/bodypart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "debug.h"
#include "generic_factory.h"
#include "json.h"
#include "pldata.h"

side opposite_side( side s )
{
Expand Down
1 change: 1 addition & 0 deletions src/character_martial_arts.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "character_martial_arts.h"

#include "action.h"
#include "character.h"
#include "martialarts.h"
#include "messages.h"
#include "output.h"
Expand Down
1 change: 1 addition & 0 deletions src/clothing_mod.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "clothing_mod.h"

#include <cmath>
#include <string>
#include <set>

Expand Down
1 change: 1 addition & 0 deletions src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <sys/stat.h>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cassert>
Expand Down
5 changes: 3 additions & 2 deletions src/help.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "help.h"

#include <cstddef>
#include <algorithm>
#include <vector>
#include <array>
#include <cstddef>
#include <iterator>
#include <list>
#include <numeric>
#include <vector>

#include "action.h"
#include "catacharset.h"
Expand Down
11 changes: 11 additions & 0 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4349,6 +4349,17 @@ static player &best_installer( player &p, player &null_player, int difficulty )
return p;
}

template<typename ...Args>
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>( args )... );
} else {
popup( p.replace_with_npc_name( string_format( npc_mes, std::forward<Args>( args )... ) ) );
}
}

void iexamine::autodoc( player &p, const tripoint &examp )
{
enum options {
Expand Down
6 changes: 6 additions & 0 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5599,6 +5599,12 @@ void map::draw( const catacurses::window &w, const tripoint &center )
}
}

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
Expand Down
5 changes: 1 addition & 4 deletions src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "point.h"
#include "mapdata.h"
#include "vehicle_group.h"
#include "player.h"

struct furn_t;
struct ter_t;
Expand Down Expand Up @@ -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.
Expand Down
13 changes: 2 additions & 11 deletions src/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -455,16 +456,6 @@ inline void full_screen_popup( const char *mes, Args &&... args )
{
popup( string_format( mes, std::forward<Args>( args )... ), PF_FULLSCREEN );
}
template<typename ...Args>
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>( args )... );
} else {
popup( p.replace_with_npc_name( string_format( npc_mes, std::forward<Args>( args )... ) ) );
}
}

/*@}*/
std::string format_item_info( const std::vector<iteminfo> &vItemDisplay,
Expand Down

0 comments on commit 983ed6c

Please sign in to comment.