Author: silene
Date: Sun Apr 5 20:03:14 2009
New Revision: 34560
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34560&view=rev
Log:
Removed almost unused and redundant functions.
Modified:
trunk/src/config.cpp
trunk/src/config.hpp
trunk/src/unit.cpp
trunk/src/variable.cpp
Modified: trunk/src/config.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/config.cpp?rev=34560&r1=34559&r2=34560&view=diff
==============================================================================
--- trunk/src/config.cpp (original)
+++ trunk/src/config.cpp Sun Apr 5 20:03:14 2009
@@ -319,7 +319,7 @@
config* found_config = NULL;
std::vector<child_pos>::iterator erase_pos, j, j_end =
ordered_children.end();
for(j = ordered_children.begin(); j != j_end; ++j) {
- if(i.get_key() == j->pos->first) {
+ if (i->key == j->pos->first) {
if(i.get_index() == j->index) {
erase_pos = j;
found_config = *(j->pos->second.begin() +
j->index);
@@ -329,12 +329,8 @@
}
}
}
- child_list& vec = children[i.get_key()];
- if(!found_config || erase_pos->index >= vec.size()) {
- ERR_CF << "Error: attempting to delete non-existing child: "
- << i.get_key() << "[" << i.get_index() << "]\n";
- return ordered_end();
- }
+ child_list& vec = children[i->key];
+ assert(found_config && erase_pos->index < vec.size());
delete found_config;
vec.erase(vec.begin()+i.get_index());
return all_children_iterator(ordered_children.erase(erase_pos));
@@ -550,16 +546,6 @@
return any_child(&i_->pos->first, i_->pos->second[i_->index]);
}
-const std::string& config::all_children_iterator::get_key() const
-{
- return i_->pos->first;
-}
-
-const config& config::all_children_iterator::get_child() const
-{
- return *(i_->pos->second[i_->index]);
-}
-
size_t config::all_children_iterator::get_index() const
{
return i_->index;
Modified: trunk/src/config.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/config.hpp?rev=34560&r1=34559&r2=34560&view=diff
==============================================================================
--- trunk/src/config.hpp (original)
+++ trunk/src/config.hpp Sun Apr 5 20:03:14 2009
@@ -281,9 +281,7 @@
any_child operator*() const;
arrow_helper operator->() const { return *this; }
- const std::string& get_key() const;
size_t get_index() const;
- const config& get_child() const;
bool operator==(const all_children_iterator &i) const { return
i_ == i.i_; }
bool operator!=(const all_children_iterator &i) const { return
i_ != i.i_; }
Modified: trunk/src/unit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=34560&r1=34559&r2=34560&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sun Apr 5 20:03:14 2009
@@ -993,8 +993,8 @@
if (config &abil = cfg_.child("abilities"))
{
config::all_children_iterator i = abil.ordered_begin();
- while(i != abil.ordered_end()) {
- if(i.get_child()["id"] == ability) {
+ while (i != abil.ordered_end()) {
+ if (i->cfg["id"] == ability) {
i = abil.erase(i);
} else {
++i;
Modified: trunk/src/variable.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.cpp?rev=34560&r1=34559&r2=34560&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Sun Apr 5 20:03:14 2009
@@ -365,8 +365,9 @@
vconfig::all_children_iterator& vconfig::all_children_iterator::operator++()
{
- if(i_.get_key() == "insert_tag") {
- variable_info vinfo(vconfig(i_.get_child())["variable"], false,
variable_info::TYPE_CONTAINER);
+ if (i_->key == "insert_tag")
+ {
+ variable_info vinfo(vconfig(i_->cfg)["variable"], false,
variable_info::TYPE_CONTAINER);
if(vinfo.is_valid && !vinfo.explicit_index) {
variable_info::array_range range = vinfo.as_array();
if(range.first != range.second && range.first +
(++inner_index_) != range.second) {
@@ -399,18 +400,19 @@
std::string vconfig::all_children_iterator::get_key() const
{
- const std::string& key = i_.get_key();
- if(key == "insert_tag") {
- return vconfig(i_.get_child())["name"];
+ const std::string &key = i_->key;
+ if (key == "insert_tag") {
+ return vconfig(i_->cfg)["name"];
}
return key;
}
const vconfig vconfig::all_children_iterator::get_child() const
{
- if(i_.get_key() == "insert_tag") {
+ if (i_->key == "insert_tag")
+ {
config * cp;
- variable_info vinfo(vconfig(i_.get_child())["variable"], false,
variable_info::TYPE_CONTAINER);
+ variable_info vinfo(vconfig(i_->cfg)["variable"], false,
variable_info::TYPE_CONTAINER);
if(!vinfo.is_valid) {
return vconfig(empty_config);
} else if(inner_index_ == 0) {
@@ -420,7 +422,7 @@
cp = *(vinfo.as_array().first + inner_index_);
return vconfig(cp, cp);
}
- return vconfig(&i_.get_child(), cache_key_);
+ return vconfig(&i_->cfg, cache_key_);
}
size_t vconfig::all_children_iterator::get_index() const
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits