From 5058172a063c619d0a9ad879bf82a2f5d7a49803 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Sun, 11 May 2014 01:17:18 +0200 Subject: [PATCH] fix empty map name after /newmap and fix voting for nonexistent maps now /savemap after /newmap saves to "newmap.cgz" instead of ".cgz" also, voting for a nonexistent map in singleplayer leaves the client in some sort of a broken state. this fix blocks the vote. and: newmap is blocked in bot modes, since that isn't working stable. --- source/src/serveractions.h | 9 ++++++++- source/src/world.cpp | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/src/serveractions.h b/source/src/serveractions.h index 5c263200..0f04a1a6 100644 --- a/source/src/serveractions.h +++ b/source/src/serveractions.h @@ -129,7 +129,14 @@ struct mapaction : serveraction if(sl == strlen(m) && !strncmp(m, scl.adminonlymaps[i], sl)) role = CR_ADMIN; } } - else mapok = true; + else + { + int mp = findmappath(map); + mapok = mp == MAP_LOCAL || mp == MAP_OFFICIAL; // clients can only load from packages/maps and packages/maps/official +#ifndef STANDALONE + if(!mapok) conoutf("\f3map '%s' not found", map); +#endif + } area |= EE_LOCAL_SERV; // local too formatstring(desc)("load map '%s' in mode '%s'", map, modestr(mode)); if(q) concatstring(desc, " (in the next game)"); diff --git a/source/src/world.cpp b/source/src/world.cpp index 42335820..665e8574 100644 --- a/source/src/world.cpp +++ b/source/src/world.cpp @@ -538,7 +538,7 @@ bool empty_world(int factor, bool force) // main empty world creation routine if(!copy) { findplayerstart(player1, true); - startmap("", false); + startmap("newmap", false); } else conoutf("new map size: %d", sfactor); freeblock(ow); @@ -549,6 +549,7 @@ void mapenlarge() { if(empty_world(-1, false)) addmsg(SV_NEWMAP, "ri", -1); } void mapshrink() { if(empty_world(-2, false)) addmsg(SV_NEWMAP, "ri", -2); } void newmap(int *i) { + if(m_botmode) { conoutf("newmap not supported in bot mode"); return; } if(empty_world(*i, false)) { addmsg(SV_NEWMAP, "ri", max(*i, 0));