Removed unused class tportrait.

This commit is contained in:
Guillaume Melquiond 2010-03-28 13:27:17 +00:00
parent 6b5ed37c28
commit 00d7c314af
10 changed files with 3 additions and 159 deletions

View File

@ -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

View File

@ -232,7 +232,6 @@ wesnoth_source = \
playmp_controller.cpp \
playsingle_controller.cpp \
playturn.cpp \
portrait.cpp \
replay.cpp \
replay_controller.cpp \
resources.cpp \

View File

@ -224,7 +224,6 @@ wesnoth_sources = Split("""
playmp_controller.cpp
playsingle_controller.cpp
playturn.cpp
portrait.cpp
replay.cpp
replay_controller.cpp
resources.cpp

View File

@ -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

View File

@ -1,49 +0,0 @@
/* $Id$ */
/*
Copyright (C) 2008 - 2010 by mark de wever <koraq@xs4all.nl>
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<unsigned>(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"));
}

View File

@ -1,41 +0,0 @@
/* $Id$ */
/*
Copyright (C) 2008 - 2010 by mark de wever <koraq@xs4all.nl>
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 <string>
/**
* @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

View File

@ -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_) {

View File

@ -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,

View File

@ -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;

View File

@ -17,7 +17,6 @@
#include "unit_animation.hpp"
#include "config.hpp"
#include "map_location.hpp"
#include "portrait.hpp"
#include "race.hpp"
#include <set>
@ -268,8 +267,6 @@ public:
BUILD_STATUS build_status() const { return build_status_; }
const std::vector<tportrait>& 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<unit_animation> animations_;
BUILD_STATUS build_status_;
/** List with the portraits available for the unit. */
std::vector<tportrait> portraits_;
};
class unit_type_data