From: <z-...@us...> - 2012-05-05 06:53:45
|
Revision: 10417 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10417&view=rev Author: z-man Date: 2012-05-05 06:53:38 +0000 (Sat, 05 May 2012) Log Message: ----------- Merging branch 0.2.8 from revision 10408 to 10416: ------------------------------------------------------------------------ r10415 | bazaaarmagetron | 2012-05-01 17:13:18 +0200 (Tue, 01 May 2012) | 1 line Daniel Lee Harple: Revert unintended change to CONNECTION_FLOOD_SENSITIVITY from rebase. ------------------------------------------------------------------------ r10414 | bazaaarmagetron | 2012-05-01 17:05:41 +0200 (Tue, 01 May 2012) | 1 line Daniel Lee Harple: Fix pedantic warning. ------------------------------------------------------------------------ r10413 | bazaaarmagetron | 2012-05-01 17:05:08 +0200 (Tue, 01 May 2012) | 1 line Daniel Lee Harple: Added SCRIPT_ENV command ------------------------------------------------------------------------ r10412 | bazaaarmagetron | 2012-05-01 17:04:13 +0200 (Tue, 01 May 2012) | 1 line Daniel Lee Harple: Updated ignores ------------------------------------------------------------------------ r10411 | bazaaarmagetron | 2012-04-30 23:18:25 +0200 (Mon, 30 Apr 2012) | 1 line Daniel Lee Harple: Added LIST_SCRIPTS command ------------------------------------------------------------------------ Revision Links: -------------- http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10408&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10415&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10414&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10413&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10412&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10411&view=rev Modified Paths: -------------- armagetronad/branches/0.4/armagetronad/.bzrignore armagetronad/branches/0.4/armagetronad/NEWS armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg armagetronad/branches/0.4/armagetronad/language/english_base.txt armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp Property Changed: ---------------- armagetronad/branches/0.4/ Property changes on: armagetronad/branches/0.4 ___________________________________________________________________ Modified: svn:mergeinfo - /armagetronad/branches/0.2.8:8751-8852,8855-9185,9192-9201,9220-9514,9529-10044,10054-10408 /armagetronad/branches/0.2.8.3:9309-10393 + /armagetronad/branches/0.2.8:8751-8852,8855-9185,9192-9201,9220-9514,9529-10044,10054-10416 /armagetronad/branches/0.2.8.3:9309-10393 Modified: armagetronad/branches/0.4/armagetronad/.bzrignore =================================================================== --- armagetronad/branches/0.4/armagetronad/.bzrignore 2012-05-03 13:38:47 UTC (rev 10416) +++ armagetronad/branches/0.4/armagetronad/.bzrignore 2012-05-05 06:53:38 UTC (rev 10417) @@ -86,3 +86,6 @@ ./rubbish __pycache__ ./src/armagetronad_serverquery +src/armagetronad_main_master +src/doc/COPYING.txt +rubbish Modified: armagetronad/branches/0.4/armagetronad/NEWS =================================================================== --- armagetronad/branches/0.4/armagetronad/NEWS 2012-05-03 13:38:47 UTC (rev 10416) +++ armagetronad/branches/0.4/armagetronad/NEWS 2012-05-05 06:53:38 UTC (rev 10417) @@ -165,7 +165,7 @@ TEAM_PLAYER_REMOVED <team name> <player> - Manage external scripts on Unix dedicated servers. New commands: SPAWN_SCRIPT, RESPAWN_SCRIPT, FORCE_RESPAWN_SCRIPT, KILL_SCRIPT, - CHECK_SCRIPT. + CHECK_SCRIPT, LIST_SCRIPTS, SCRIPT_ENV. - Authentication is now enabled by default. Changes since 0.2.8.3.1: Modified: armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg =================================================================== --- armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg 2012-05-03 13:38:47 UTC (rev 10416) +++ armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg 2012-05-05 06:53:38 UTC (rev 10417) @@ -413,6 +413,8 @@ # RESPAWN_SCRIPT Spawns an external script from a scripts/ subdirectory on the data path if no already running instance is found. # FORCE_RESPAWN_SCRIPT Spawns an external script from a scripts/ subdirectory on the data path after killing the other possibly running instance. # KILL_SCRIPT Kills a script. Argument must match the SPAWN_SCRIPT argument. +# LIST_SCRIPTS Lists active scripts. +# SCRIPT_ENV Set custom environment variables for scripts. Usage: SCRIPT_ENV <variable name> <value> # Should safety checks be done on script commands? Very much recommended to leave this on. CHECK_SCRIPT 1 Modified: armagetronad/branches/0.4/armagetronad/language/english_base.txt =================================================================== --- armagetronad/branches/0.4/armagetronad/language/english_base.txt 2012-05-03 13:38:47 UTC (rev 10416) +++ armagetronad/branches/0.4/armagetronad/language/english_base.txt 2012-05-05 06:53:38 UTC (rev 10417) @@ -355,6 +355,8 @@ force_respawn_script_help Spawns an external script from a scripts/ subdirectory on the data path after killing the other possibly running instance. kill_script_help Kills a script. Argument must match the SPAWN_SCRIPT argument. check_script_help Should safety checks be done on script commands? Very much recommended to leave this on. +list_scripts_help Lists active scripts. +script_env_help Set custom environment variables for scripts. Usage: SCRIPT_ENV <variable name> <value> chatter_remove_time_help Time in seconds after which a permanent chatter is removed from the game idle_remove_time_help Time in seconds after which an inactive player is removed from the game Modified: armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp =================================================================== --- armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp 2012-05-03 13:38:47 UTC (rev 10416) +++ armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp 2012-05-05 06:53:38 UTC (rev 10417) @@ -32,6 +32,8 @@ #include "tRecorder.h" #include "tDirectories.h" +#include <map> + #include <stdio.h> #include <fcntl.h> #include <sstream> @@ -218,7 +220,7 @@ int stat; /*Kills all the zombie processes*/ - while(waitpid(-1, &stat, WNOHANG) > 0); + while(waitpid(-1, &stat, WNOHANG) > 0) {} } #endif @@ -487,6 +489,15 @@ { } + void AddAll( const std::map< tString, tString > & m ) + { + std::map< tString, tString >::const_iterator it = m.begin(); + for ( ; it != m.end(); ++it ) + { + Add( it->first, it->second ); + } + } + void Add( char const * var, tString const & value ) { strings_[strings_.Len()] = tString(var) + "=" + value; @@ -501,6 +512,20 @@ tArray< tString > strings_; }; +static std::map< tString, tString > sr_globalScriptEnv; + +static void sr_ScriptEnv( std::istream & s ) +{ + tString key, value; + s >> key; + s >> value; + sr_globalScriptEnv[key] = value; +} + +static tConfItemFunc sr_scriptEnvConf( "SCRIPT_ENV", sr_ScriptEnv ); +static tAccessLevelSetter sr_scriptEnvALS( sr_scriptEnvConf, tAccessLevel_Owner ); + + static void sr_SpawnScript( tString const & command ) { // yes, rincludes are the one bit where CASACL is forbidden. And Maps, which @@ -605,6 +630,9 @@ env.AddPath( "ARMAGETRONAD_PATH_VAR", tDirectories::Var() ); env.AddPath( "ARMAGETRONAD_PATH_SCREENSHOT", tDirectories::Screenshot() ); env.AddPath( "ARMAGETRONAD_PATH_RESOURCE", tDirectories::Resource() ); + + // add user-specified variables + env.AddAll( sr_globalScriptEnv ); // add all settings tConfItemBase::tConfItemMap const & confItemMap = tConfItemBase::GetConfItemMap(); @@ -700,6 +728,24 @@ static tConfItemFunc sr_killScript( "KILL_SCRIPT", sr_KillScriptCommand ); static tAccessLevelSetter sr_killScriptALS( sr_killScript, tAccessLevel_Owner ); -#endif -#endif +void sr_ListScriptsCommand( std::istream & s ) +{ + int numberScripts = 0; + for( int i = sr_inputStreams.Len()-1; i >= 0; --i ) + { + rScriptStream * script = dynamic_cast< rScriptStream * >( (rStream*)sr_inputStreams[i] ); + if( script ) + { + numberScripts++; + con << "Script: " << script->GetName() << '\n'; + } + } + if (!numberScripts) + con << "No scripts are currently running.\n"; +} +static tConfItemFunc sr_listScripts( "LIST_SCRIPTS", sr_ListScriptsCommand ); +static tAccessLevelSetter sr_listScriptALS( sr_listScripts, tAccessLevel_Owner ); + +#endif /* KRAWALL_SERVER */ +#endif /* HAVE_UNISTD_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |