From 00a88d56e1cc58056d7b3cbaad3199badf1770df Mon Sep 17 00:00:00 2001 From: flowtron Date: Sun, 17 Apr 2011 15:50:28 +0000 Subject: [PATCH] setbottimeout for DM/TM botmatches of your choice length of time (1-60 minutes) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6267 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 29 +++++++++++++++++++++++++++++ source/src/server.cpp | 4 +++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 5dd5b6bc..cf9ce8c1 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -16,6 +16,35 @@ void mode(int n) } COMMAND(mode, ARG_1INT); +void setbottimeout(int m, int t) +{ + if(m==1 || m==2) + { + if(t>0 && t<61) + { + switch(m) + { + case 1: + { + extern int botmatch_dm_minremain; + botmatch_dm_minremain = t; + break; + } + case 2: + { + extern int botmatch_tm_minremain; + botmatch_tm_minremain = t; + break; + } + default: break; + } + } + else conoutf("time is not >=1 or <=60"); + } + else conoutf("mode needs to be 1 for DeathMatch or 2 for TeamMode"); +} +COMMAND(setbottimeout, ARG_2INT); + bool intermission = false; int arenaintermission = 0; struct serverstate servstate = { 0 }; diff --git a/source/src/server.cpp b/source/src/server.cpp index d84bfcb6..f1a73514 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -55,6 +55,8 @@ vector sents; char *maplayout = NULL, *testlayout = NULL; int maplayout_factor, testlayout_factor, maplayoutssize; servermapbuffer mapbuffer; +int botmatch_dm_minremain = 10; // deathmatch +int botmatch_tm_minremain = 15; // teammode // cmod char *global_name; @@ -1841,7 +1843,7 @@ void resetserver(const char *newname, int newmode, int newtime) smode = newmode; copystring(smapname, newname); - minremain = newtime >= 0 ? newtime : (m_teammode ? 15 : 10); + minremain = newtime >= 0 ? newtime : (m_botmode ? (m_teammode ? botmatch_tm_minremain : botmatch_dm_minremain) : (m_teammode ? 15 : 10)); gamemillis = 0; gamelimit = minremain*60000; arenaround = arenaroundstartmillis = 0;