From 138e1a1acbedbdb1c2348adbd22c8600ef691687 Mon Sep 17 00:00:00 2001 From: aerkefiende Date: Tue, 22 Jan 2013 21:39:18 +0000 Subject: [PATCH] The random map will be picked from the packages/maps/official dir instead of a list git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7133 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/main.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/source/src/main.cpp b/source/src/main.cpp index 8f243816..37084ecd 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -874,18 +874,11 @@ VARFP(clockfix, 0, 0, 1, clockreset()); const char *rndmapname() { - // "ac_depot_classic", - static const char * const mapnames[] = { - "ac_aqueous", "ac_arabian", "ac_arctic", "ac_arid", "ac_avenue", - "ac_complex", "ac_depot", "ac_desert", "ac_desert2", "ac_desert3", - "ac_douze", "ac_edifice", "ac_elevation", "ac_gothic", "ac_iceroad", - "ac_industrial", "ac_ingress", "ac_keller", "ac_mines", "ac_outpost", - "ac_power", "ac_rattrap", "ac_scaffold", "ac_shine", "ac_snow", - "ac_stellar", "ac_sunset", "ac_toxic", "ac_urban", "ac_werk", - }; - int l = sizeof(mapnames)/sizeof(mapnames[0]); - int n = rnd(l); - return mapnames[n]; + vector maps; + listfiles("packages/maps/official", "cgz", maps); + char *map = newstring(maps[rnd(maps.length())]); + maps.deletearrays(); + return map; } extern void connectserv(char *, int *, char *);