From 33a04c32e235efaf6000e8de787a9f50eee20474 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Mon, 21 Mar 2016 03:47:13 +1100 Subject: [PATCH] Removed old code for [portrait] This was an experimental feature that was never finished. Any [portrait] tags were removed from the unit type WML a while back --- projectfiles/CodeBlocks/wesnoth.cbp | 2 -- src/CMakeLists.txt | 1 - src/SConscript | 1 - src/portrait.cpp | 48 ----------------------------- src/portrait.hpp | 41 ------------------------ src/unit_types.cpp | 11 ++----- src/unit_types.hpp | 6 ---- 7 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 src/portrait.cpp delete mode 100644 src/portrait.hpp diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 34cd04869324..b864e9ca50a1 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -985,8 +985,6 @@ - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d59a2a01f284..6be4744665dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -975,7 +975,6 @@ set(wesnoth-main_SRC playsingle_controller.cpp playturn.cpp playturn_network_adapter.cpp - portrait.cpp random_new.cpp random_new_deterministic.cpp random_new_synced.cpp diff --git a/src/SConscript b/src/SConscript index af98b4212529..3c10070a13ab 100644 --- a/src/SConscript +++ b/src/SConscript @@ -555,7 +555,6 @@ wesnoth_sources = Split(""" playsingle_controller.cpp playturn.cpp playturn_network_adapter.cpp - portrait.cpp random_new.cpp random_new_deterministic.cpp random_new_synced.cpp diff --git a/src/portrait.cpp b/src/portrait.cpp deleted file mode 100644 index 096798810bf7..000000000000 --- a/src/portrait.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2008 - 2016 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 as published by - the Free Software Foundation; either version 2 of the License, 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 "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." << std::endl; - return tportrait::LEFT; - } -} - -tportrait::tportrait(const config& cfg) : - image(cfg["image"]), - side(get_side(cfg["side"])), - size(cfg["size"].to_unsigned()), - mirror(cfg["mirror"].to_bool()) -{ - 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 6a468c8835d6..000000000000 --- a/src/portrait.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2008 - 2016 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 as published by - the Free Software Foundation; either version 2 of the License, 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_types.cpp b/src/unit_types.cpp index b4ffa83c1625..5bc3affeb96e 100644 --- a/src/unit_types.cpp +++ b/src/unit_types.cpp @@ -27,7 +27,6 @@ #include "loadscreen.hpp" #include "log.hpp" #include "make_enum.hpp" -#include "portrait.hpp" #include "unit.hpp" #include "unit_abilities.hpp" #include "unit_animation.hpp" @@ -99,8 +98,7 @@ unit_type::unit_type(const unit_type& o) : possible_traits_(o.possible_traits_), 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; @@ -159,8 +157,7 @@ unit_type::unit_type(const config &cfg, const std::string & parent_id) : possible_traits_(), genders_(), animations_(), - build_status_(NOT_BUILT), - portraits_() + build_status_(NOT_BUILT) { gender_types_[0] = NULL; gender_types_[1] = NULL; @@ -227,10 +224,6 @@ void unit_type::build_full(const movement_type_map &mv_types, game_config::add_color_info(cfg_); - BOOST_FOREACH(const config &portrait, cfg_.child_range("portrait")) { - portraits_.push_back(tportrait(portrait)); - } - hp_bar_scaling_ = cfg_["hp_bar_scaling"].to_double(game_config::hp_bar_scaling); xp_bar_scaling_ = cfg_["xp_bar_scaling"].to_double(game_config::xp_bar_scaling); diff --git a/src/unit_types.hpp b/src/unit_types.hpp index 9f4da2f4ba07..fc7a4ac2e7b9 100644 --- a/src/unit_types.hpp +++ b/src/unit_types.hpp @@ -28,7 +28,6 @@ #include #include -struct tportrait; class unit_ability_list; class unit_animation; @@ -210,8 +209,6 @@ class unit_type bool hide_help() const; bool do_not_list() const { return do_not_list_; } - const std::vector& portraits() const { return portraits_; } - const config &get_cfg() const { return cfg_; } /// Returns a trimmed config suitable for use with units. const config & get_cfg_for_units() const @@ -293,9 +290,6 @@ class unit_type mutable std::vector animations_; BUILD_STATUS build_status_; - - /** List with the portraits available for the unit. */ - std::vector portraits_; }; class unit_type_data