Cleaned up sdl/utils.hpp includes where possible

Mostly constitutes using forward-declarations. This also includes the removal of an unused 'mini_map' member in lobby_data.
This commit is contained in:
Charles Dang 2016-11-28 12:56:47 +11:00
parent eb3effad21
commit ce7a6ddbb1
17 changed files with 29 additions and 25 deletions

View File

@ -26,6 +26,7 @@
#include "gettext.hpp"
#include "font/marked-up_text.hpp"
#include "font/standard_colors.hpp"
#include "sdl/utils.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/unicode.hpp"
#include "video.hpp"

View File

@ -13,6 +13,9 @@
*/
#include "font/text_cache.hpp"
#include "sdl/utils.hpp"
#include <algorithm>
namespace font {

View File

@ -192,4 +192,9 @@ std::vector<surface> const &text_surface::get_surfaces() const
return surfs_;
}
bool text_surface::operator==(text_surface const &t) const {
return hash_ == t.hash_ && font_size_ == t.font_size_
&& color_ == t.color_ && style_ == t.style_ && str_ == t.str_;
}
} // end namespace font

View File

@ -16,7 +16,6 @@
#define FONT_TEXT_SURFACE_HPP
#include "font_id.hpp" // for text_chunk
#include "sdl/utils.hpp"
#include <SDL_ttf.h>
@ -26,6 +25,7 @@
/***
* Note: This is specific to the SDL_TTF codepath.
*/
class surface;
namespace font {
@ -44,10 +44,7 @@ public:
#endif
std::vector<surface> const & get_surfaces() const;
bool operator==(text_surface const &t) const {
return hash_ == t.hash_ && font_size_ == t.font_size_
&& color_ == t.color_ && style_ == t.style_ && str_ == t.str_;
}
bool operator==(text_surface const &t) const;
bool operator!=(text_surface const &t) const { return !operator==(t); }
private:
int hash_;

View File

@ -17,7 +17,6 @@
#include "config.hpp"
#include "utils/make_enum.hpp"
#include "mp_game_settings.hpp"
#include "sdl/utils.hpp"
#include <string>
#include <utility>

View File

@ -168,8 +168,7 @@ static std::string make_short_name(const std::string& long_name)
}
game_info::game_info(const config& game, const config& game_config, const std::vector<std::string>& installed_addons)
: mini_map()
, id(game["id"])
: id(game["id"])
, map_data(game["map_data"])
, name(game["name"])
, scenario()
@ -292,8 +291,6 @@ game_info::game_info(const config& game, const config& game_config, const std::v
} else {
try {
gamemap map(std::make_shared<terrain_type_data>(game_config), map_data);
// mini_map = image::getMinimap(minimap_size_, minimap_size_, map,
// 0);
std::ostringstream msi;
msi << map.w() << font::unicode_multiplication_sign << map.h();
map_size_info = msi.str();

View File

@ -15,13 +15,13 @@
#ifndef INC_LOBBY_DATA
#define INC_LOBBY_DATA
#include "sdl/utils.hpp"
#include <set>
#include <deque>
#include <functional>
#include <vector>
class config;
class surface;
namespace mp {
@ -142,7 +142,6 @@ struct game_info
bool can_join() const;
bool can_observe() const;
surface mini_map;
int id;
std::string map_data;
std::string name;

View File

@ -16,10 +16,9 @@
#include "gui/dialogs/modal_dialog.hpp"
#include <SDL.h>
#include <vector>
#include "sdl/utils.hpp"
class config;
class display;

View File

@ -19,12 +19,12 @@
#include "gui/core/point.hpp"
#include "gui/widgets/event_executor.hpp"
#include "sdl/utils.hpp"
#include <boost/noncopyable.hpp>
#include <string>
class surface;
typedef std::map<std::string, t_string> string_map;
namespace gui2

View File

@ -28,13 +28,13 @@
#include "gui/core/event/handler.hpp"
#include "gui/core/window_builder.hpp"
#include "gui/widgets/panel.hpp"
#include "sdl/utils.hpp"
#include <map>
#include <string>
#include <vector>
class CVideo;
class surface;
namespace gui2
{

View File

@ -18,9 +18,11 @@
#include <set> // for set
#include <string> // for string, basic_string
#include <vector> // for vector
#include "sdl/utils.hpp" // for surface_restorer
#include "widgets/menu.hpp" // for menu
class CVideo;
struct surface_restorer;
namespace help { struct section; }
namespace help { struct topic; }

View File

@ -16,12 +16,13 @@
#define IMAGE_HPP_INCLUDED
#include "map/location.hpp"
#include "sdl/utils.hpp"
#include "terrain/translation.hpp"
#include "game_config.hpp"
#include <SDL.h>
#include <unordered_map>
class surface;
///this module manages the cache of images. With an image name, you can get
///the surface corresponding to that image.

View File

@ -15,6 +15,7 @@
#include "joystick.hpp"
#include "preferences.hpp"
#include "log.hpp"
#include "sdl/utils.hpp"
#include <boost/math/constants/constants.hpp>
using namespace boost::math::constants;

View File

@ -16,9 +16,10 @@
#define JOYSTICK_HPP_
#include <vector>
#include "sdl/utils.hpp"
#include "map/location.hpp"
#include <SDL.h>
class joystick_manager {
public:

View File

@ -12,6 +12,7 @@
See the COPYING file for more details.
*/
#include "sdl/utils.hpp"
#include "sdl/window.hpp"
#include "sdl/exception.hpp"

View File

@ -20,8 +20,6 @@
* Contains a wrapper class for the @ref SDL_Window class.
*/
#include "sdl/utils.hpp"
#include <boost/noncopyable.hpp>
#include <SDL_video.h>

View File

@ -16,12 +16,12 @@
#include <SDL.h>
#include "sdl/utils.hpp"
#include "widget.hpp"
#include <vector>
class surface;
namespace gui {
class slider : public widget