Author: sapient
Date: Wed Mar 5 05:59:05 2008
New Revision: 24321
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24321&view=rev
Log:
get another one working for my outdated compiler
Modified:
trunk/src/variant.cpp
Modified: trunk/src/variant.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variant.cpp?rev=24321&r1=24320&r2=24321&view=diff
==============================================================================
--- trunk/src/variant.cpp (original)
+++ trunk/src/variant.cpp Wed Mar 5 05:59:05 2008
@@ -1,13 +1,14 @@
+#include "global.hpp"
+
#include <cmath>
#include <set>
#include <stdlib.h>
#include <vector>
-
#include <iostream>
#include "boost/lexical_cast.hpp"
-#include "foreach.hpp"
+//#include "foreach.hpp"
#include "formatter.hpp"
#include "formula.hpp"
#include "formula_callable.hpp"
@@ -16,13 +17,19 @@
namespace {
std::string variant_type_to_string(variant::TYPE type) {
switch(type) {
- case variant::TYPE_NULL: return "null";
- case variant::TYPE_INT: return "int";
- case variant::TYPE_CALLABLE: return "object";
- case variant::TYPE_LIST: return "list";
- case variant::TYPE_STRING: return "string";
+ case variant::TYPE_NULL:
+ return "null";
+ case variant::TYPE_INT:
+ return "int";
+ case variant::TYPE_CALLABLE:
+ return "object";
+ case variant::TYPE_LIST:
+ return "list";
+ case variant::TYPE_STRING:
+ return "string";
default:
- assert(false);
+ assert(false);
+ return "invalid";
}
}
@@ -198,7 +205,8 @@
case TYPE_STRING:
return !string_->str.empty();
default:
- assert(false);
+ assert(false);
+ return false;
}
}
@@ -215,11 +223,13 @@
if(v.type_ == TYPE_LIST) {
std::vector<variant> res;
res.reserve(list_->elements.size() +
v.list_->elements.size());
- foreach(const variant& var, list_->elements) {
+ for(int i = 0; i<list_->elements.size(); ++i) {
+ const variant& var = list_->elements[i];
res.push_back(var);
}
- foreach(const variant& var, v.list_->elements) {
+ for(int j = 0; j<v.list_->elements.size(); ++j) {
+ const variant& var = v.list_->elements[j];
res.push_back(var);
}
@@ -310,7 +320,8 @@
}
}
- assert(false);
+ assert(false);
+ return false;
}
bool variant::operator!=(const variant& v) const
@@ -366,7 +377,8 @@
}
}
- assert(false);
+ assert(false);
+ return false;
}
bool variant::operator>=(const variant& v) const
@@ -405,7 +417,8 @@
case TYPE_LIST: {
str += "[";
bool first_time = true;
- foreach(const variant& var, list_->elements) {
+ for(int i=0; i<list_->elements.size(); ++i) {
+ const variant& var = list_->elements[i];
if(!first_time) {
str += ",";
}
@@ -458,7 +471,8 @@
return "(object)";
case TYPE_LIST: {
std::string res = "";
- foreach(const variant& var, list_->elements) {
+ for(int i=0; i<list_->elements.size(); ++i) {
+ const variant& var = list_->elements[i];
if(!res.empty()) {
res += ", ";
}
@@ -472,7 +486,8 @@
case TYPE_STRING:
return string_->str;
default:
- assert(false);
+ assert(false);
+ return "invalid";
}
}
@@ -508,7 +523,8 @@
seen->push_back(callable_);
std::vector<game_logic::formula_input> v =
callable_->inputs();
bool first = true;
- foreach(const game_logic::formula_input& input, v) {
+ for(int i=0; i<v.size(); ++i) {
+ const game_logic::formula_input& input = v[i];
if(!first) {
s << ", ";
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits