From 27d34d4c76330f3e43852ac2917f9788a0859b08 Mon Sep 17 00:00:00 2001 From: div0 Date: Sun, 3 Dec 2006 10:21:36 +0000 Subject: [PATCH] simplified GetMaplistPosition git-svn-id: svn://svn.icculus.org/nexuiz/trunk@1967 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/g_world.qc | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index e92fbdb7b..d7f6ae8b3 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -427,29 +427,19 @@ string GetMapname() return strcat("dm_", mapname); } +float Map_Count, Map_Current; + +// NOTE: this now expects the map list to be already tokenize()d and the count in Map_Count float GetMaplistPosition() { - float pos, f; - string map, s; - - map = strzone(GetMapname()); - pos = 0; - f = tokenize(cvar_string("g_maplist")); + float pos; + string map; - while(pos < f) - { - s = strzone(argv(pos)); - if(s == map) - { - strunzone(s); - strunzone(map); + map = GetMapname(); + for(pos = 0; pos < Map_Count; ++pos) + if(map == argv(pos)) return pos; - } - strunzone(s); - pos++; - } - strunzone(map); // resume normal maplist rotation if current map is not in g_maplist return cvar("g_maplist_index"); } @@ -484,8 +474,6 @@ float MapHasRightSize(string map) return TRUE; } -float Map_Count, Map_Current; - string Map_Filename(float position) { return strcat("maps/", argv(position), ".mapcfg"); -- 2.39.2