fixed crash in wesnothd
This commit is contained in:
parent
1d76a328fb
commit
26ac82e7f6
1 changed files with 18 additions and 2 deletions
|
@ -1,6 +1,22 @@
|
|||
#include "../game_events.hpp"
|
||||
|
||||
namespace game_events {
|
||||
const std::string& get_variable_const(const std::string& str) { return str; }
|
||||
//this is an 'identity' implementation of variables, that just returns the name
|
||||
//of the variable itself. To be used in systems for which variables shouldn't be implemented
|
||||
namespace {
|
||||
std::map<std::string,std::string> variables;
|
||||
|
||||
}
|
||||
|
||||
namespace game_events {
|
||||
const std::string& get_variable_const(const std::string& str)
|
||||
{
|
||||
const std::map<std::string,std::string>::const_iterator itor = variables.find(str);
|
||||
if(itor != variables.end()) {
|
||||
return itor->second;
|
||||
} else {
|
||||
variables[str] = "$" + str;
|
||||
return get_variable_const(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue