diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7bee41fceaa..8205eed3ad4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -350,7 +350,6 @@ set(wesnoth-main_SRC playmp_controller.cpp playsingle_controller.cpp playturn.cpp - portrait.cpp replay.cpp replay_controller.cpp resources.cpp diff --git a/src/Makefile.am b/src/Makefile.am index a88c2f116bd..b7b114341d3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -232,7 +232,6 @@ wesnoth_source = \ playmp_controller.cpp \ playsingle_controller.cpp \ playturn.cpp \ - portrait.cpp \ replay.cpp \ replay_controller.cpp \ resources.cpp \ diff --git a/src/SConscript b/src/SConscript index bc3f85e5546..ef7b50f3beb 100644 --- a/src/SConscript +++ b/src/SConscript @@ -224,7 +224,6 @@ wesnoth_sources = Split(""" playmp_controller.cpp playsingle_controller.cpp playturn.cpp - portrait.cpp replay.cpp replay_controller.cpp resources.cpp diff --git a/src/game_events.cpp b/src/game_events.cpp index f2dad84b0d8..3fdabe94e66 100644 --- a/src/game_events.cpp +++ b/src/game_events.cpp @@ -2945,28 +2945,6 @@ WML_HANDLER_FUNCTION(message, event_info, cfg) if(dlg_result == gui2::twindow::CANCEL) { current_context->skip_messages = true; } - - /** - * @todo enable portrait code in 1.7 and write a clean api. - */ -#if 0 - const tportrait* portrait = - speaker->second.portrait(400, tportrait::LEFT); - if(portrait) { - gui2::twml_message_left dlg( - caption, - cfg["message"], - portrait->image, - portrait->mirror); - - dlg.show(screen->video()); - if(dlg.get_retval() == gui2::twindow::CANCEL) { - handler.skip_messages(true); - } - return; - } -#endif - } // Otherwise if an input has to be made, get it from the replay data diff --git a/src/portrait.cpp b/src/portrait.cpp deleted file mode 100644 index 66f49b67730..00000000000 --- a/src/portrait.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* $Id$ */ -/* - Copyright (C) 2008 - 2010 by mark de wever - Part of the Battle for Wesnoth Project http://www.wesnoth.org/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - or at your option any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY. - - See the COPYING file for more details. -*/ - -#include "portrait.hpp" - -#include "config.hpp" -#include "log.hpp" -#include "serialization/string_utils.hpp" -#include "util.hpp" -#include "wml_exception.hpp" - -static lg::log_domain log_config("config"); -#define WRN_CF LOG_STREAM(warn, log_config) - -static tportrait::tside get_side(const std::string& side) -{ - if(side == "both") { - return tportrait::BOTH; - } else if(side == "right") { - return tportrait::RIGHT; - } else if(side == "left") { - return tportrait::LEFT; - } else { - WRN_CF << "Unknown portrait side '" << side << "' defaulting to left.\n"; - return tportrait::LEFT; - } -} - -tportrait::tportrait(const config& cfg) : - image(cfg["image"]), - side(get_side(cfg["side"])), - size(lexical_cast_default(cfg["size"])), - mirror(utils::string_bool(cfg["mirror"])) -{ - VALIDATE(!image.empty(), missing_mandatory_wml_key("portrait", "image")); - VALIDATE(size != 0, missing_mandatory_wml_key("portrait", "size")); -} - diff --git a/src/portrait.hpp b/src/portrait.hpp deleted file mode 100644 index bad8180677d..00000000000 --- a/src/portrait.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* $Id$ */ -/* - Copyright (C) 2008 - 2010 by mark de wever - Part of the Battle for Wesnoth Project http://www.wesnoth.org/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - or at your option any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY. - - See the COPYING file for more details. -*/ - -#ifndef PORTRAIT_HPP_INCLUDED -#define PORTRAIT_HPP_INCLUDED - -class config; - -#include - -/** - * @todo this is a proof-of-concept version and undocumented. It should be - * documented later and also allow WML to modify the portraits. This all - * starts to make sense when the new dialogs become mainline. - */ - -/** Contains the definition of a portrait for a unit(type). */ -struct tportrait { - - tportrait(const config& cfg); - - enum tside { LEFT, RIGHT, BOTH }; - - std::string image; - tside side; - unsigned size; - bool mirror; -}; - -#endif diff --git a/src/unit.cpp b/src/unit.cpp index 587d24bca14..27326815e8e 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -2874,20 +2874,6 @@ std::string unit::image_mods() const{ return modifier.str(); } -const tportrait* unit::portrait( - const unsigned size, const tportrait::tside side) const -{ - foreach(const tportrait& portrait, (type()->portraits())) { - if(portrait.size == size - && (side == portrait.side || portrait.side == tportrait::BOTH)) { - - return &portrait; - } - } - - return NULL; -} - void unit::remove_attacks_ai() { if (attacks_left_ == max_attacks_) { diff --git a/src/unit.hpp b/src/unit.hpp index 7439d2db60a..532249a88d1 100644 --- a/src/unit.hpp +++ b/src/unit.hpp @@ -20,7 +20,6 @@ #include "config.hpp" #include "formula_callable.hpp" #include "map_location.hpp" -#include "portrait.hpp" #include "race.hpp" #include "unit_types.hpp" #include "unit_map.hpp" @@ -324,18 +323,6 @@ public: std::string TC_image_mods() const; std::string image_mods() const; - /** - * Gets the portrait for a unit. - * - * @param size The size of the portrait. - * @param side The side the portrait is shown on. - * - * @returns The portrait with the wanted size. - * @retval NULL The wanted portrait doesn't exist. - */ - const tportrait* portrait( - const unsigned size, const tportrait::tside side) const; - private: bool internal_matches_filter(const vconfig& cfg,const map_location& loc, diff --git a/src/unit_types.cpp b/src/unit_types.cpp index 8d95bdedd5f..d1f4e20d944 100644 --- a/src/unit_types.cpp +++ b/src/unit_types.cpp @@ -582,8 +582,7 @@ unit_type::unit_type() : possibleTraits_(), genders_(), animations_(), - build_status_(NOT_BUILT), - portraits_() + build_status_(NOT_BUILT) { gender_types_[0] = NULL; gender_types_[1] = NULL; @@ -625,8 +624,7 @@ unit_type::unit_type(const unit_type& o) : possibleTraits_(o.possibleTraits_), genders_(o.genders_), animations_(o.animations_), - build_status_(o.build_status_), - portraits_(o.portraits_) + build_status_(o.build_status_) { gender_types_[0] = o.gender_types_[0] != NULL ? new unit_type(*o.gender_types_[0]) : NULL; gender_types_[1] = o.gender_types_[1] != NULL ? new unit_type(*o.gender_types_[1]) : NULL; @@ -671,8 +669,7 @@ unit_type::unit_type(const config& cfg, const movement_type_map& mv_types, possibleTraits_(), genders_(), animations_(), - build_status_(NOT_BUILT), - portraits_() + build_status_(NOT_BUILT) { build_full(cfg, mv_types, races, traits); } @@ -779,11 +776,6 @@ void unit_type::build_full(const config& cfg, const movement_type_map& mv_types, flag_rgb_ = cfg["flag_rgb"]; game_config::add_color_info(cfg); - - foreach (const config &portrait, cfg_.child_range("portrait")) { - portraits_.push_back(tportrait(portrait)); - } - // Deprecation messages, only seen when unit is parsed for the first time. build_status_ = FULL; diff --git a/src/unit_types.hpp b/src/unit_types.hpp index 4153b55d5e1..b91735f85de 100644 --- a/src/unit_types.hpp +++ b/src/unit_types.hpp @@ -17,7 +17,6 @@ #include "unit_animation.hpp" #include "config.hpp" #include "map_location.hpp" -#include "portrait.hpp" #include "race.hpp" #include @@ -268,8 +267,6 @@ public: BUILD_STATUS build_status() const { return build_status_; } - const std::vector& portraits() const { return portraits_; } - const config &get_cfg() const { return cfg_; } void set_config(const config& cfg); @@ -326,9 +323,6 @@ private: mutable std::vector animations_; BUILD_STATUS build_status_; - - /** List with the portraits available for the unit. */ - std::vector portraits_; }; class unit_type_data