-
Notifications
You must be signed in to change notification settings - Fork 88
Add mappool #415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add mappool #415
Changes from all commits
f849747
395a1d8
6eba6b9
c4487c6
5ef9afb
ad95ffb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// add all maps on the server here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// add competitive maps here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// add fun maps for casual games here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,52 @@ | ||
#define RANDOM_MAP_VOTE "-1" // must be in invalid index for array indexing | ||
|
||
char mapGroups[][] = { | ||
"competitive.txt", "fun.txt", "maps.txt" | ||
}; | ||
|
||
/** | ||
* Map voting functions | ||
*/ | ||
public void CreateMapVote() { | ||
StartMappoolVote(); | ||
} | ||
static void StartMappoolVote() { | ||
Menu menu = new Menu(MappoolVoteHandler); | ||
menu.SetTitle("%T", "VoteMenuTitle", LANG_SERVER); | ||
menu.ExitButton = false; | ||
for (int i = 0; i < sizeof(mapGroups); i++) { | ||
char text[64], id[4]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this use the |
||
Format(text, 64, mapGroups[i]); | ||
Format(id, 4, "%i", i); | ||
ReplaceString(text, 64, ".txt", "", false); | ||
AddMenuItem(menu, id, text); | ||
} | ||
VoteMenuToAll(menu, g_MapVoteTimeCvar.IntValue); | ||
} | ||
public int MappoolVoteHandler(Menu menu, MenuAction action, int param1, int param2) { | ||
if (action == MenuAction_VoteEnd) { | ||
int winner = GetMenuInt(menu, param1); | ||
|
||
ServerCommand("sm_pugsetup_maplist %s", mapGroups[winner]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't make sense to override the value here. It doesn't make sense to even have the cvar if the plugin will just override it before it gets used. |
||
|
||
char text[PLATFORM_MAX_PATH]; | ||
Format(text, 64, mapGroups[winner]); | ||
ReplaceString(text, 64, ".txt", "", false); | ||
|
||
PrintCenterTextAll("%t","MapVoteWinnerHintText", text); | ||
|
||
CreateTimer(0.5, Timer_Continue, _, TIMER_FLAG_NO_MAPCHANGE); | ||
|
||
} else if (action == MenuAction_End) { | ||
CloseHandle(menu); | ||
} | ||
return 0; | ||
} | ||
public Action Timer_Continue(Handle timer) | ||
{ | ||
CreateMappoolVote(); | ||
} | ||
public void CreateMappoolVote() { | ||
if (g_ExcludedMaps.IntValue > 0 && g_MapList.Length > g_PastMaps.Length) { | ||
SetupMapVotePool(true); | ||
} else { | ||
|
@@ -22,6 +65,7 @@ public void CreateMapVote() { | |
} | ||
|
||
static void StartMapVote() { | ||
FillMapList(g_MapListCvar, g_MapVotePool); | ||
Menu menu = new Menu(MapVoteHandler); | ||
menu.SetTitle("%T", "VoteMenuTitle", LANG_SERVER); | ||
menu.ExitButton = false; | ||
|
@@ -39,6 +83,8 @@ static void StartMapVote() { | |
} | ||
|
||
for (int i = 0; i < g_MapVotePool.Length; i++) { | ||
char mapName[64]; | ||
g_MapVotePool.GetString(i, mapName, sizeof(mapName)); | ||
AddMapIndexToMenu(menu, g_MapVotePool, i); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned previously, I disagree with placing these in a different directory.
I also disagree with breaking backwards compatibility for existing users populating a different map config file.