Various bugfixes

* Fixed Nano stamina not being halved on respawn
* Reverted the default argument to terminate() change because MSVC is
undable to disambiguate the function pointer passed to sigaction()
* Fatal errors during init (like in TableData) can just call exit(1)
directly anyway (missing "OpenFusion: terminated." be damned)
* Switched to a slightly more portable syntax for getting the version
in the Makefile
* We shouldn't join the shard thread in the signal handler because the
thread the signal handler ends up running in is undefined behaviour and
we don't strictly need to join it anyway

Many of these issues were discovered on OpenBSD.
This commit is contained in:
2020-12-06 05:25:23 +01:00
parent 02c5df5c1b
commit 8ebabac7c0
7 changed files with 19 additions and 19 deletions

View File

@@ -54,7 +54,7 @@ void TableData::init() {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed NPCs.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
// load everything else from xdttable
@@ -230,7 +230,7 @@ void TableData::init() {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed xdt.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
// load temporary mob dump
@@ -303,7 +303,7 @@ void TableData::init() {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed mobs.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
loadDrops();
@@ -373,7 +373,7 @@ void TableData::loadPaths(int* nextId) {
if (firstPoint["iX"] != pair.second->spawnX || firstPoint["iY"] != pair.second->spawnY) {
std::cout << "[FATAL] The first point of the route for mob " << pair.first <<
" (type " << pair.second->appearanceData.iNPCType << ") does not correspond with its spawn point." << std::endl;
terminate();
exit(1);
}
constructPathNPC(npcPath, pair.first);
@@ -386,7 +386,7 @@ void TableData::loadPaths(int* nextId) {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed paths.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
}
@@ -497,7 +497,7 @@ void TableData::loadDrops() {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed drops.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
}
@@ -539,7 +539,7 @@ void TableData::loadEggs(int32_t* nextId) {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed eggs.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
}
@@ -763,7 +763,7 @@ void TableData::loadGruntwork(int32_t *nextId) {
}
catch (const std::exception& err) {
std::cerr << "[FATAL] Malformed gruntwork.json file! Reason:" << err.what() << std::endl;
terminate();
exit(1);
}
}