Skip to content

Commit b95db6a

Browse files
committed
scheduler: cache current map name
1 parent 54c3298 commit b95db6a

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

addons/amxmodx/scripting/map_manager_informer.sma

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ enum Cvars {
2525
new g_pCvars[Cvars];
2626

2727
new g_iTeamScore[2];
28-
new g_szCurMap[MAPNAME_LENGTH];
28+
new g_sCurMap[MAPNAME_LENGTH];
2929
new g_sPrefix[48];
3030

3131
public plugin_init()
@@ -39,7 +39,7 @@ public plugin_init()
3939

4040
register_event("TeamScore", "event_teamscore", "a");
4141

42-
get_mapname(g_szCurMap, charsmax(g_szCurMap));
42+
get_mapname(g_sCurMap, charsmax(g_sCurMap));
4343
}
4444
public plugin_cfg()
4545
{
@@ -111,5 +111,5 @@ public clcmd_nextmap(id)
111111
}
112112
public clcmd_currentmap(id)
113113
{
114-
client_print_color(0, id, "%s^1 %L", g_sPrefix, LANG_PLAYER, "MAPM_CURRENT_MAP", g_szCurMap);
114+
client_print_color(0, id, "%s^1 %L", g_sPrefix, LANG_PLAYER, "MAPM_CURRENT_MAP", g_sCurMap);
115115
}

addons/amxmodx/scripting/map_manager_scheduler.sma

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ new g_sSecondVoteMaps[2][MAPNAME_LENGTH];
7373
new bool:g_bChangeMapNextRound;
7474

7575
new g_sPrefix[32];
76+
new g_sCurMap[MAPNAME_LENGTH];
7677

7778
public plugin_init()
7879
{
@@ -121,6 +122,7 @@ public plugin_init()
121122
}
122123
public plugin_cfg()
123124
{
125+
get_mapname(g_sCurMap, charsmax(g_sCurMap));
124126
mapm_get_prefix(g_sPrefix, charsmax(g_sPrefix));
125127
}
126128
public plugin_natives()
@@ -418,8 +420,7 @@ public mapm_vote_finished(map[], type, total_votes)
418420
g_bVoteInNewRound = false;
419421

420422
// map extended
421-
new curmap[MAPNAME_LENGTH]; get_mapname(curmap, charsmax(curmap));
422-
if(equali(map, curmap)) {
423+
if(equali(map, g_sCurMap)) {
423424
g_iExtendedNum++;
424425

425426
new win_limit = get_num(WINLIMIT);

0 commit comments

Comments
 (0)