Merge remote-tracking branch 'dfhack/develop' into travis

develop
expwnent 2015-09-21 19:04:31 -04:00
commit 8c4fb7668d
2 changed files with 20 additions and 26 deletions

@ -1862,7 +1862,7 @@ size_t loadScriptFiles(Core* core, color_ostream& out, const vector<std::string>
size_t result = 0;
for ( size_t a = 0; a < scriptFiles.size(); a++ ) {
result++;
core->loadScriptFile(out, folder + scriptFiles[a], true);
core->loadScriptFile(out, folder + "/" + scriptFiles[a], true);
}
return result;
}
@ -1880,15 +1880,15 @@ namespace DFHack {
va_start(list,none);
EntryVector result;
while(true) {
Key key = va_arg(list,Key);
if ( key < 0 )
Key key = (Key)va_arg(list,int);
if ( key == SC_UNKNOWN )
break;
Val val;
while (true) {
string v = va_arg(list,string);
if ( v.empty() )
const char *v = va_arg(list, const char *);
if (!v || !v[0])
break;
val.push_back(v);
val.push_back(string(v));
}
result.push_back(Entry(key,val));
}
@ -1904,29 +1904,23 @@ namespace DFHack {
void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event event) {
static const X::InitVariationTable table = X::getTable(X::computeInitVariationTable(0,
SC_WORLD_LOADED, (string)"onLoad", (string)"onLoadWorld", (string)"onWorldLoaded", (string)"",
SC_WORLD_UNLOADED, (string)"onUnload", (string)"onUnloadWorld", (string)"onWorldUnloaded", (string)"",
SC_MAP_LOADED, (string)"onMapLoad", (string)"onLoadMap", (string)"",
SC_MAP_UNLOADED, (string)"onMapUnload", (string)"onUnloadMap", (string)"",
(X::Key)(-1)
(int)SC_WORLD_LOADED, "onLoad", "onLoadWorld", "onWorldLoaded", "",
(int)SC_WORLD_UNLOADED, "onUnload", "onUnloadWorld", "onWorldUnloaded", "",
(int)SC_MAP_LOADED, "onMapLoad", "onLoadMap", "",
(int)SC_MAP_UNLOADED, "onMapUnload", "onUnloadMap", "",
(int)SC_UNKNOWN
));
if (!df::global::world)
return;
//TODO: use different separators for windows
#ifdef _WIN32
static const std::string separator = "\\";
#else
static const std::string separator = "/";
#endif
std::string rawFolder = "data" + separator + "save" + separator + (df::global::world->cur_savegame.save_dir) + separator + "raw" + separator;
std::string rawFolder = "data/save/" + (df::global::world->cur_savegame.save_dir) + "/raw/";
auto i = table.find(event);
if ( i != table.end() ) {
const std::vector<std::string>& set = i->second;
loadScriptFiles(this, out, set, "." );
loadScriptFiles(this, out, set, rawFolder);
loadScriptFiles(this, out, set, rawFolder + "objects" + separator);
loadScriptFiles(this, out, set, rawFolder + "objects/");
}
for (auto it = state_change_scripts.begin(); it != state_change_scripts.end(); ++it)

@ -19,8 +19,8 @@ try:
res = json.loads(urlopen('https://api.github.com/repos/%s/pulls/%i' % (repo, pr_id)).read().decode('utf-8'))
except ValueError:
pass
except HTTPError:
print('Failed to retrieve PR information from API')
except HTTPError as e:
print('Failed to retrieve PR information from API: %s' % e)
sys.exit(2)
if 'base' not in res or 'ref' not in res['base']:
print('Invalid JSON returned from API')