Reverted 2010-11-02T20:32:09Z!koraq@xs4all.nl,

...since the code has never been used for the last two years (since
July 2008).
This commit is contained in:
Guillaume Melquiond 2010-11-03 07:19:44 +00:00
parent 268c64a31f
commit c8f04bc63e
9 changed files with 2 additions and 135 deletions

View file

@ -483,7 +483,6 @@ set(wesnoth-main_SRC
playmp_controller.cpp
playsingle_controller.cpp
playturn.cpp
portrait.cpp
replay.cpp
replay_controller.cpp
resources.cpp

View file

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

View file

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

View file

@ -1,50 +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 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 "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,42 +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 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 <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

@ -2883,20 +2883,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

@ -321,18 +321,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:
void advance_to(const config &old_cfg, const unit_type *t,
bool use_traits, game_state *state);

View file

@ -584,8 +584,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;
@ -630,8 +629,7 @@ unit_type::unit_type(config &cfg) :
possibleTraits_(),
genders_(),
animations_(),
build_status_(NOT_BUILT),
portraits_()
build_status_(NOT_BUILT)
{
gender_types_[0] = NULL;
gender_types_[1] = NULL;
@ -739,10 +737,6 @@ void unit_type::build_full(const movement_type_map &mv_types,
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

@ -16,7 +16,6 @@
#define UNIT_TYPES_H_INCLUDED
#include "unit_animation.hpp"
#include "portrait.hpp"
#include "race.hpp"
class gamemap;
@ -284,8 +283,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_; }
private:
@ -341,9 +338,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