Skip to content

Commit

Permalink
Merge pull request #69 from Liareth/initial-version-check
Browse files Browse the repository at this point in the history
Move the initial version check to the constructor.
  • Loading branch information
Liareth authored Mar 17, 2018
2 parents 2fb68e3 + 20098a3 commit 133eaab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Core/NWNXCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ NWNXCore::NWNXCore()
{
g_core = this;

InitialVersionCheck();

// This sets up the base address for every hook and patch to follow.
Platform::ASLR::CalculateBaseAddress();

Expand Down Expand Up @@ -157,12 +159,16 @@ void NWNXCore::InitialVersionCheck()

if (version != NWNX_TARGET_NWN_BUILD)
{
throw std::runtime_error("Core version mismatch -- has the server updated?");
std::fprintf(stderr, "NWNX: Expected build version %u, got build version %u", NWNX_TARGET_NWN_BUILD, version);
std::fflush(stderr);
std::abort();
}
}
else
{
throw std::runtime_error("Unable to resolve GetBuildNumber from the NWN binary. Old version?");
std::fprintf(stderr, "NWNX: Could not determine build version.");
std::fflush(stderr);
std::abort();
}
}

Expand Down Expand Up @@ -338,7 +344,6 @@ void NWNXCore::CreateServerHandler(API::CAppManager* app)
try
{
g_core->InitialSetupHooks();
g_core->InitialVersionCheck();
g_core->InitialSetupPlugins();
}
catch (const std::runtime_error& ex)
Expand Down

0 comments on commit 133eaab

Please sign in to comment.