From 3f21fa4b399c647ec4dba9cabb1c4e51701b9683 Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Mon, 13 Mar 2017 15:52:37 -0700 Subject: [PATCH] Update sm_map behavior to better reflect FindMap/GetMapDisplayName results (#588) * Update sm_map to use GetMapDisplayName Increase map name buffer sizes to PLATFORM_MAX_PATH * Update sm_setnextmap to use ShowActivity2 --- plugins/basecommands/map.sp | 14 ++++++++------ plugins/mapchooser.sp | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/plugins/basecommands/map.sp b/plugins/basecommands/map.sp index f781e8354..0403534fe 100644 --- a/plugins/basecommands/map.sp +++ b/plugins/basecommands/map.sp @@ -42,7 +42,7 @@ public int MenuHandler_ChangeMap(Menu menu, MenuAction action, int param1, int p } else if (action == MenuAction_Select) { - char map[64]; + char map[PLATFORM_MAX_PATH]; menu.GetItem(param2, map, sizeof(map)); @@ -89,17 +89,19 @@ public Action Command_Map(int client, int args) return Plugin_Handled; } - char map[64]; + char map[PLATFORM_MAX_PATH]; + char displayName[PLATFORM_MAX_PATH]; GetCmdArg(1, map, sizeof(map)); - if (!IsMapValid(map)) + if (FindMap(map, displayName, sizeof(displayName)) == FindMap_NotFound) { ReplyToCommand(client, "[SM] %t", "Map was not found", map); return Plugin_Handled; } - ShowActivity2(client, "[SM] ", "%t", "Changing map", map); + GetMapDisplayName(displayName, displayName, sizeof(displayName)); + ShowActivity2(client, "[SM] ", "%t", "Changing map", displayName); LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map); DataPack dp; @@ -111,7 +113,7 @@ public Action Command_Map(int client, int args) public Action Timer_ChangeMap(Handle timer, DataPack dp) { - char map[65]; + char map[PLATFORM_MAX_PATH]; dp.Reset(); dp.ReadString(map, sizeof(map)); @@ -144,7 +146,7 @@ int LoadMapList(Menu menu) menu.RemoveAllItems(); - char map_name[64]; + char map_name[PLATFORM_MAX_PATH]; int map_count = GetArraySize(g_map_array); for (int i = 0; i < map_count; i++) diff --git a/plugins/mapchooser.sp b/plugins/mapchooser.sp index d170e9618..5d0614ac6 100644 --- a/plugins/mapchooser.sp +++ b/plugins/mapchooser.sp @@ -302,10 +302,10 @@ public Action Command_SetNextmap(int client, int args) ReplyToCommand(client, "[SM] %t", "Map was not found", map); return Plugin_Handled; } - + GetMapDisplayName(displayName, displayName, sizeof(displayName)); - - ShowActivity(client, "%t", "Changed Next Map", displayName); + + ShowActivity2(client, "[SM] ", "%t", "Changed Next Map", displayName); LogAction(client, -1, "\"%L\" changed nextmap to \"%s\"", client, map); SetNextMap(map);