diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp
index 5cce039bd398..edb1dbb9d70e 100644
--- a/projectfiles/CodeBlocks/wesnoth.cbp
+++ b/projectfiles/CodeBlocks/wesnoth.cbp
@@ -820,7 +820,6 @@
-
diff --git a/projectfiles/VC9/wesnoth.vcproj b/projectfiles/VC9/wesnoth.vcproj
index 380ca3f4129a..e811f9ceeda8 100644
--- a/projectfiles/VC9/wesnoth.vcproj
+++ b/projectfiles/VC9/wesnoth.vcproj
@@ -24339,10 +24339,6 @@
RelativePath="..\..\src\util.hpp"
>
-
-
diff --git a/projectfiles/Xcode/Wesnoth.xcodeproj/project.pbxproj b/projectfiles/Xcode/Wesnoth.xcodeproj/project.pbxproj
index 260fb442e442..62a6b0614c80 100644
--- a/projectfiles/Xcode/Wesnoth.xcodeproj/project.pbxproj
+++ b/projectfiles/Xcode/Wesnoth.xcodeproj/project.pbxproj
@@ -1684,7 +1684,6 @@
B55999F00EC62181008DD061 /* md5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = md5.cpp; path = ../src/md5.cpp; sourceTree = ""; };
B55999F10EC62181008DD061 /* marked-up_text.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = "marked-up_text.hpp"; path = "../src/marked-up_text.hpp"; sourceTree = ""; };
B55999F20EC62181008DD061 /* marked-up_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "marked-up_text.cpp"; path = "../src/marked-up_text.cpp"; sourceTree = ""; };
- B55999F70EC62181008DD061 /* utils.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = utils.hpp; sourceTree = ""; };
B55999F80EC62181008DD061 /* location.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = location.hpp; sourceTree = ""; };
B55999F90EC62181008DD061 /* location.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = location.cpp; sourceTree = ""; };
B55999FA0EC62181008DD061 /* label.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = label.hpp; sourceTree = ""; };
@@ -3344,7 +3343,6 @@
B55999F80EC62181008DD061 /* location.hpp */,
B5599A000EC62181008DD061 /* map.cpp */,
B55999FF0EC62181008DD061 /* map.hpp */,
- B55999F70EC62181008DD061 /* utils.hpp */,
);
path = map;
sourceTree = "";
diff --git a/src/formula/formula.cpp b/src/formula/formula.cpp
index c53e3be10891..5ca421dafb05 100644
--- a/src/formula/formula.cpp
+++ b/src/formula/formula.cpp
@@ -18,7 +18,6 @@
#include "formula/callable.hpp"
#include "formula/function.hpp"
-#include "map/utils.hpp"
#include "random_new.hpp"
#include "serialization/string_utils.hpp"
@@ -48,8 +47,14 @@ map_formula_callable& map_formula_callable::add(const std::string& key,
variant map_formula_callable::get_value(const std::string& key) const
{
- return map_get_value_default(values_, key,
- fallback_ ? fallback_->query_value(key) : variant());
+ std::map::const_iterator it = values_.find(key);
+ if(it != values_.end()) {
+ return it->second;
+ } else if(fallback_) {
+ return fallback_->query_value(key);
+ } else {
+ return variant();
+ }
}
void map_formula_callable::get_inputs(std::vector* inputs) const
diff --git a/src/gui/auxiliary/filter.hpp b/src/gui/auxiliary/filter.hpp
index 45d52e15fa48..bff261cd9977 100644
--- a/src/gui/auxiliary/filter.hpp
+++ b/src/gui/auxiliary/filter.hpp
@@ -20,11 +20,14 @@
#ifndef GUI_AUXILIARY_FILTER_HPP_INCLUDED
#define GUI_AUXILIARY_FILTER_HPP_INCLUDED
+#include "global.hpp"
#include "gui/widgets/text_box.hpp"
-#include "map/utils.hpp"
#include "util.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/unicode.hpp"
+#ifndef HAVE_CXX11
+#include // needed for the at() emulation
+#endif
namespace gui2
{
@@ -35,13 +38,26 @@ inline bool sort(const tpane::titem& lhs,
const std::string& tag,
const bool ascending)
{
+#ifdef HAVE_CXX11
+ if(ascending) {
+ return lexical_cast(lhs.tags.at(tag))
+ < lexical_cast(rhs.tags.at(tag));
+ } else {
+ return lexical_cast(lhs.tags.at(tag))
+ > lexical_cast(rhs.tags.at(tag));
+ }
+#else
+ typedef std::map::const_iterator iterator;
+ iterator lhs_it = lhs.tags.find(tag), rhs_it = rhs.tags.find(tag);
+ if(lhs_it == lhs.tags.end() || rhs_it == rhs.tags.end()) {
+ throw std::out_of_range("Key »" + tag + "« doesn't exist.");
+ }
if(ascending) {
- return lexical_cast(at(lhs.tags, tag))
- < lexical_cast(at(rhs.tags, tag));
+ return lexical_cast(*lhs_it) < lexical_cast(*rhs_it);
} else {
- return lexical_cast(at(lhs.tags, tag))
- > lexical_cast(at(rhs.tags, tag));
+ return lexical_cast(*lhs_it) > lexical_cast(*rhs_it);
}
+#endif
}
/**
@@ -67,8 +83,16 @@ inline bool contains(const tpane::titem& item,
const std::string& tag,
const ttext_box& text_box)
{
- return at(item.tags, tag).find(utf8::lowercase(text_box.text()))
+#ifdef HAVE_CXX11
+ return item.tags.at(tag).find(utf8::lowercase(text_box.text()))
!= std::string::npos;
+#else
+ std::map::const_iterator it = item.tags.find(tag);
+ if(it == item.tags.end()) {
+ throw std::out_of_range("Key »" + tag + "« doesn't exist.");
+ }
+ return it->second.find(utf8::lowercase(text_box.text())) != std::string::npos;
+#endif
}
} // namespace gui2
diff --git a/src/map/utils.hpp b/src/map/utils.hpp
deleted file mode 100644
index 1f2d176232db..000000000000
--- a/src/map/utils.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- Copyright (C) 2007 - 2016 by David White
- Part of the Silver Tree Project
-
- 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 or later.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY.
-
- See the COPYING file for more details.
-*/
-
-#ifndef MAP_UTILS_HPP_INCLUDED
-#define MAP_UTILS_HPP_INCLUDED
-
-#include