Skip to content

Commit 661e99a

Browse files
committed
Changed all P2MMLog calls to Log
1 parent 0896d21 commit 661e99a

8 files changed

Lines changed: 213 additions & 209 deletions

File tree

commands.cpp

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
113113
// Make sure the CON_COMMAND was executed correctly.
114114
if (args.ArgC() < 2 || FStrEq(args.Arg(1), ""))
115115
{
116-
P2MMLog(WARNING, false, "p2mm_map called incorrectly! Usage: \"p2mm_map (map to start)\"");
116+
Log(WARNING, false, "p2mm_map called incorrectly! Usage: \"p2mm_map (map to start)\"");
117117
UpdateMapsList();
118118
return;
119119
}
120120

121121
// A check done by the menu to request to use the last recorded map in the p2mm_lastmap ConVar.
122122
char requestedMap[256] = { 0 };
123123
V_strcpy(requestedMap, args.Arg(1));
124-
P2MMLog(INFO, true, "Requested Map: %s", requestedMap);
125-
P2MMLog(INFO, true, "p2mm_lastmap: %s", p2mm_lastmap.GetString());
124+
Log(INFO, true, "Requested Map: %s", requestedMap);
125+
Log(INFO, true, "p2mm_lastmap: %s", p2mm_lastmap.GetString());
126126
if (FStrEq(requestedMap, "P2MM_LASTMAP"))
127127
{
128128
if (!engineServer->IsMapValid(p2mm_lastmap.GetString()))
@@ -138,14 +138,14 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
138138
char completePVCmd[sizeof("playvol \"#music/mainmenu/portal2_background0%d\" 0.35") + sizeof(iAct)] = { 0 };
139139
V_snprintf(completePVCmd, sizeof(completePVCmd), "playvol \"#music/mainmenu/portal2_background0%i\" 0.35", iAct);
140140

141-
P2MMLog(WARNING, false, "p2mm_map was called with P2MM_LASTMAP, but p2mm_lastmap is empty or invalid!");
141+
Log(WARNING, false, "p2mm_map was called with P2MM_LASTMAP, but p2mm_lastmap is empty or invalid!");
142142
engineClient->ExecuteClientCmd("disconnect \"There is no last map recorded or the map doesn't exist! Please start a play session with the other options first.\"");
143143
engineClient->ExecuteClientCmd(completePVCmd);
144144
UpdateMapsList();
145145
return;
146146
}
147147
V_strcpy(requestedMap, p2mm_lastmap.GetString());
148-
P2MMLog(INFO, true, "P2MM_LASTMAP called! Running Last Map: \"%s\"", requestedMap);
148+
Log(INFO, true, "P2MM_LASTMAP called! Running Last Map: \"%s\"", requestedMap);
149149
}
150150
p2mm_lastmap.SetValue(""); // Set last map ConVar to blank so it doesn't trigger level changes where we don't want it to trigger.
151151

@@ -160,14 +160,14 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
160160
// Check if the supplied map is a valid map.
161161
if (!engineServer->IsMapValid(requestedMap))
162162
{
163-
P2MMLog(WARNING, false, "p2mm_map was given a non-valid map or one that doesn't exist! \"%s\"", requestedMap);
163+
Log(WARNING, false, "p2mm_map was given a non-valid map or one that doesn't exist! \"%s\"", requestedMap);
164164
UpdateMapsList();
165165
return;
166166
}
167167

168168
// Check if the user requested it to start in splitscreen or not.
169169
const std::string mapString = p2mm_splitscreen.GetBool() ? "ss_map " : "map ";
170-
P2MMLog(INFO, true, "Map String: %s", mapString.c_str());
170+
Log(INFO, true, "Map String: %s", mapString.c_str());
171171

172172
// Set first run flag on and set the last map ConVar value so the system.
173173
// can change from mp_coop_community_hub to the requested map.
@@ -176,8 +176,8 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
176176
g_P2MMServerPlugin.m_bSeenFirstRunPrompt = false;
177177
if (!FSubStr(requestedMap, "mp_coop"))
178178
{
179-
P2MMLog(INFO, true, R"("mp_coop" not found, single player map being run. Full ExecuteClientCmd: "%s")", std::string(mapString + "mp_coop_community_hub").c_str());
180-
P2MMLog(INFO, true, "requestedMap: \"%s\"", requestedMap);
179+
Log(INFO, true, R"("mp_coop" not found, single player map being run. Full ExecuteClientCmd: "%s")", std::string(mapString + "mp_coop_community_hub").c_str());
180+
Log(INFO, true, "requestedMap: \"%s\"", requestedMap);
181181
p2mm_lastmap.SetValue(requestedMap);
182182
engineClient->ExecuteClientCmd(std::string(mapString + "mp_coop_community_hub").c_str());
183183

@@ -186,8 +186,8 @@ CON_COMMAND_F_COMPLETION(p2mm_map, "Starts up a P2:MM session with a requested m
186186
}
187187
else
188188
{
189-
P2MMLog(INFO, true, R"("mp_coop" found, multiplayer map being run. Full ExecuteClientCmd: "%s")", std::string(mapString + requestedMap).c_str());
190-
P2MMLog(INFO, true, "requestedMap: \"%s\"", requestedMap);
189+
Log(INFO, true, R"("mp_coop" found, multiplayer map being run. Full ExecuteClientCmd: "%s")", std::string(mapString + requestedMap).c_str());
190+
Log(INFO, true, "requestedMap: \"%s\"", requestedMap);
191191
engineClient->ExecuteClientCmd(std::string(mapString + requestedMap).c_str());
192192

193193
std::string initMapStr = std::string("Server has started with map: `" + std::string(requestedMap) + "`");
@@ -202,13 +202,13 @@ CON_COMMAND(p2mm_updatemaplist, "Manually updates the list of available maps tha
202202

203203
CON_COMMAND(p2mm_maplist, "Lists available maps that can be loaded with p2mm_map.")
204204
{
205-
P2MMLog(INFO, false, "AVAILABLE MAPS:");
206-
P2MMLog(INFO, false, "----------------------------------------");
205+
Log(INFO, false, "AVAILABLE MAPS:");
206+
Log(INFO, false, "----------------------------------------");
207207
for (const std::string& map : mapList)
208208
{
209-
P2MMLog(INFO, false, map.c_str());
209+
Log(INFO, false, map.c_str());
210210
}
211-
P2MMLog(INFO, false, "----------------------------------------");
211+
Log(INFO, false, "----------------------------------------");
212212
}
213213

214214

@@ -257,7 +257,7 @@ CON_COMMAND_F(p2mm_toggle_dev_cc_cvars, "Toggle showing any ConVars and ConComma
257257
m_ConVarConCommandsShown = true;
258258
}
259259

260-
P2MMLog(INFO, false, "%s %i ConVars/ConCommands!", m_ConVarConCommandsShown ? "Unhid" : "Hid", iToggleCount);
260+
Log(INFO, false, "%s %i ConVars/ConCommands!", m_ConVarConCommandsShown ? "Unhid" : "Hid", iToggleCount);
261261
}
262262

263263
//---------------------------------------------------------------------------------
@@ -312,8 +312,8 @@ static void GelocityTournament(IConVar* var, const char* pOldValue, const float
312312
// Check if host is in a gelocity map.
313313
if (!InGelocityMap())
314314
{
315-
P2MMLog(INFO, false, "Gelocity tournament mode ConVar was changed from %i to %i.", static_cast<int>(flOldValue), dynamic_cast<ConVar*>(var)->GetBool());
316-
P2MMLog(WARNING, false, "Mode will take effect when Gelocity map is loaded.");
315+
Log(INFO, false, "Gelocity tournament mode ConVar was changed from %i to %i.", static_cast<int>(flOldValue), dynamic_cast<ConVar*>(var)->GetBool());
316+
Log(WARNING, false, "Mode will take effect when Gelocity map is loaded.");
317317
return;
318318
}
319319

@@ -322,14 +322,14 @@ static void GelocityTournament(IConVar* var, const char* pOldValue, const float
322322
g_pScriptVM->GetValue("b_RaceStarted", &raceStartedScript);
323323
if (raceStartedScript.m_bool)
324324
{
325-
P2MMLog(WARNING, false, "Race is currently in progress!");
325+
Log(WARNING, false, "Race is currently in progress!");
326326
return;
327327
}
328328

329-
P2MMLog(INFO, false, "Gelocity tournament mode ConVar was changed from %i to %i!", static_cast<int>(flOldValue), dynamic_cast<ConVar*>(var)->GetBool());
330-
P2MMLog(WARNING, false, "Restarting map based on tournament mode change!");
329+
Log(INFO, false, "Gelocity tournament mode ConVar was changed from %i to %i!", static_cast<int>(flOldValue), dynamic_cast<ConVar*>(var)->GetBool());
330+
Log(WARNING, false, "Restarting map based on tournament mode change!");
331331

332-
engineClient->ExecuteClientCmd(std::string("changelevel " + std::string(CURMAPFILENAME)).c_str());
332+
engineClient->ExecuteClientCmd(std::string("changelevel " + std::string(CUR_MAPFILE_NAME)).c_str());
333333
}
334334
ConVar p2mm_gelocity_tournamentmode("p2mm_gelocity_tournamentmode", "0", FCVAR_NONE, "Turn on or off tournament mode.", true, 0, true, 1, GelocityTournament);
335335

@@ -339,10 +339,10 @@ static void GelocityButtons(IConVar* var, const char* pOldValue, float flOldValu
339339
if (!InGelocityMap())
340340
{
341341
if (!dynamic_cast<ConVar*>(var)->GetBool())
342-
P2MMLog(INFO, false, "Unlocked buttons...");
342+
Log(INFO, false, "Unlocked buttons...");
343343
else
344-
P2MMLog(INFO, false, "Locked buttons...");
345-
P2MMLog(WARNING, false, "Mode will take effect when Gelocity map is loaded.");
344+
Log(INFO, false, "Locked buttons...");
345+
Log(WARNING, false, "Mode will take effect when Gelocity map is loaded.");
346346
return;
347347
}
348348

@@ -355,7 +355,7 @@ static void GelocityButtons(IConVar* var, const char* pOldValue, float flOldValu
355355
"EntFire(\"music_button_1\", \"Unlock\");"
356356
"EntFire(\"music_button_2\", \"Unlock\");", false
357357
);
358-
P2MMLog(INFO, false, "Unlocked buttons...");
358+
Log(INFO, false, "Unlocked buttons...");
359359
}
360360
else
361361
{
@@ -365,7 +365,7 @@ static void GelocityButtons(IConVar* var, const char* pOldValue, float flOldValu
365365
"EntFire(\"music_button_1\", \"Lock\");"
366366
"EntFire(\"music_button_2\", \"Lock\");", false
367367
);
368-
P2MMLog(INFO, false, "Locked buttons...");
368+
Log(INFO, false, "Locked buttons...");
369369
}
370370
}
371371
ConVar p2mm_gelocity_lockbuttons("p2mm_gelocity_lockbuttons", "0", FCVAR_NONE, "Toggle the state of the music and lap buttons.", true, 0, true, 1, GelocityButtons);
@@ -375,7 +375,7 @@ CON_COMMAND(p2mm_gelocity_laps, "Set lap count for the Gelocity Race. Specify 0
375375
// Check if host is in a gelocity map.
376376
if (!InGelocityMap())
377377
{
378-
P2MMLog(WARNING, false, "Not currently in a Gelocity map!");
378+
Log(WARNING, false, "Not currently in a Gelocity map!");
379379
return;
380380
}
381381

@@ -384,7 +384,7 @@ CON_COMMAND(p2mm_gelocity_laps, "Set lap count for the Gelocity Race. Specify 0
384384
g_pScriptVM->GetValue("bRaceStarted", &raceStartedScript);
385385
if (raceStartedScript.m_bool)
386386
{
387-
P2MMLog(WARNING, false, "Race is currently in progress!");
387+
Log(WARNING, false, "Race is currently in progress!");
388388
return;
389389
}
390390

@@ -395,12 +395,12 @@ CON_COMMAND(p2mm_gelocity_laps, "Set lap count for the Gelocity Race. Specify 0
395395
{
396396
ScriptVariant_t raceLaps;
397397
g_pScriptVM->GetValue("iGameLaps", &raceLaps);
398-
P2MMLog(INFO, false, "Current race laps: %i", raceLaps.m_int);
398+
Log(INFO, false, "Current race laps: %i", raceLaps.m_int);
399399
return;
400400
}
401401
else if (V_atoi(args.Arg(1)) < 1 || V_atoi(args.Arg(1)) > 300)
402402
{
403-
P2MMLog(WARNING, false, "Value out of bounds! Lap counter goes from 1-300!");
403+
Log(WARNING, false, "Value out of bounds! Lap counter goes from 1-300!");
404404
return;
405405
}
406406

@@ -431,7 +431,7 @@ CON_COMMAND(p2mm_gelocity_music, "Set the music track for the Gelocity Race. 0-5
431431
// Check if host is in a gelocity map.
432432
if (!InGelocityMap())
433433
{
434-
P2MMLog(WARNING, false, "Not currently in a Gelocity map!");
434+
Log(WARNING, false, "Not currently in a Gelocity map!");
435435
return;
436436
}
437437

@@ -440,7 +440,7 @@ CON_COMMAND(p2mm_gelocity_music, "Set the music track for the Gelocity Race. 0-5
440440
g_pScriptVM->GetValue("bFinalLap", &finalLapScript);
441441
if (finalLapScript.m_bool)
442442
{
443-
P2MMLog(WARNING, false, "ITS THE FINAL LAP! LET THE INTENSE FINAL LAP MUSIC PLAY!");
443+
Log(WARNING, false, "ITS THE FINAL LAP! LET THE INTENSE FINAL LAP MUSIC PLAY!");
444444
return;
445445
}
446446

@@ -449,12 +449,12 @@ CON_COMMAND(p2mm_gelocity_music, "Set the music track for the Gelocity Race. 0-5
449449
{
450450
ScriptVariant_t iMusicTrack;
451451
g_pScriptVM->GetValue("iMusicTrack", &iMusicTrack);
452-
P2MMLog(INFO, false, "Current music track: %i", iMusicTrack.m_int);
452+
Log(INFO, false, "Current music track: %i", iMusicTrack.m_int);
453453
return;
454454
}
455455
else if (V_atoi(args.Arg(1)) < 0 || V_atoi(args.Arg(1)) > 5)
456456
{
457-
P2MMLog(WARNING, false, "Value out of bounds! Music tracks goes from 0-5!");
457+
Log(WARNING, false, "Value out of bounds! Music tracks goes from 0-5!");
458458
return;
459459
}
460460

@@ -480,12 +480,12 @@ CON_COMMAND(p2mm_gelocity_music, "Set the music track for the Gelocity Race. 0-5
480480
if (V_atoi(args.Arg(1)) == 0)
481481
{
482482
UTIL_HudMessage(NULL, musicMessage, std::string("No Music").c_str());
483-
P2MMLog(INFO, false, "Music turned off!", V_atoi(args.Arg(1)));
483+
Log(INFO, false, "Music turned off!", V_atoi(args.Arg(1)));
484484
}
485485
else
486486
{
487487
UTIL_HudMessage(NULL, musicMessage, std::string("Music Track: " + std::string(args.Arg(1))).c_str());
488-
P2MMLog(INFO, false, "Set music track to %i!", V_atoi(args.Arg(1)));
488+
Log(INFO, false, "Set music track to %i!", V_atoi(args.Arg(1)));
489489
}
490490
}
491491

@@ -494,7 +494,7 @@ CON_COMMAND(p2mm_gelocity_start, "Starts the Gelocity race.")
494494
// Check if host is in a gelocity map.
495495
if (!InGelocityMap())
496496
{
497-
P2MMLog(WARNING, false, "Not currently in a Gelocity map!");
497+
Log(WARNING, false, "Not currently in a Gelocity map!");
498498
return;
499499
}
500500

@@ -503,7 +503,7 @@ CON_COMMAND(p2mm_gelocity_start, "Starts the Gelocity race.")
503503
g_pScriptVM->GetValue("b_RaceStarted", &raceStartedScript);
504504
if (raceStartedScript.m_bool)
505505
{
506-
P2MMLog(WARNING, false, "Race is currently in progress!");
506+
Log(WARNING, false, "Race is currently in progress!");
507507
return;
508508
}
509509

@@ -532,7 +532,7 @@ void RemovePlayerOperation(const bool bBanning, const int userid)
532532
{
533533
if (FStrEq(i.username.c_str(), bannedPlayer.username.c_str()))
534534
{
535-
P2MMLog(WARNING, false, "Ban called on player that is already banned!");
535+
Log(WARNING, false, "Ban called on player that is already banned!");
536536
UTIL_ClientPrint(UTIL_PlayerByIndex(0), HUD_PRINTTALK, "\x03(P2:MM): This player is already banned!");
537537
return;
538538
}
@@ -557,18 +557,18 @@ void RemovePlayerOperation(const bool bBanning, const int userid)
557557
}
558558
engineClient->ExecuteClientCmd("gameui_hide");
559559

560-
P2MMLog(INFO, true, "Banning?: %i", bBanning);
561-
P2MMLog(INFO, true, "userID: %i", bannedPlayer.userID);
562-
P2MMLog(INFO, true, "username: %s", bannedPlayer.username.c_str());
563-
P2MMLog(INFO, true, "guid: %s", bannedPlayer.guid.c_str());
560+
Log(INFO, true, "Banning?: %i", bBanning);
561+
Log(INFO, true, "userID: %i", bannedPlayer.userID);
562+
Log(INFO, true, "username: %s", bannedPlayer.username.c_str());
563+
Log(INFO, true, "guid: %s", bannedPlayer.guid.c_str());
564564
}
565565

566566
// Display UI for either banning or kicking so host can ban or kick a player.
567567
void RemovePlayerUI(const int playerIndex, const bool bBanning)
568568
{
569569
if (!IsGameActive())
570570
{
571-
P2MMLog(WARNING, false, "Game session is not currently running!");
571+
Log(WARNING, false, "Game session is not currently running!");
572572
return;
573573
}
574574

@@ -624,7 +624,7 @@ CON_COMMAND(unban, "Unban a player from the P2:MM play session.")
624624
{
625625
if (!IsGameActive())
626626
{
627-
P2MMLog(WARNING, false, "Game session is not currently running!");
627+
Log(WARNING, false, "Game session is not currently running!");
628628
return;
629629
}
630630

0 commit comments

Comments
 (0)