Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
mq1n committed May 28, 2024
1 parent bda7854 commit b04d3df
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/include/NoMercyGameModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum NM_ERRORTYPES
RESPONSE_IS_NULL = 4,
RESPONSE_IS_NOT_VALID = 5,
REQUIRE_RESTART = 6,
UNALLOWED_LICENSE_TYPE = 7,
};

enum NM_USERSTATUS
Expand All @@ -59,6 +60,7 @@ enum NM_MESSAGE_IDS
{
NM_MSG_NONE,
NM_MSG_REQUIRE_RESTART,
NM_MSG_UNALLOWED_LICENSE_TYPE
};

struct NM_ErrorData
Expand Down
28 changes: 28 additions & 0 deletions module/src/game_module_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,20 @@ bool CNoMercyGameModule::__GetRequest(const std::string& body, std::string& resp
m_pkLastError->error_code = 0;
return true;
}
else if (res->body == "UNALLOWED_LICENSE_TYPE")
{
if (m_pMessageCallback)
{
m_pMessageCallback(NM_MESSAGE_IDS::NM_MSG_UNALLOWED_LICENSE_TYPE, nullptr);
return true;
}

this->__Log(NM_VERBOSETYPES::NM_VERBOSE_ERROR, "GET request to %s failed with special response: %s", c_stTarget.c_str(), res->body.c_str());

m_pkLastError->error_type = UNALLOWED_LICENSE_TYPE;
m_pkLastError->error_code = 0;
return false;
}

if (!bSkipResponseCheck && !this->__StringIsNumber(res->body)) // Response format
{
Expand Down Expand Up @@ -431,6 +445,20 @@ bool CNoMercyGameModule::__GetRequest(const std::string& body, std::string& resp
m_pkLastError->error_code = 0;
return true;
}
else if (res.text == "UNALLOWED_LICENSE_TYPE")
{
if (m_pMessageCallback)
{
m_pMessageCallback(NM_MESSAGE_IDS::NM_MSG_UNALLOWED_LICENSE_TYPE, nullptr);
return true;
}

this->__Log(NM_VERBOSETYPES::NM_VERBOSE_ERROR, "GET request to %s failed with special response: %s", c_stTarget.c_str(), res.text.c_str());

m_pkLastError->error_type = UNALLOWED_LICENSE_TYPE;
m_pkLastError->error_code = 0;
return false;
}

if (!bSkipResponseCheck && !this->__StringIsNumber(res.text)) // Response format
{
Expand Down
4 changes: 4 additions & 0 deletions test/src/NoMercyServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ void OnNomercyMessage(const uint8_t message, void* data)
sys_log(0, "NMMessageCallback> Require restart message received!");
CNoMercyServer::Instance().ReconnectToNoMercyServer();
break;
case NM_MSG_UNALLOWED_LICENSE_TYPE:
sys_err("NMMessageCallback> Unallowed license type message received!");
std::exit(1);
break;
default:
sys_err("NMMessageCallback> Unknown message received: %d", message);
break;
Expand Down

0 comments on commit b04d3df

Please sign in to comment.