Skip to content

Commit d49208d

Browse files
committed
core: cache current map name
1 parent a5da852 commit d49208d

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

addons/amxmodx/scripting/map_manager_adv_lists.sma

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#include <amxmodx>
22
#include <map_manager>
33

4-
#if AMXX_VERSION_NUM < 183
5-
#include <colorchat>
6-
#endif
7-
84
#define PLUGIN "Map Manager: Advanced lists"
95
#define VERSION "0.0.1"
106
#define AUTHOR "Mistrick"

addons/amxmodx/scripting/map_manager_core.sma

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ new g_iVoteType;
8181
new bool:g_bVoteStarted;
8282
new bool:g_bVoteFinished;
8383

84+
new g_sCurMap[MAPNAME_LENGTH];
8485
new g_sPrefix[48];
8586

8687
public plugin_init()
@@ -253,6 +254,8 @@ public plugin_cfg()
253254
server_cmd("exec %s/map_manager.cfg", configsdir);
254255
server_exec();
255256

257+
get_mapname(g_sCurMap, charsmax(g_sCurMap));
258+
256259
get_pcvar_string(g_pCvars[PREFIX], g_sPrefix, charsmax(g_sPrefix));
257260
replace_color_tag(g_sPrefix, charsmax(g_sPrefix));
258261

@@ -364,13 +367,13 @@ prepare_vote(type)
364367
ExecuteForward(g_hForwards[CAN_BE_EXTENDED], ret, type);
365368
g_bCanExtend = !ret;
366369

367-
new curmap[MAPNAME_LENGTH]; get_mapname(curmap, charsmax(curmap));
368370
if(g_bCanExtend) {
369-
copy(g_sVoteList[g_iVoteItems], charsmax(g_sVoteList[]), curmap);
371+
copy(g_sVoteList[g_iVoteItems], charsmax(g_sVoteList[]), g_sCurMap);
370372
}
373+
371374
g_iCurMap = -1;
372375
for(new i; i < g_iVoteItems + g_bCanExtend; i++) {
373-
if(equali(curmap, g_sVoteList[i])) {
376+
if(equali(g_sCurMap, g_sVoteList[i])) {
374377
g_iCurMap = i;
375378
break;
376379
}

addons/amxmodx/scripting/map_manager_nomination.sma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,4 +414,4 @@ remove_maps()
414414
ArrayDeleteItem(g_aNomList, i--);
415415
}
416416
}
417-
}
417+
}

0 commit comments

Comments
 (0)