Follow up to be9babe
Exporting the random option ids back into the script engine, since they might be useful to some custom scripts.
This commit is contained in:
parent
3d25f36e2a
commit
c924b90b2b
@ -2333,6 +2333,27 @@ uint64 RandomOptionDatabase::parseBodyNode(const YAML::Node &node) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RandomOptionDatabase::loadingFinished(){
|
||||||
|
const char* prefix = "RDMOPT_";
|
||||||
|
|
||||||
|
for( const auto& pair : *this ){
|
||||||
|
std::string name = prefix + pair.second->name;
|
||||||
|
int64 constant;
|
||||||
|
|
||||||
|
// Check if it has already been set
|
||||||
|
if( script_get_constant( name.c_str(), &constant ) ){
|
||||||
|
// It is already the same
|
||||||
|
if( constant == pair.first ){
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
// Export it to the script engine -> will issue a warning
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
script_set_constant( name.c_str(), pair.first, false, false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RandomOptionDatabase random_option_db;
|
RandomOptionDatabase random_option_db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -955,6 +955,7 @@ public:
|
|||||||
|
|
||||||
const std::string getDefaultLocation();
|
const std::string getDefaultLocation();
|
||||||
uint64 parseBodyNode(const YAML::Node &node);
|
uint64 parseBodyNode(const YAML::Node &node);
|
||||||
|
void loadingFinished();
|
||||||
|
|
||||||
// Additional
|
// Additional
|
||||||
bool option_exists(std::string name);
|
bool option_exists(std::string name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user