Skip to content

Commit

Permalink
Miscellaneous changes
Browse files Browse the repository at this point in the history
- Added missing header files to VS project files
- Added missing map vote cvars to cs2fixes.cfg
- Made config file formatting consistent
- Some code cleanup in c_http debug command
- Fixed memdbgon.h not being last include in events.cpp
- Fixed !setnextmap not having correct admin flag
- Switched to simpler CON_COMMAND_CHAT macro for most map vote commands
  • Loading branch information
Vauff authored and xen-000 committed Dec 26, 2023
1 parent 4df4720 commit d46f89b
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 38 deletions.
2 changes: 2 additions & 0 deletions CS2Fixes.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,14 @@
<ClInclude Include="src\discord.h" />
<ClInclude Include="src\eventlistener.h" />
<ClInclude Include="src\gamesystem.h" />
<ClInclude Include="src\gameconfig.h" />
<ClInclude Include="src\httpmanager.h" />
<ClInclude Include="src\mempatch.h" />
<ClInclude Include="src\addresses.h" />
<ClInclude Include="src\playermanager.h" />
<ClInclude Include="src\recipientfilters.h" />
<ClInclude Include="src\votemanager.h" />
<ClInclude Include="src\map_votes.h" />
<ClInclude Include="src\utils\entity.h" />
<ClInclude Include="src\utils\module.h" />
<ClInclude Include="src\utils\plat.h" />
Expand Down
8 changes: 7 additions & 1 deletion CS2Fixes.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
Expand Down Expand Up @@ -205,5 +205,11 @@
<ClInclude Include="src\gamesystem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\gameconfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\map_votes.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions cfg/cs2fixes/cs2fixes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ cs2f_extend_success_ratio 0.5 // Ratio needed to pass an extend
cs2f_extend_time 20 // Time to add per extend
cs2f_rtv_success_ratio 0.6 // Ratio needed to pass RTV
cs2f_rtv_endround 0 // Whether to immediately end the round when RTV succeeds
cs2f_vote_maps_cooldown 10 // Number of maps to wait until a map can be voted / nominated again i.e. cooldown.
cs2f_vote_max_nominations 10 // Number of nominations to include per vote, out of a maximum of 10.

// Ztele settings
zr_ztele_max_distance 150.0 // Maximum distance players are allowed to move after starting ztele
Expand Down
10 changes: 5 additions & 5 deletions configs/admins.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Admins
{
// Admin entries should follow this format

//"name" // Unused, can be anything
//{
// "steamid" "1234567890" // SteamID64
// "flags" "abcdefg" // Permission flags as described above
//}
//"name" // Unused, can be anything
//{
// "steamid" "1234567890" // SteamID64
// "flags" "abcdefg" // Permission flags as described above
//}
}
30 changes: 15 additions & 15 deletions configs/maplist.cfg.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"Maplist"
{
"ze_my_first_ze_map"
{
"workshop_id" "123"
"enabled" "1"
}
"ze_my_second_ze_map"
{
"workshop_id" "456"
"enabled" "1"
}
"ze_my_thirdd_ze_map"
{
"workshop_id" "789"
"enabled" "1"
}
"ze_my_first_ze_map"
{
"workshop_id" "123"
"enabled" "1"
}
"ze_my_second_ze_map"
{
"workshop_id" "456"
"enabled" "1"
}
"ze_my_thirdd_ze_map"
{
"workshop_id" "789"
"enabled" "1"
}
}
16 changes: 4 additions & 12 deletions src/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,26 +757,18 @@ CON_COMMAND_CHAT(http, "test an HTTP request")
{
if (!g_http)
{
if (player)
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Steam HTTP interface is not available!");
else
Message("Steam HTTP interface is not available!\n");

ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Steam HTTP interface is not available!");
return;
}
if (args.ArgC() < 3)
{
if (player)
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Usage: !http <get/post> <url> [content]");
else
Message("Usage: !http <get/post> <url> [content]\n");

ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Usage: !http <get/post> <url> [content]");
return;
}

if (strcmp(args[1], "get") == 0)
if (!V_strcmp(args[1], "get"))
g_HTTPManager.GET(args[2], &HttpCallback);
else if (strcmp(args[1], "post") == 0)
else if (!V_strcmp(args[1], "post"))
g_HTTPManager.POST(args[2], args[3], &HttpCallback);
}

Expand Down
2 changes: 1 addition & 1 deletion src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "ctimer.h"
#include "eventlistener.h"
#include "entity/cbaseplayercontroller.h"
#include "playermanager.h"

#include "tier0/memdbgon.h"
#include "playermanager.h"

extern IGameEventManager2 *g_gameEventManager;
extern IServerGameClients *g_pSource2GameClients;
Expand Down
8 changes: 4 additions & 4 deletions src/map_votes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CON_COMMAND_F(cs2f_vote_max_nominations, "Number of nominations to include per v
}
}

CON_COMMAND_CHAT_FLAGS(setnextmap, "Force next map", ADMFLAG_ROOT)
CON_COMMAND_CHAT_FLAGS(setnextmap, "Force next map", ADMFLAG_CHANGEMAP)
{
bool bIsClearingForceNextMap = args.ArgC() < 2;
int iResponse = g_pMapVoteSystem->ForceNextMap(bIsClearingForceNextMap ? "" : args[1]);
Expand Down Expand Up @@ -123,7 +123,7 @@ static int __cdecl OrderStringsLexicographically(const char* const* a, const cha
return V_strcasecmp(*a, *b);
}

CON_COMMAND_CHAT_FLAGS(maplist, "List the maps in the server", ADMFLAG_NONE)
CON_COMMAND_CHAT(maplist, "List the maps in the server")
{
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "The list of all maps will be shown in console.");
ClientPrint(player, HUD_PRINTCONSOLE, "The list of all maps is:");
Expand All @@ -137,7 +137,7 @@ CON_COMMAND_CHAT_FLAGS(maplist, "List the maps in the server", ADMFLAG_NONE)
}
}

CON_COMMAND_CHAT_FLAGS(nomlist, "List the list of nominations", ADMFLAG_NONE)
CON_COMMAND_CHAT(nomlist, "List the list of nominations")
{
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Current nominations:");
for (int i = 0; i < g_pMapVoteSystem->GetMapListSize(); i++) {
Expand All @@ -149,7 +149,7 @@ CON_COMMAND_CHAT_FLAGS(nomlist, "List the list of nominations", ADMFLAG_NONE)
}
}

CON_COMMAND_CHAT_FLAGS(mapcooldowns, "List the maps currently in cooldown", ADMFLAG_NONE)
CON_COMMAND_CHAT(mapcooldowns, "List the maps currently in cooldown")
{
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "The list of maps in cooldown will be shown in console.");
ClientPrint(player, HUD_PRINTCONSOLE, "The list of maps in cooldown is:");
Expand Down

0 comments on commit d46f89b

Please sign in to comment.