Skip to content

Commit b04d3df

Browse files
committed
build
1 parent bda7854 commit b04d3df

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

module/include/NoMercyGameModule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ enum NM_ERRORTYPES
3737
RESPONSE_IS_NULL = 4,
3838
RESPONSE_IS_NOT_VALID = 5,
3939
REQUIRE_RESTART = 6,
40+
UNALLOWED_LICENSE_TYPE = 7,
4041
};
4142

4243
enum NM_USERSTATUS
@@ -59,6 +60,7 @@ enum NM_MESSAGE_IDS
5960
{
6061
NM_MSG_NONE,
6162
NM_MSG_REQUIRE_RESTART,
63+
NM_MSG_UNALLOWED_LICENSE_TYPE
6264
};
6365

6466
struct NM_ErrorData

module/src/game_module_impl.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,20 @@ bool CNoMercyGameModule::__GetRequest(const std::string& body, std::string& resp
362362
m_pkLastError->error_code = 0;
363363
return true;
364364
}
365+
else if (res->body == "UNALLOWED_LICENSE_TYPE")
366+
{
367+
if (m_pMessageCallback)
368+
{
369+
m_pMessageCallback(NM_MESSAGE_IDS::NM_MSG_UNALLOWED_LICENSE_TYPE, nullptr);
370+
return true;
371+
}
372+
373+
this->__Log(NM_VERBOSETYPES::NM_VERBOSE_ERROR, "GET request to %s failed with special response: %s", c_stTarget.c_str(), res->body.c_str());
374+
375+
m_pkLastError->error_type = UNALLOWED_LICENSE_TYPE;
376+
m_pkLastError->error_code = 0;
377+
return false;
378+
}
365379

366380
if (!bSkipResponseCheck && !this->__StringIsNumber(res->body)) // Response format
367381
{
@@ -431,6 +445,20 @@ bool CNoMercyGameModule::__GetRequest(const std::string& body, std::string& resp
431445
m_pkLastError->error_code = 0;
432446
return true;
433447
}
448+
else if (res.text == "UNALLOWED_LICENSE_TYPE")
449+
{
450+
if (m_pMessageCallback)
451+
{
452+
m_pMessageCallback(NM_MESSAGE_IDS::NM_MSG_UNALLOWED_LICENSE_TYPE, nullptr);
453+
return true;
454+
}
455+
456+
this->__Log(NM_VERBOSETYPES::NM_VERBOSE_ERROR, "GET request to %s failed with special response: %s", c_stTarget.c_str(), res.text.c_str());
457+
458+
m_pkLastError->error_type = UNALLOWED_LICENSE_TYPE;
459+
m_pkLastError->error_code = 0;
460+
return false;
461+
}
434462

435463
if (!bSkipResponseCheck && !this->__StringIsNumber(res.text)) // Response format
436464
{

test/src/NoMercyServer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ void OnNomercyMessage(const uint8_t message, void* data)
194194
sys_log(0, "NMMessageCallback> Require restart message received!");
195195
CNoMercyServer::Instance().ReconnectToNoMercyServer();
196196
break;
197+
case NM_MSG_UNALLOWED_LICENSE_TYPE:
198+
sys_err("NMMessageCallback> Unallowed license type message received!");
199+
std::exit(1);
200+
break;
197201
default:
198202
sys_err("NMMessageCallback> Unknown message received: %d", message);
199203
break;

0 commit comments

Comments
 (0)