Skip to content

Commit f888892

Browse files
committed
Updated variable and macro definition names
1 parent 873503a commit f888892

4 files changed

Lines changed: 20 additions & 18 deletions

File tree

commands.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
186186
engineClient->ExecuteClientCmd(std::string(mapString + "mp_coop_community_hub").c_str());
187187

188188
std::string initmapstr = std::string("Server has started with map: `" + std::string(requestedMap) + "`");
189-
g_pDiscordIntegration->SendWebHookEmbed("Server", initmapstr, EMBEDCOLOR_SERVER, false);
189+
g_pDiscordIntegration->SendWebHookEmbed("Server", initmapstr, EMBED_COLOR_SERVER, false);
190190
}
191191
else
192192
{
@@ -195,7 +195,7 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
195195
engineClient->ExecuteClientCmd(std::string(mapString + requestedMap).c_str());
196196

197197
std::string initmapstr = std::string("Server has started with map: `" + std::string(requestedMap) + "`");
198-
g_pDiscordIntegration->SendWebHookEmbed("Server", initmapstr, EMBEDCOLOR_SERVER, false);
198+
g_pDiscordIntegration->SendWebHookEmbed("Server", initmapstr, EMBED_COLOR_SERVER, false);
199199
}
200200
}
201201

discordrpc.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct WebHookParams
7777
{
7878
std::string title = "Unknown";
7979
std::string description = "*Insert Yapping Here*";
80-
int color = EMBEDCOLOR_PLAYER;
80+
int color = EMBED_COLOR_PLAYER;
8181
std::string footer = "";
8282
};
8383

@@ -212,21 +212,21 @@ void RPCState(IConVar* var, const char* pOldValue, float flOldValue)
212212
{
213213
if (!g_P2MMServerPlugin.m_bPluginLoaded) return;
214214
ConVar* cvRPC = (ConVar*)var;
215-
if (cvRPC->GetBool() && !g_pDiscordIntegration->RPCRunning)
215+
if (cvRPC->GetBool() && !g_pDiscordIntegration->rpcRunning)
216216
g_pDiscordIntegration->StartDiscordRPC();
217-
if (!cvRPC->GetBool() && g_pDiscordIntegration->RPCRunning)
217+
if (!cvRPC->GetBool() && g_pDiscordIntegration->rpcRunning)
218218
g_pDiscordIntegration->ShutdownDiscordRPC();
219219
}
220220
ConVar p2mm_discord_rpc("p2mm_discord_rpc", "1", FCVAR_NONE, "Enable or disable Discord RPC with P2:MM.", true, 0, true, 1, RPCState);
221221

222222
static DiscordRichPresence RPC;
223223
CDiscordIntegration::CDiscordIntegration()
224224
{
225-
this->RPCRunning = false; // Flag bool for whether the RPC is running.
225+
this->rpcRunning = false; // Flag bool for whether the RPC is running.
226226

227227
RPC.state = "";
228228
RPC.details = "Starting up...";
229-
RPC.startTimestamp = time(0);
229+
RPC.startTimestamp = time(nullptr);
230230
RPC.endTimestamp = 0;
231231
RPC.largeImageKey = "p2mmlogo";
232232
RPC.largeImageText = "Portal 2";
@@ -314,7 +314,7 @@ bool CDiscordIntegration::StartDiscordRPC()
314314
UpdateDiscordRPC();
315315

316316
DiscordLog(0, false, "Discord RPC activated!");
317-
this->RPCRunning = true;
317+
this->rpcRunning = true;
318318
return true;
319319
}
320320

@@ -326,7 +326,7 @@ void CDiscordIntegration::ShutdownDiscordRPC()
326326
DiscordLog(0, false, "Shutting down Discord RPC...");
327327
Discord_ClearPresence();
328328
Discord_Shutdown();
329-
this->RPCRunning = false;
329+
this->rpcRunning = false;
330330
DiscordLog(0, false, "Shutdown Discord RPC!");
331331
}
332332

@@ -420,6 +420,8 @@ void CDiscordIntegration::UpdateDiscordRPC()
420420

421421
V_strcat(details, map->mapname, 128);
422422
V_strcat(smallImageKey, "coop", 32);
423+
//V_strcat(smallImageKey, "p2mpchapter1", 32);
424+
//V_snprintf(smallImageKey, 32, "p2mpchapter%i", map->chapter);
423425
V_strcat(smallImageText, map->chaptername, 128);
424426
}
425427
break;

discordrpc.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
#include <string>
1010

1111
// Discord Embed Color Codes
12-
#define EMBEDCOLOR_PLAYER 61297 // Light Green
13-
#define EMBEDCOLOR_PLAYERDEATH 6881280 // Crimson Red
14-
#define EMBEDCOLOR_SERVER 4390995 // Dark Purple
12+
#define EMBED_COLOR_PLAYER 61297 // Light Green
13+
#define EMBED_COLOR_PLAYERDEATH 6881280 // Crimson Red
14+
#define EMBED_COLOR_SERVER 4390995 // Dark Purple
1515

1616
class CDiscordIntegration {
1717
public:
1818
CDiscordIntegration();
1919

20-
void SendWebHookEmbed(std::string title = "Unknown", std::string description = "*Insert Yapping Here*", int color = EMBEDCOLOR_PLAYER, bool hasFooter = true);
20+
void SendWebHookEmbed(std::string title = "Unknown", std::string description = "*Insert Yapping Here*", int color = EMBED_COLOR_PLAYER, bool hasFooter = true);
2121
bool StartDiscordRPC();
2222
void ShutdownDiscordRPC();
2323
void UpdateDiscordRPC();
2424

25-
bool RPCRunning;
25+
bool rpcRunning;
2626
};
2727
extern CDiscordIntegration* g_pDiscordIntegration;

p2mm.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ bool CP2MMServerPlugin::Load(CreateInterfaceFn interfaceFactory, CreateInterface
299299

300300
// Discord RPC
301301
P2MMLog(0, true, "Checking if Discord RPC should be started...");
302-
if (p2mm_discord_rpc.GetBool() && !g_pDiscordIntegration->RPCRunning)
302+
if (p2mm_discord_rpc.GetBool() && !g_pDiscordIntegration->rpcRunning)
303303
{
304304
P2MMLog(0, true, "Discord RPC enabled! Starting!");
305305
g_pDiscordIntegration->StartDiscordRPC();
@@ -484,7 +484,7 @@ void CP2MMServerPlugin::Unload(void)
484484
P2MMLog(0, false, "Encountered error when unload plugin! Skipping other patches... :( Exception: \"%s\"", ex.what());
485485
}
486486

487-
if (p2mm_discord_rpc.GetBool() && g_pDiscordIntegration->RPCRunning)
487+
if (p2mm_discord_rpc.GetBool() && g_pDiscordIntegration->rpcRunning)
488488
g_pDiscordIntegration->ShutdownDiscordRPC();
489489

490490
m_bPluginLoaded = false;
@@ -541,7 +541,7 @@ void CP2MMServerPlugin::LevelInit(char const* pMapName)
541541
if (!g_P2MMServerPlugin.m_bSeenFirstRunPrompt) return;
542542

543543
std::string changemapstr = std::string("The server has changed the map to: `" + std::string(CURMAPFILENAME) + "`");
544-
g_pDiscordIntegration->SendWebHookEmbed("Server", changemapstr, EMBEDCOLOR_SERVER, false);
544+
g_pDiscordIntegration->SendWebHookEmbed("Server", changemapstr, EMBED_COLOR_SERVER, false);
545545

546546
// Update Discord RPC to update current map information.
547547
g_pDiscordIntegration->UpdateDiscordRPC();
@@ -780,7 +780,7 @@ void CP2MMServerPlugin::FireGameEvent(IGameEvent* event)
780780
if (playerHandle)
781781
{
782782
g_pScriptVM->Call<HSCRIPT>(od_func, nullptr, false, nullptr, playerHandle);
783-
g_pDiscordIntegration->SendWebHookEmbed(std::string(GetPlayerName(entindex) + std::string(" Died!")), "", EMBEDCOLOR_PLAYERDEATH);
783+
g_pDiscordIntegration->SendWebHookEmbed(std::string(GetPlayerName(entindex) + std::string(" Died!")), "", EMBED_COLOR_PLAYERDEATH);
784784
}
785785
}
786786

0 commit comments

Comments
 (0)