From 52f3f5795fa516862c0a4030df8d43f4c0cbda65 Mon Sep 17 00:00:00 2001 From: Emma Miler <27428383+emma-miler@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:51:56 +0200 Subject: Update plugins.cpp (#124) --- NorthstarDedicatedTest/plugins.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/NorthstarDedicatedTest/plugins.cpp b/NorthstarDedicatedTest/plugins.cpp index b725a5a8..62d781bb 100644 --- a/NorthstarDedicatedTest/plugins.cpp +++ b/NorthstarDedicatedTest/plugins.cpp @@ -128,11 +128,12 @@ SQRESULT SQ_UpdateGameStateClient(void* sqvm) AcquireSRWLockExclusive(&gameStateLock); AcquireSRWLockExclusive(&serverInfoLock); gameState.players = ClientSq_getinteger(sqvm, 1); - gameState.ourScore = ClientSq_getinteger(sqvm, 2); - gameState.secondHighestScore = ClientSq_getinteger(sqvm, 3); - gameState.highestScore = ClientSq_getinteger(sqvm, 4); - serverInfo.roundBased = ClientSq_getbool(sqvm, 5); - serverInfo.scoreLimit = ClientSq_getbool(sqvm, 6); + serverInfo.maxPlayers = ClientSq_getinteger(sqvm, 2); + gameState.ourScore = ClientSq_getinteger(sqvm, 3); + gameState.secondHighestScore = ClientSq_getinteger(sqvm, 4); + gameState.highestScore = ClientSq_getinteger(sqvm, 5); + serverInfo.roundBased = ClientSq_getbool(sqvm, 6); + serverInfo.scoreLimit = ClientSq_getbool(sqvm, 7); ReleaseSRWLockExclusive(&gameStateLock); ReleaseSRWLockExclusive(&serverInfoLock); return SQRESULT_NOTNULL; @@ -174,9 +175,7 @@ SQRESULT SQ_UpdateServerInfoBetweenRounds(void* sqvm) SQRESULT SQ_UpdateTimeInfo(void* sqvm) { AcquireSRWLockExclusive(&serverInfoLock); - int endTimeFromNow = ceil(ClientSq_getfloat(sqvm, 1)); - const auto p1 = std::chrono::system_clock::now().time_since_epoch(); - serverInfo.endTime = std::chrono::duration_cast(p1).count() + endTimeFromNow; + serverInfo.endTime = ceil(ClientSq_getfloat(sqvm, 1)); ReleaseSRWLockExclusive(&serverInfoLock); return SQRESULT_NOTNULL; } @@ -397,7 +396,7 @@ void InitialisePluginCommands(HMODULE baseAddress) "", SQ_UpdateGameStateUI); g_ClientSquirrelManager->AddFuncRegistration( "void", "NSUpdateGameStateClient", - "int playerCount, int outScore, int secondHighestScore, int highestScore, bool roundBased, int scoreLimit", "", + "int playerCount, int maxPlayers, int outScore, int secondHighestScore, int highestScore, bool roundBased, int scoreLimit", "", SQ_UpdateGameStateClient); g_UISquirrelManager->AddFuncRegistration( "void", "NSUpdateServerInfo", -- cgit v1.2.3