}
#include <boost/spirit/include/qi_symbols.hpp>
+#include <boost/algorithm/string/trim.hpp>
#include <algorithm>
#include <fstream>
LEVEL_LINE_COUNT = 14
};
-#define PATH_PREFIX "../badge/jumpnrun/"
+#define PATH_PREFIX "../badge/jumpnrun/levels/"
namespace jnrcpp {
struct descriptors {
struct level_name_map {
level_name_map() {
- std::ifstream in(PATH_PREFIX "levels.txt");
+ std::ifstream in("levels.txt");
if(!in) {
- throw std::logic_error(PATH_PREFIX "levels.txt konnte nicht geöffnet werden.");
+ throw std::logic_error("levels.txt konnte nicht geöffnet werden.");
}
std::string name;
while(std::getline(in, name)) {
- if(name != "") {
+ if(boost::trim_copy(name) != "") {
names.push_back(name);
}
}
} else {
throw std::invalid_argument("Unkown type: " + line);
}
- } else if(line != "") {
+ } else if(boost::trim_right_copy(line) != "") {
char c;
std::string tok;
std::istringstream parser(line);