console_cmds.c
author matthijs
Wed, 22 Mar 2006 22:26:16 +0000
branch0.4.5
changeset 9958 bed516c67d61
parent 9925 30810c6f84c6
permissions -rw-r--r--
(svn r4041) [Debian] Change next version number to 0.4.6 instead of 0.4.5.1.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2162
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2162
diff changeset
     2
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
     3
#include "stdafx.h"
1891
92a3b0aa0946 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1869
diff changeset
     4
#include "openttd.h"
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
     5
#include "console.h"
1299
0a6510cc889b (svn r1803) Move debugging stuff into files of it's own
tron
parents: 1147
diff changeset
     6
#include "debug.h"
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
     7
#include "engine.h"
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
     8
#include "functions.h"
2162
c1ded3bd3d0c (svn r2672) Move saving/loading related declarations to saveload.h
tron
parents: 2099
diff changeset
     9
#include "saveload.h"
1317
f382f1b439c7 (svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron
parents: 1299
diff changeset
    10
#include "string.h"
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    11
#include "variables.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    12
#include "network_data.h"
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    13
#include "network_client.h"
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    14
#include "network_server.h"
766
47b970b3b66a (svn r1231) -Fix: missing header file for console_cmds.c
truelight
parents: 765
diff changeset
    15
#include "network_udp.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    16
#include "command.h"
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
    17
#include "settings.h"
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
    18
#include "hal.h" /* for file list */
1939
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
    19
#include "vehicle.h"
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    20
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    21
// ** scriptfile handling ** //
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    22
static FILE *_script_file;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    23
static bool _script_running;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    24
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    25
// ** console command / variable defines ** //
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    26
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[])
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    27
#define DEF_CONSOLE_HOOK(function) static bool function(void)
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    28
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    29
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    30
/* **************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    31
/* variable and command hooks   */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    32
/* **************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    33
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    34
#ifdef ENABLE_NETWORK
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    35
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    36
static inline bool NetworkAvailable(void)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    37
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    38
	if (!_network_available) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    39
		IConsoleError("You cannot use this command because there is no network available.");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    40
		return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    41
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    42
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    43
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    44
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    45
DEF_CONSOLE_HOOK(ConHookServerOnly)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    46
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    47
	if (!NetworkAvailable()) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    48
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    49
	if (!_network_server) {
1788
c49040d856dd (svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents: 1762
diff changeset
    50
		IConsoleError("This command/variable is only available to a network server.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    51
		return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    52
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    53
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    54
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    55
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    56
DEF_CONSOLE_HOOK(ConHookClientOnly)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    57
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    58
	if (!NetworkAvailable()) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    59
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    60
	if (_network_server) {
1788
c49040d856dd (svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents: 1762
diff changeset
    61
		IConsoleError("This command/variable is not available to a network server.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    62
		return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    63
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    64
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    65
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    66
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    67
DEF_CONSOLE_HOOK(ConHookNeedNetwork)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    68
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    69
	if (!NetworkAvailable()) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    70
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    71
	if (!_networking) {
1788
c49040d856dd (svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents: 1762
diff changeset
    72
		IConsoleError("Not connected. This command/variable is only available in multiplayer.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    73
		return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    74
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    75
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    76
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    77
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    78
DEF_CONSOLE_HOOK(ConHookNoNetwork)
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    79
{
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    80
	if (_networking) {
1788
c49040d856dd (svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents: 1762
diff changeset
    81
		IConsoleError("This command/variable is forbidden in multiplayer.");
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    82
		return false;
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
    83
	}
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    84
	return true;
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    85
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    86
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    87
#endif /* ENABLE_NETWORK */
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    88
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    89
static void IConsoleHelp(const char *str)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    90
{
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
    91
	IConsolePrintF(_icolour_warn, "- %s", str);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
    92
}
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
    93
1939
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
    94
DEF_CONSOLE_CMD(ConStopAllVehicles)
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
    95
{
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
    96
	Vehicle* v;
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
    97
	if (argc == 0) {
1943
86e186684bf6 (svn r2449) * Added an extra warning to the stopall command, "For debugging only!".
matthijs
parents: 1939
diff changeset
    98
		IConsoleHelp("Stops all vehicles in the game. For debugging only! Use at your own risk... Usage: 'stopall'");
1939
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
    99
		return true;
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   100
	}
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   101
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   102
	FOR_ALL_VEHICLES(v) {
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   103
		if (IsValidVehicle(v)) {
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   104
			/* Code ripped from CmdStartStopTrain. Can't call it, because of
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   105
			 * ownership problems, so we'll duplicate some code, for now */
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   106
			if (v->type == VEH_Train)
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   107
				v->u.rail.days_since_order_progr = 0;
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   108
			v->vehstatus |= VS_STOPPED;
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   109
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   110
			InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   111
		}
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   112
	}
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   113
	return true;
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   114
}
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
   115
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   116
DEF_CONSOLE_CMD(ConResetEngines)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   117
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   118
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   119
		IConsoleHelp("Reset status data of all engines. This might solve some issues with 'lost' engines. Usage: 'resetengines'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   120
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   121
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   122
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   123
	StartupEngines();
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   124
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   125
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   126
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
   127
#ifdef _DEBUG
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   128
DEF_CONSOLE_CMD(ConResetTile)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   129
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   130
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   131
		IConsoleHelp("Reset a tile to bare land. Usage: 'resettile <tile>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   132
		IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   133
		return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   134
	}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   135
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   136
	if (argc == 2) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   137
		uint32 result;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   138
		if (GetArgumentInteger(&result, argv[1])) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   139
			DoClearSquare((TileIndex)result);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   140
			return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   141
		}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   142
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   143
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   144
	return false;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   145
}
1740
29e13b639a78 (svn r2244) - Fix: 'scrollto' is not debug only..sorry :)
Darkvater
parents: 1739
diff changeset
   146
#endif /* _DEBUG */
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   147
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   148
DEF_CONSOLE_CMD(ConScrollToTile)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   149
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   150
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   151
		IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto <tile>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   152
		IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   153
		return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   154
	}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   155
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   156
	if (argc == 2) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   157
		uint32 result;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   158
		if (GetArgumentInteger(&result, argv[1])) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   159
			ScrollMainWindowToTile((TileIndex)result);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   160
			return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   161
		}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   162
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   163
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   164
	return false;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   165
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   166
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   167
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1089
diff changeset
   168
extern void BuildFileList(void);
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   169
extern void SetFiosType(const byte fiostype);
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   170
1565
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   171
/* Save the map to a file */
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   172
DEF_CONSOLE_CMD(ConSave)
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   173
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   174
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   175
		IConsoleHelp("Save the current game. Usage: 'save <filename>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   176
		return true;
1565
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   177
	}
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   178
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   179
	if (argc == 2) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   180
		char buf[200];
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   181
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   182
		snprintf(buf, lengthof(buf), "%s%s%s.sav", _path.save_dir, PATHSEP, argv[1]);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   183
		IConsolePrint(_icolour_def, "Saving map...");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   184
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   185
		if (SaveOrLoad(buf, SL_SAVE) != SL_OK) {
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   186
			IConsolePrint(_icolour_err, "SaveMap failed");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   187
		} else
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   188
			IConsolePrintF(_icolour_def, "Map sucessfully saved to %s", buf);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   189
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   190
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   191
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   192
	return false;
1565
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   193
}
925f94da4077 (svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents: 1395
diff changeset
   194
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   195
static const FiosItem* GetFiosItem(const char* file)
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   196
{
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   197
	int i;
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   198
1798
406c46c6354f (svn r2302) - Fix: when you started a server 'load <file>' did not work prior to doing 'ls'. Fixed by moving the changing of saveload_mode into BuildFileList()
Darkvater
parents: 1794
diff changeset
   199
	_saveload_mode = SLD_LOAD_GAME;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   200
	BuildFileList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   201
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   202
	for (i = 0; i < _fios_num; i++) {
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   203
		if (strcmp(file, _fios_list[i].name) == 0) break;
2099
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   204
		if (strcmp(file, _fios_list[i].title) == 0) break;
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   205
	}
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   206
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   207
	if (i == _fios_num) { /* If no name matches, try to parse it as number */
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   208
		char* endptr;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   209
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   210
		i = strtol(file, &endptr, 10);
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   211
		if (file == endptr || *endptr != '\0') i = -1;
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   212
	}
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   213
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   214
	return IS_INT_INSIDE(i, 0, _fios_num) ? &_fios_list[i] : NULL;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   215
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   216
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   217
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   218
DEF_CONSOLE_CMD(ConLoad)
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   219
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   220
	const FiosItem *item;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   221
	const char *file;
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   222
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   223
	if (argc == 0) {
2540
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
   224
		IConsoleHelp("Load a game by name or index. Usage: 'load <file | number>'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   225
		return true;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   226
	}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   227
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   228
	if (argc != 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   229
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   230
	file = argv[1];
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   231
	item = GetFiosItem(file);
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   232
	if (item != NULL) {
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   233
		switch (item->type) {
2099
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   234
			case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: {
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   235
				_switch_mode = SM_LOAD;
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   236
				SetFiosType(item->type);
2099
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   237
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   238
				ttd_strlcpy(_file_to_saveload.name, FiosBrowseTo(item), sizeof(_file_to_saveload.name));
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   239
				ttd_strlcpy(_file_to_saveload.title, item->title, sizeof(_file_to_saveload.title));
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   240
			} break;
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   241
			default: IConsolePrintF(_icolour_err, "%s: Not a savegame.", file);
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   242
		}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   243
	} else
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   244
		IConsolePrintF(_icolour_err, "%s: No such file or directory.", file);
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   245
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   246
	FiosFreeSavegameList();
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   247
	return true;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   248
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   249
2415
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   250
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   251
DEF_CONSOLE_CMD(ConRemove)
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   252
{
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   253
	const FiosItem* item;
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   254
	const char* file;
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   255
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   256
	if (argc == 0) {
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   257
		IConsoleHelp("Remove a savegame by name or index. Usage: 'rm <file | number>'");
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   258
		return true;
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   259
	}
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   260
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   261
	if (argc != 2) return false;
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   262
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   263
	file = argv[1];
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   264
	item = GetFiosItem(file);
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   265
	if (item != NULL) {
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   266
		if (!FiosDelete(item->name))
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   267
			IConsolePrintF(_icolour_err, "%s: Failed to delete file", file);
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   268
	} else
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   269
		IConsolePrintF(_icolour_err, "%s: No such file or directory.", file);
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   270
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   271
	FiosFreeSavegameList();
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   272
	return true;
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   273
}
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   274
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
   275
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   276
/* List all the files in the current dir via console */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   277
DEF_CONSOLE_CMD(ConListFiles)
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   278
{
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   279
	int i;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   280
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   281
	if (argc == 0) {
2540
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
   282
		IConsoleHelp("List all loadable savegames and directories in the current dir via console. Usage: 'ls | dir'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   283
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   284
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   285
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   286
	BuildFileList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   287
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   288
	for (i = 0; i < _fios_num; i++) {
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   289
		const FiosItem *item = &_fios_list[i];
2099
22f535ad9eea (svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents: 2026
diff changeset
   290
		IConsolePrintF(_icolour_def, "%d) %s", i, item->title);
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   291
	}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   292
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   293
	FiosFreeSavegameList();
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   294
	return true;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   295
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   296
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   297
/* Change the dir via console */
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   298
DEF_CONSOLE_CMD(ConChangeDirectory)
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   299
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   300
	const FiosItem *item;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   301
	const char *file;
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   302
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   303
	if (argc == 0) {
2540
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
   304
		IConsoleHelp("Change the dir via console. Usage: 'cd <directory | number>'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   305
		return true;
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   306
	}
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   307
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   308
	if (argc != 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   309
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   310
	file = argv[1];
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   311
	item = GetFiosItem(file);
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   312
	if (item != NULL) {
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   313
		switch (item->type) {
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   314
			case FIOS_TYPE_DIR: case FIOS_TYPE_DRIVE: case FIOS_TYPE_PARENT:
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   315
				FiosBrowseTo(item);
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   316
				break;
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   317
			default: IConsolePrintF(_icolour_err, "%s: Not a directory.", file);
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   318
		}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   319
	} else
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   320
		IConsolePrintF(_icolour_err, "%s: No such file or directory.", file);
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   321
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   322
	FiosFreeSavegameList();
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   323
	return true;
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   324
}
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   325
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   326
DEF_CONSOLE_CMD(ConPrintWorkingDirectory)
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   327
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   328
	const char *path;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   329
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   330
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   331
		IConsoleHelp("Print out the current working directory. Usage: 'pwd'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   332
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   333
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   334
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   335
	// XXX - Workaround for broken file handling
1581
ccb9a6545117 (svn r2085) Improve browsing via console:
tron
parents: 1567
diff changeset
   336
	FiosGetSavegameList(&_fios_num, SLD_LOAD_GAME);
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   337
	FiosFreeSavegameList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   338
1596
c1c439a2d5b2 (svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents: 1581
diff changeset
   339
	FiosGetDescText(&path, NULL);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   340
	IConsolePrint(_icolour_def, path);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   341
	return true;
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   342
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   343
1827
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   344
DEF_CONSOLE_CMD(ConClearBuffer)
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   345
{
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   346
	if (argc == 0) {
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   347
		IConsoleHelp("Clear the console buffer. Usage: 'clear'");
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   348
		return true;
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   349
	}
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   350
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   351
	IConsoleClearBuffer();
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   352
	InvalidateWindow(WC_CONSOLE, 0);
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   353
	return true;
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   354
}
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
   355
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   356
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   357
// ********************************* //
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   358
// * Network Core Console Commands * //
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   359
// ********************************* //
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   360
#ifdef ENABLE_NETWORK
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   361
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   362
DEF_CONSOLE_CMD(ConBan)
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   363
{
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   364
	NetworkClientInfo *ci;
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   365
	const char *banip = NULL;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   366
	uint32 index;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   367
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   368
	if (argc == 0) {
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   369
		IConsoleHelp("Ban a player from a network game. Usage: 'ban <ip | client-id>'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   370
		IConsoleHelp("For client-id's, see the command 'clients'");
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   371
		IConsoleHelp("If the client is no longer online, you can still ban his/her IP");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   372
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   373
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   374
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   375
	if (argc != 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   376
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   377
	if (strchr(argv[1], '.') == NULL) { // banning with ID
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   378
		index = atoi(argv[1]);
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   379
		ci = NetworkFindClientInfoFromIndex(index);
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   380
	} else { // banning IP
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   381
		ci = NetworkFindClientInfoFromIP(argv[1]);
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   382
		if (ci == NULL) {
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   383
			banip = argv[1];
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   384
			index = (uint32)-1;
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   385
		} else {
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   386
			index = ci->client_index;
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   387
		}
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   388
	}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   389
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   390
	if (index == NETWORK_SERVER_INDEX) {
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   391
		IConsoleError("Silly boy, you can not ban yourself!");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   392
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   393
	}
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   394
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   395
	if (index == 0 || (ci == NULL && index != (uint32)-1)) {
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   396
		IConsoleError("Invalid client");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   397
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   398
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   399
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   400
	if (ci != NULL) {
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   401
		banip = inet_ntoa(*(struct in_addr *)&ci->client_ip);
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   402
		SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED);
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   403
		IConsolePrint(_icolour_def, "Client banned");
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   404
	} else
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   405
		IConsolePrint(_icolour_def, "Client not online, banned IP");
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   406
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   407
	/* Add user to ban-list */
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   408
	for (index = 0; index < lengthof(_network_ban_list); index++) {
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   409
		if (_network_ban_list[index] == NULL) {
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   410
			_network_ban_list[index] = strdup(banip);
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   411
			break;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   412
		}
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   413
	}
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   414
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   415
	return true;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   416
}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   417
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   418
DEF_CONSOLE_CMD(ConUnBan)
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   419
{
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   420
	uint i, index;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   421
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   422
	if (argc == 0) {
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   423
		IConsoleHelp("Unban a player from a network game. Usage: 'unban <ip | client-id>'");
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   424
		IConsoleHelp("For a list of banned IP's, see the command 'banlist'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   425
		return true;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   426
	}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   427
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   428
	if (argc != 2) return false;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   429
2541
99c04a35ebc5 (svn r3070) - it doesn't matter where the '.' is found for the IP, if it is found, it is not a normal index when unbanning clients ('\0' should of course be NULL); thx Tron
Darkvater
parents: 2540
diff changeset
   430
	index = (strchr(argv[1], '.') == NULL) ? atoi(argv[1]) : 0;
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   431
	index--;
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   432
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   433
	for (i = 0; i < lengthof(_network_ban_list); i++) {
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   434
		if (_network_ban_list[i] == NULL) continue;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   435
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   436
		if (strncmp(_network_ban_list[i], argv[1], strlen(_network_ban_list[i])) == 0 || index == i) {
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   437
			free(_network_ban_list[i]);
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   438
			_network_ban_list[i] = NULL;
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   439
			IConsolePrint(_icolour_def, "IP unbanned.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   440
			return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   441
		}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   442
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   443
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   444
	IConsolePrint(_icolour_def, "IP not in ban-list.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   445
	return true;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   446
}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   447
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   448
DEF_CONSOLE_CMD(ConBanList)
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   449
{
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   450
	uint i;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   451
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   452
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   453
		IConsoleHelp("List the IP's of banned clients: Usage 'banlist'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   454
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   455
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   456
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   457
	IConsolePrint(_icolour_def, "Banlist: ");
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   458
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   459
	for (i = 0; i < lengthof(_network_ban_list); i++) {
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   460
		if (_network_ban_list[i] != NULL)
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2880
diff changeset
   461
			IConsolePrintF(_icolour_def, "  %d) %s", i + 1, _network_ban_list[i]);
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   462
	}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   463
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   464
	return true;
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   465
}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   466
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   467
DEF_CONSOLE_CMD(ConPauseGame)
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   468
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   469
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   470
		IConsoleHelp("Pause a network game. Usage: 'pause'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   471
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   472
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   473
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   474
	if (_pause == 0) {
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   475
		DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   476
		IConsolePrint(_icolour_def, "Game paused.");
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   477
	} else
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   478
		IConsolePrint(_icolour_def, "Game is already paused.");
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   479
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   480
	return true;
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   481
}
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   482
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   483
DEF_CONSOLE_CMD(ConUnPauseGame)
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   484
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   485
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   486
		IConsoleHelp("Unpause a network game. Usage: 'unpause'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   487
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   488
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   489
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   490
	if (_pause != 0) {
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   491
		DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   492
		IConsolePrint(_icolour_def, "Game unpaused.");
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   493
	} else
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   494
		IConsolePrint(_icolour_def, "Game is already unpaused.");
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   495
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   496
	return true;
1147
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   497
}
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   498
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   499
DEF_CONSOLE_CMD(ConRcon)
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   500
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   501
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   502
		IConsoleHelp("Remote control the server from another client. Usage: 'rcon <password> <command>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   503
		IConsoleHelp("Remember to enclose the command in quotes, otherwise only the first parameter is sent");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   504
		return true;
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   505
	}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   506
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   507
	if (argc < 3) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   508
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   509
	SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   510
	return true;
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   511
}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   512
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   513
DEF_CONSOLE_CMD(ConStatus)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   514
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   515
	static const char *stat_str[] = {"inactive", "authorized", "waiting", "loading map", "map done", "ready", "active"};
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   516
	const char *status;
716
40a349345f82 (svn r1168) -Cleanup: [Network] Cleaned the network code a bit. Added 'const'
truelight
parents: 693
diff changeset
   517
	const NetworkClientState *cs;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   518
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   519
	if (argc == 0) {
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   520
		IConsoleHelp("List the status of all clients connected to the server. Usage 'status'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   521
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   522
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   523
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   524
	FOR_ALL_CLIENTS(cs) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   525
		int lag = NetworkCalculateLag(cs);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   526
		const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   527
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   528
		status = (cs->status <= STATUS_ACTIVE) ? stat_str[cs->status] : "unknown";
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   529
		IConsolePrintF(8, "Client #%1d  name: '%s'  status: '%s'  frame-lag: %3d  company: %1d  IP: %s  unique-id: '%s'",
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   530
			cs->index, ci->client_name, status, lag, ci->client_playas, GetPlayerIP(ci), ci->unique_id);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   531
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   532
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   533
	return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   534
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   535
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   536
DEF_CONSOLE_CMD(ConServerInfo)
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   537
{
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   538
	const NetworkGameInfo *gi;
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   539
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   540
	if (argc == 0) {
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   541
		IConsoleHelp("List current and maximum client/player limits. Usage 'server_info'");
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   542
		IConsoleHelp("You can change these values by setting the variables 'max_clients', 'max_companies' and 'max_spectators'");
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   543
		return true;
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   544
	}
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   545
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   546
	gi = &_network_game_info;
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   547
	IConsolePrintF(_icolour_def, "Current/maximum clients:    %2d/%2d", gi->clients_on, gi->clients_max);
2944
7c392e7b51c6 (svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents: 2914
diff changeset
   548
	IConsolePrintF(_icolour_def, "Current/maximum companies:  %2d/%2d", ActivePlayerCount(), gi->companies_max);
7c392e7b51c6 (svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents: 2914
diff changeset
   549
	IConsolePrintF(_icolour_def, "Current/maximum spectators: %2d/%2d", NetworkSpectatorCount(), gi->spectators_max);
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   550
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   551
	return true;
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   552
}
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   553
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   554
DEF_CONSOLE_HOOK(ConHookValidateMaxClientsCount) {
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   555
	/* XXX - hardcoded, string limiation -- TrueLight
9925
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   556
	 * XXX - also see network.c:NetworkStartup ~1356 */
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   557
	if (_network_game_info.clients_max > 10) {
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   558
		_network_game_info.clients_max = 10;
9925
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   559
		IConsoleError("Maximum clients out of bounds, truncating to limit.");
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   560
	}
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   561
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   562
	return true;
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   563
}
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   564
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   565
DEF_CONSOLE_HOOK(ConHookValidateMaxCompaniesCount) {
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   566
	if (_network_game_info.companies_max > MAX_PLAYERS) {
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   567
		_network_game_info.companies_max = MAX_PLAYERS;
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   568
		IConsoleError("Maximum companies out of bounds, truncating to limit.");
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   569
	}
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   570
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   571
	return true;
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   572
}
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   573
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   574
DEF_CONSOLE_HOOK(ConHookValidateMaxSpectatorsCount) {
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   575
	/* XXX @see ConHookValidateMaxClientsCount */
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   576
	if (_network_game_info.spectators_max > 10) {
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   577
		_network_game_info.spectators_max = 10;
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
   578
		IConsoleError("Maximum spectators out of bounds, truncating to limit.");
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   579
	}
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   580
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   581
	return true;
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   582
}
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   583
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   584
DEF_CONSOLE_CMD(ConKick)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   585
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   586
	NetworkClientInfo *ci;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   587
	uint32 index;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   588
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   589
	if (argc == 0) {
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   590
		IConsoleHelp("Kick a player from a network game. Usage: 'kick <ip | client-id>'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   591
		IConsoleHelp("For client-id's, see the command 'clients'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   592
		return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   593
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   594
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   595
	if (argc != 2) return false;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   596
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   597
	if (strchr(argv[1], '.') == NULL) {
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   598
		index = atoi(argv[1]);
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   599
		ci = NetworkFindClientInfoFromIndex(index);
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   600
	} else {
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   601
		ci = NetworkFindClientInfoFromIP(argv[1]);
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   602
		index = (ci == NULL) ? 0 : ci->client_index;
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   603
	}
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   604
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   605
	if (index == NETWORK_SERVER_INDEX) {
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
   606
		IConsoleError("Silly boy, you can not kick yourself!");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   607
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   608
	}
2859
d45695cd3e98 (svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents: 2541
diff changeset
   609
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   610
	if (index == 0) {
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   611
		IConsoleError("Invalid client");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   612
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   613
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   614
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   615
	if (ci != NULL) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   616
		SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   617
	} else
2860
3166189ae39f (svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents: 2859
diff changeset
   618
		IConsoleError("Client not found");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   619
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   620
	return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   621
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   622
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   623
DEF_CONSOLE_CMD(ConResetCompany)
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   624
{
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   625
	Player *p;
716
40a349345f82 (svn r1168) -Cleanup: [Network] Cleaned the network code a bit. Added 'const'
truelight
parents: 693
diff changeset
   626
	NetworkClientState *cs;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   627
	NetworkClientInfo *ci;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   628
	byte index;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   629
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   630
	if (argc == 0) {
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   631
		IConsoleHelp("Remove an idle company from the game. Usage: 'reset_company <company-id>'");
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   632
		IConsoleHelp("For company-id's, see the list of companies from the dropdown menu. Player 1 is 1, etc.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   633
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   634
	}
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   635
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   636
	if (argc != 2) return false;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   637
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   638
	index = atoi(argv[1]);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   639
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   640
	/* Check valid range */
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   641
	if (index < 1 || index > MAX_PLAYERS) {
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   642
		IConsolePrintF(_icolour_err, "Company does not exist. Company-id must be between 1 and %d.", MAX_PLAYERS);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   643
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   644
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   645
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   646
	/* Check if company does exist */
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   647
	index--;
1962
51ee4f459268 (svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents: 1943
diff changeset
   648
	p = GetPlayer(index);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   649
	if (!p->is_active) {
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   650
		IConsoleError("Company does not exist.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   651
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   652
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   653
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   654
	if (p->is_ai) {
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   655
		IConsoleError("Company is owned by an AI.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   656
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   657
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   658
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   659
	/* Check if the company has active players */
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   660
	FOR_ALL_CLIENTS(cs) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   661
		ci = DEREF_CLIENT_INFO(cs);
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   662
		if (ci->client_playas - 1 == index) {
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   663
			IConsoleError("Cannot remove company: a client is connected to that company.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   664
			return true;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   665
		}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   666
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   667
	ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   668
	if (ci->client_playas - 1 == index) {
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
   669
		IConsoleError("Cannot remove company: the server is connected to that company.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   670
		return true;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   671
	}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   672
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   673
	/* It is safe to remove this company */
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   674
	DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   675
	IConsolePrint(_icolour_def, "Company deleted.");
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   676
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   677
	return true;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   678
}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   679
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   680
DEF_CONSOLE_CMD(ConNetworkClients)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   681
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   682
	NetworkClientInfo *ci;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   683
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   684
	if (argc == 0) {
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   685
		IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   686
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   687
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   688
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   689
	for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   690
		if (ci->client_index != NETWORK_EMPTY_INDEX) {
2538
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   691
			IConsolePrintF(8, "Client #%1d  name: '%s'  company: %1d  IP: %s",
81e192bfcf10 (svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents: 2461
diff changeset
   692
				ci->client_index, ci->client_name, ci->client_playas, GetPlayerIP(ci));
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   693
		}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   694
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   695
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   696
	return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   697
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   698
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   699
DEF_CONSOLE_CMD(ConNetworkConnect)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   700
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   701
	char *ip;
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1317
diff changeset
   702
	const char *port = NULL;
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1317
diff changeset
   703
	const char *player = NULL;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   704
	uint16 rport;
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   705
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   706
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   707
		IConsoleHelp("Connect to a remote OTTD server and join the game. Usage: 'connect <ip>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   708
		IConsoleHelp("IP can contain port and player: 'IP#Player:Port', eg: 'server.ottd.org#2:443'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   709
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   710
	}
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   711
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   712
	if (argc < 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   713
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   714
	if (_networking) // We are in network-mode, first close it!
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   715
		NetworkDisconnect();
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   716
228
f65dec6727d9 (svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents: 222
diff changeset
   717
	ip = argv[1];
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   718
	rport = NETWORK_DEFAULT_PORT;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   719
228
f65dec6727d9 (svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents: 222
diff changeset
   720
	ParseConnectionString(&player, &port, ip);
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   721
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   722
	IConsolePrintF(_icolour_def, "Connecting to %s...", ip);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   723
	if (player != NULL) {
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   724
		_network_playas = atoi(player);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   725
		IConsolePrintF(_icolour_def, "    player-no: %s", player);
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   726
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   727
	if (port != NULL) {
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   728
		rport = atoi(port);
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   729
		IConsolePrintF(_icolour_def, "    port: %s", port);
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   730
	}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   731
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   732
	NetworkClientConnectGame(ip, rport);
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   733
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   734
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   735
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   736
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   737
#endif /* ENABLE_NETWORK */
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   738
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   739
/* ******************************** */
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   740
/*   script file console commands   */
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   741
/* ******************************** */
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   742
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   743
DEF_CONSOLE_CMD(ConExec)
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   744
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   745
	char cmdline[ICON_CMDLN_SIZE];
1743
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   746
	char *cmdptr;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   747
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   748
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   749
		IConsoleHelp("Execute a local script file. Usage: 'exec <script> <?>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   750
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   751
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   752
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   753
	if (argc < 2) return false;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   754
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   755
	_script_file = fopen(argv[1], "r");
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   756
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   757
	if (_script_file == NULL) {
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   758
		if (argc == 2 || atoi(argv[2]) != 0) IConsoleError("script file not found");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   759
		return true;
1383
ea1505a974f9 (svn r1887) Stylistic change of ConExec()
tron
parents: 1382
diff changeset
   760
	}
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   761
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   762
	_script_running = true;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   763
1743
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   764
	while (_script_running && fgets(cmdline, sizeof(cmdline), _script_file) != NULL) {
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   765
		/* Remove newline characters from the executing script */
1819
e2e977e1462e (svn r2323) Remove unused dereferencing
tron
parents: 1814
diff changeset
   766
		for (cmdptr = cmdline; *cmdptr != '\0'; cmdptr++) {
1743
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   767
			if (*cmdptr == '\n' || *cmdptr == '\r') {
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   768
				*cmdptr = '\0';
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   769
				break;
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   770
			}
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   771
		}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   772
		IConsoleCmdExec(cmdline);
1743
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
   773
	}
1382
2a2ac927a256 (svn r1886) Correctly process the last line of a script, even if it's not newline terminated. Also print an error message if something goes wrong while reading from the script file
tron
parents: 1379
diff changeset
   774
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   775
	if (ferror(_script_file))
1382
2a2ac927a256 (svn r1886) Correctly process the last line of a script, even if it's not newline terminated. Also print an error message if something goes wrong while reading from the script file
tron
parents: 1379
diff changeset
   776
		IConsoleError("Encountered errror while trying to read from script file");
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   777
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   778
	_script_running = false;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   779
	fclose(_script_file);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   780
	return true;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   781
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   782
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   783
DEF_CONSOLE_CMD(ConReturn)
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   784
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   785
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   786
		IConsoleHelp("Stop executing a running script. Usage: 'return'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   787
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   788
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   789
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   790
	_script_running = false;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   791
	return true;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   792
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   793
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   794
/* **************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   795
/*   default console commands   */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   796
/* **************************** */
1046
d46ccd96c40f (svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents: 1026
diff changeset
   797
extern bool CloseConsoleLogIfActive(void);
1023
8df956881058 (svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents: 1019
diff changeset
   798
8df956881058 (svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents: 1019
diff changeset
   799
DEF_CONSOLE_CMD(ConScript)
8df956881058 (svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents: 1019
diff changeset
   800
{
8df956881058 (svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents: 1019
diff changeset
   801
	extern FILE* _iconsole_output_file;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   802
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   803
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   804
		IConsoleHelp("Start or stop logging console output to a file. Usage: 'script <filename>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   805
		IConsoleHelp("If filename is omitted, a running log is stopped if it is active");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   806
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   807
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   808
1023
8df956881058 (svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents: 1019
diff changeset
   809
	if (!CloseConsoleLogIfActive()) {
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   810
		if (argc < 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   811
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
   812
		IConsolePrintF(_icolour_def, "file output started to: %s", argv[1]);
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
   813
		_iconsole_output_file = fopen(argv[1], "ab");
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   814
		if (_iconsole_output_file == NULL) IConsoleError("could not open file");
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   815
	}
1023
8df956881058 (svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents: 1019
diff changeset
   816
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   817
	return true;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   818
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   819
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   820
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   821
DEF_CONSOLE_CMD(ConEcho)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   822
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   823
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   824
		IConsoleHelp("Print back the first argument to the console. Usage: 'echo <arg>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   825
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   826
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   827
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   828
	if (argc < 2) return false;
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   829
	IConsolePrint(_icolour_def, argv[1]);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   830
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   831
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   832
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   833
DEF_CONSOLE_CMD(ConEchoC)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   834
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   835
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   836
		IConsoleHelp("Print back the first argument to the console in a given colour. Usage: 'echoc <colour> <arg2>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   837
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   838
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   839
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   840
	if (argc < 3) return false;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   841
	IConsolePrint(atoi(argv[1]), argv[2]);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   842
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   843
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   844
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   845
extern void SwitchMode(int new_mode);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   846
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   847
DEF_CONSOLE_CMD(ConNewGame)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   848
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   849
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   850
		IConsoleHelp("Start a new game. Usage: 'newgame'");
1794
44f9deff97ed (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1788
diff changeset
   851
		IConsoleHelp("The server can force a new game using 'newgame', any client using it will part and start a single-player game");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   852
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   853
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   854
1794
44f9deff97ed (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1788
diff changeset
   855
	GenRandomNewGame(Random(), InteractiveRandom());
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   856
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   857
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   858
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   859
DEF_CONSOLE_CMD(ConAlias)
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   860
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   861
	IConsoleAlias *alias;
644
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   862
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   863
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   864
		IConsoleHelp("Add a new alias, or redefine the behaviour of an existing alias . Usage: 'alias <name> <command>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   865
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   866
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   867
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   868
	if (argc < 3) return false;
644
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   869
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   870
	alias = IConsoleAliasGet(argv[1]);
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   871
	if (alias == NULL) {
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   872
		IConsoleAliasRegister(argv[1], argv[2]);
644
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   873
	} else {
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   874
		free(alias->cmdline);
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   875
		alias->cmdline = strdup(argv[2]);
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   876
	}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   877
	return true;
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   878
}
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   879
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   880
DEF_CONSOLE_CMD(ConScreenShot)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   881
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   882
	if (argc == 0) {
2540
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
   883
		IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | no_con]'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   884
		IConsoleHelp("'big' makes a screenshot of the whole map, 'no_con' hides the console to create the screenshot");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   885
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   886
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   887
2539
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   888
	if (argc > 3) return false;
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   889
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   890
	_make_screenshot = 1;
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   891
	if (argc > 1) {
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   892
		if (strcmp(argv[1], "big") == 0 || (argc == 3 && strcmp(argv[2], "big") == 0))
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   893
			_make_screenshot = 2;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   894
2539
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   895
		if (strcmp(argv[1], "no_con") == 0 || (argc == 3 && strcmp(argv[2], "no_con") == 0))
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   896
			IConsoleClose();
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
   897
	}
2539
20b0e2a6b9b0 (svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents: 2538
diff changeset
   898
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   899
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   900
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   901
229
b94bfdf02bae (svn r230) -Feature: IConsoleWarning for warning messages
signde
parents: 228
diff changeset
   902
DEF_CONSOLE_CMD(ConInfoVar)
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   903
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   904
	static const char *_icon_vartypes[] = {"boolean", "byte", "uint16", "uint32", "int16", "int32", "string"};
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   905
	const IConsoleVar *var;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   906
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   907
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   908
		IConsoleHelp("Print out debugging information about a variable. Usage: 'info_var <var>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   909
		return true;
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
   910
	}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   911
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   912
	if (argc < 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   913
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   914
	var = IConsoleVarGet(argv[1]);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   915
	if (var == NULL) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   916
		IConsoleError("the given variable was not found");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   917
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   918
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   919
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   920
	IConsolePrintF(_icolour_def, "variable name: %s", var->name);
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   921
	IConsolePrintF(_icolour_def, "variable type: %s", _icon_vartypes[var->type]);
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   922
	IConsolePrintF(_icolour_def, "variable addr: 0x%X", var->addr);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   923
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   924
	if (var->hook.access) IConsoleWarning("variable is access hooked");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   925
	if (var->hook.pre) IConsoleWarning("variable is pre hooked");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   926
	if (var->hook.post) IConsoleWarning("variable is post hooked");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   927
	return true;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   928
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   929
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   930
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   931
DEF_CONSOLE_CMD(ConInfoCmd)
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   932
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   933
	const IConsoleCmd *cmd;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   934
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   935
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   936
		IConsoleHelp("Print out debugging information about a command. Usage: 'info_cmd <cmd>'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   937
		return true;
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
   938
	}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   939
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   940
	if (argc < 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   941
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   942
	cmd = IConsoleCmdGet(argv[1]);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   943
	if (cmd == NULL) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   944
		IConsoleError("the given command was not found");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   945
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   946
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   947
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   948
	IConsolePrintF(_icolour_def, "command name: %s", cmd->name);
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
   949
	IConsolePrintF(_icolour_def, "command proc: 0x%X", cmd->proc);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   950
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   951
	if (cmd->hook.access) IConsoleWarning("command is access hooked");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   952
	if (cmd->hook.pre) IConsoleWarning("command is pre hooked");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   953
	if (cmd->hook.post) IConsoleWarning("command is post hooked");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   954
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   955
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   956
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   957
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   958
DEF_CONSOLE_CMD(ConDebugLevel)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   959
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   960
	if (argc == 0) {
1847
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   961
		IConsoleHelp("Get/set the default debugging level for the game. Usage: 'debug_level [<level>]'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   962
		IConsoleHelp("Level can be any combination of names, levels. Eg 'net=5 ms=4'. Remember to enclose it in \"'s");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   963
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   964
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   965
1847
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   966
	if (argc > 2) return false;
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   967
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   968
	if (argc == 1) {
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   969
		IConsolePrintF(_icolour_def, "Current debug-level: '%s'", GetDebugString());
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   970
	} else SetDebugString(argv[1]);
47703af63895 (svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents: 1833
diff changeset
   971
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   972
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   973
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   974
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   975
DEF_CONSOLE_CMD(ConExit)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   976
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   977
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   978
		IConsoleHelp("Exit the game. Usage: 'exit'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   979
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   980
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   981
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   982
	_exit_game = true;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
   983
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   984
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   985
1814
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   986
DEF_CONSOLE_CMD(ConPart)
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   987
{
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   988
	if (argc == 0) {
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   989
		IConsoleHelp("Leave the currently joined/running game (only ingame). Usage: 'part'");
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   990
		return true;
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   991
	}
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   992
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   993
	if (_game_mode != GM_NORMAL) return false;
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   994
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   995
	_switch_mode = SM_MENU;
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   996
	return true;
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   997
}
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
   998
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
   999
DEF_CONSOLE_CMD(ConHelp)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1000
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1001
	if (argc == 2) {
1743
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
  1002
		const IConsoleCmd *cmd;
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
  1003
		const IConsoleVar *var;
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
  1004
		const IConsoleAlias *alias;
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1005
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1006
		cmd = IConsoleCmdGet(argv[1]);
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1007
		if (cmd != NULL) {
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1008
			cmd->proc(0, NULL);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1009
			return true;
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1010
		}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1011
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1012
		alias = IConsoleAliasGet(argv[1]);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1013
		if (alias != NULL) {
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1014
			cmd = IConsoleCmdGet(alias->cmdline);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1015
			if (cmd != NULL) {
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1016
				cmd->proc(0, NULL);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1017
				return true;
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1018
			}
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1019
			IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1020
			return true;
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1021
		}
1743
b49e71451de5 (svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents: 1740
diff changeset
  1022
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1023
		var = IConsoleVarGet(argv[1]);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1024
		if (var != NULL && var->help != NULL) {
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1025
			IConsoleHelp(var->help);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1026
			return true;
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1027
		}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1028
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1029
		IConsoleError("command or variable not found");
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1030
		return true;
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1031
	}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1032
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
  1033
	IConsolePrint(13, " ---- OpenTTD Console Help ---- ");
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
  1034
	IConsolePrint( 1, " - variables: [command to list all variables: list_vars]");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1035
	IConsolePrint( 1, " set value with '<var> = <value>', use '++/--' to in-or decrement");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1036
	IConsolePrint( 1, " or omit '=' and just '<var> <value>'. get value with typing '<var>'");
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
  1037
	IConsolePrint( 1, " - commands: [command to list all commands: list_cmds]");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1038
	IConsolePrint( 1, " call commands with '<command> <arg2> <arg3>...'");
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
  1039
	IConsolePrint( 1, " - to assign strings, or use them as arguments, enclose it within quotes");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1040
	IConsolePrint( 1, " like this: '<command> \"string argument with spaces\"'");
2540
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
  1041
	IConsolePrint( 1, " - use 'help <command> | <variable>' to get specific information");
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
  1042
	IConsolePrint( 1, " - scroll console output with shift + (up | down) | (pageup | pagedown))");
dbaba9ff9b94 (svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents: 2539
diff changeset
  1043
	IConsolePrint( 1, " - scroll console input history with the up | down arrows");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1044
	IConsolePrint( 1, "");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1045
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1046
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1047
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1048
DEF_CONSOLE_CMD(ConListCommands)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1049
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1050
	const IConsoleCmd *cmd;
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1051
	size_t l = 0;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1052
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1053
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1054
		IConsoleHelp("List all registered commands. Usage: 'list_cmds [<pre-filter>]'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1055
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1056
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1057
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1058
	if (argv[1] != NULL) l = strlen(argv[1]);
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1059
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1060
	for (cmd = _iconsole_cmds; cmd != NULL; cmd = cmd->next) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1061
		if (argv[1] == NULL || strncmp(cmd->name, argv[1], l) == 0) {
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
  1062
				IConsolePrintF(_icolour_def, "%s", cmd->name);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1063
		}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1064
	}
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1065
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1066
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1067
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1068
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1069
DEF_CONSOLE_CMD(ConListVariables)
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1070
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1071
	const IConsoleVar *var;
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1072
	size_t l = 0;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1073
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1074
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1075
		IConsoleHelp("List all registered variables. Usage: 'list_vars [<pre-filter>]'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1076
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1077
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1078
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1079
	if (argv[1] != NULL) l = strlen(argv[1]);
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1080
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1081
	for (var = _iconsole_vars; var != NULL; var = var->next) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1082
		if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0)
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
  1083
			IConsolePrintF(_icolour_def, "%s", var->name);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1084
	}
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1085
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1086
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1087
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1088
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1089
DEF_CONSOLE_CMD(ConListAliases)
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1090
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1091
	const IConsoleAlias *alias;
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1092
	size_t l = 0;
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1093
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1094
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1095
		IConsoleHelp("List all registered aliases. Usage: 'list_aliases [<pre-filter>]'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1096
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1097
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1098
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1099
	if (argv[1] != NULL) l = strlen(argv[1]);
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1100
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1101
	for (alias = _iconsole_aliases; alias != NULL; alias = alias->next) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1102
		if (argv[1] == NULL || strncmp(alias->name, argv[1], l) == 0)
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
  1103
			IConsolePrintF(_icolour_def, "%s => %s", alias->name, alias->cmdline);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1104
	}
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1105
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1106
	return true;
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1107
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1108
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1109
#ifdef ENABLE_NETWORK
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1110
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1111
DEF_CONSOLE_CMD(ConSay)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1112
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1113
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1114
		IConsoleHelp("Chat to your fellow players in a multiplayer game. Usage: 'say \"<msg>\"'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1115
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1116
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1117
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1118
	if (argc != 2) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1119
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1120
	if (!_network_server) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1121
		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0 /* param does not matter */, argv[1]);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1122
	} else
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1123
		NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, argv[1], NETWORK_SERVER_INDEX);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1124
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1125
	return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1126
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1127
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1128
DEF_CONSOLE_CMD(ConSayPlayer)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1129
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1130
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1131
		IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_player <player-no> \"<msg>\"'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1132
		IConsoleHelp("PlayerNo is the player that plays as company <playerno>, 1 through max_players");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1133
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1134
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1135
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1136
	if (argc != 3) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1137
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1138
	if (atoi(argv[1]) < 1 || atoi(argv[1]) > MAX_PLAYERS) {
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
  1139
		IConsolePrintF(_icolour_def, "Unknown player. Player range is between 1 and %d.", MAX_PLAYERS);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1140
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1141
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1142
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1143
	if (!_network_server) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1144
		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_PLAYER, DESTTYPE_PLAYER, atoi(argv[1]), argv[2]);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1145
	} else
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1146
		NetworkServer_HandleChat(NETWORK_ACTION_CHAT_PLAYER, DESTTYPE_PLAYER, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1147
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1148
	return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1149
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1150
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1151
DEF_CONSOLE_CMD(ConSayClient)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1152
{
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1153
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1154
		IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_client <client-no> \"<msg>\"'");
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1155
		IConsoleHelp("For client-id's, see the command 'clients'");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1156
		return true;
627
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1157
	}
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1158
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1159
	if (argc != 3) return false;
1602
08783e4287dc (svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents: 1596
diff changeset
  1160
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1161
	if (!_network_server) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1162
		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2]);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1163
	} else
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1164
		NetworkServer_HandleChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
678
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1165
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1166
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1167
}
1602
08783e4287dc (svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents: 1596
diff changeset
  1168
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1169
DEF_CONSOLE_HOOK(ConHookServerPW)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1170
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1171
	if (strncmp(_network_server_password, "*", NETWORK_PASSWORD_LENGTH) == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1172
		_network_server_password[0] = '\0';
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1173
		_network_game_info.use_password = 0;
2863
b30ae0801d49 (svn r3411) - Fix: When changing the server password via the console, actually set the password as well as flag whether it is required.
peter1138
parents: 2860
diff changeset
  1174
	} else {
b30ae0801d49 (svn r3411) - Fix: When changing the server password via the console, actually set the password as well as flag whether it is required.
peter1138
parents: 2860
diff changeset
  1175
		ttd_strlcpy(_network_game_info.server_password, _network_server_password, sizeof(_network_server_password));
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1176
		_network_game_info.use_password = 1;
2863
b30ae0801d49 (svn r3411) - Fix: When changing the server password via the console, actually set the password as well as flag whether it is required.
peter1138
parents: 2860
diff changeset
  1177
	}
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1178
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1179
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1180
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1181
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1182
DEF_CONSOLE_HOOK(ConHookRconPW)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1183
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1184
	if (strncmp(_network_rcon_password, "*", NETWORK_PASSWORD_LENGTH) == 0)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1185
		_network_rcon_password[0] = '\0';
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1186
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1187
	ttd_strlcpy(_network_game_info.rcon_password, _network_rcon_password, sizeof(_network_game_info.rcon_password));
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1188
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1189
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1190
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1191
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1192
/* Also use from within player_gui to change the password graphically */
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1193
bool NetworkChangeCompanyPassword(byte argc, char *argv[])
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1194
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1195
	if (argc == 0) {
1788
c49040d856dd (svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents: 1762
diff changeset
  1196
		if (_local_player >= MAX_PLAYERS) return true; // dedicated server
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
  1197
		IConsolePrintF(_icolour_warn, "Current value for 'company_pw': %s", _network_player_info[_local_player].password);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1198
		return true;
690
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1199
	}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1200
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1201
	if (_local_player >= MAX_PLAYERS) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1202
		IConsoleError("You have to own a company to make use of this command.");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1203
		return false;
690
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1204
	}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1205
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1206
	if (argc != 1) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1207
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1208
	if (strncmp(argv[0], "*", sizeof(_network_player_info[_local_player].password)) == 0)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1209
		argv[0][0] = '\0';
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1210
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1211
	ttd_strlcpy(_network_player_info[_local_player].password, argv[0], sizeof(_network_player_info[_local_player].password));
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1212
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1213
	if (!_network_server)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1214
		SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1215
1866
200d225a85ff (svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents: 1847
diff changeset
  1216
	IConsolePrintF(_icolour_warn, "'company_pw' changed to:  %s", _network_player_info[_local_player].password);
200d225a85ff (svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents: 1847
diff changeset
  1217
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1218
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1219
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1220
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1221
DEF_CONSOLE_HOOK(ConProcPlayerName)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1222
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1223
	NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1224
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1225
	if (ci == NULL) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1226
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1227
	// Don't change the name if it is the same as the old name
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1228
	if (strcmp(ci->client_name, _network_player_name) != 0) {
785
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1229
		if (!_network_server) {
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1230
			SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_network_player_name);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1231
		} else {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1232
			if (NetworkFindName(_network_player_name)) {
2373
f06403621870 (svn r2899) -Fix: Several format string vulnerabilities and buffer overflows in the network code
tron
parents: 2186
diff changeset
  1233
				NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, "%s", _network_player_name);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1234
				ttd_strlcpy(ci->client_name, _network_player_name, sizeof(ci->client_name));
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1235
				NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1236
			}
785
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1237
		}
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1238
	}
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1239
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1240
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1241
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1242
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1243
DEF_CONSOLE_HOOK(ConHookServerName)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1244
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1245
	ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name));
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1246
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1247
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1248
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1249
DEF_CONSOLE_HOOK(ConHookServerAdvertise)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1250
{
1833
4dc6393a96ca (svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents: 1827
diff changeset
  1251
	if (!_network_advertise) // remove us from advertising
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1252
		NetworkUDPRemoveAdvertise();
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1253
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1254
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1255
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1256
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1257
DEF_CONSOLE_CMD(ConProcServerIP)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1258
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1259
	if (argc == 0) {
1805
7989b82b106a (svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents: 1798
diff changeset
  1260
		IConsolePrintF(_icolour_warn, "Current value for 'server_ip': %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1261
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1262
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1263
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1264
	if (argc != 1) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1265
1868
77675e799148 (svn r2374) - CodeChange: giving server_ip a value of 'all' will make the server listen on any interface (0.0.0.0); also fix a typo in one of the script example files: s/ports/interfaces
Darkvater
parents: 1866
diff changeset
  1266
	_network_server_bind_ip = (strcmp(argv[0], "all") == 0) ? inet_addr("0.0.0.0") : inet_addr(argv[0]);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1267
	snprintf(_network_server_bind_ip_host, sizeof(_network_server_bind_ip_host), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
1866
200d225a85ff (svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents: 1847
diff changeset
  1268
	IConsolePrintF(_icolour_warn, "'server_ip' changed to:  %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1269
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1270
}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1271
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1272
DEF_CONSOLE_CMD(ConPatch)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1273
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1274
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1275
		IConsoleHelp("Change patch variables for all players. Usage: 'patch <name> [<value>]'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1276
		IConsoleHelp("Omitting <value> will print out the current value of the patch-setting.");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1277
		return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1278
	}
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1279
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1280
	if (argc == 1 || argc > 3) return false;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1281
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1282
	if (argc == 2) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1283
		IConsoleGetPatchSetting(argv[1]);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1284
	} else
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1285
		IConsoleSetPatchSetting(argv[1], argv[2]);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1286
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1287
	return true;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1288
}
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1289
#endif /* ENABLE_NETWORK */
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1290
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1291
DEF_CONSOLE_CMD(ConListDumpVariables)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1292
{
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1293
	const IConsoleVar *var;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1294
	size_t l = 0;
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1295
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1296
	if (argc == 0) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1297
		IConsoleHelp("List all variables with their value. Usage: 'dump_vars [<pre-filter>]'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1298
		return true;
625
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1299
	}
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1300
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1301
	if (argv[1] != NULL) l = strlen(argv[1]);
625
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1302
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1303
	for (var = _iconsole_vars; var != NULL; var = var->next) {
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1304
		if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0)
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1305
			IConsoleVarPrintGetValue(var);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1306
	}
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1307
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1308
	return true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1309
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1310
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1311
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1312
#ifdef _DEBUG
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1313
/* ****************************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1314
/*  debug commands and variables */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1315
/* ****************************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1316
1095
90220990fd7c (svn r1596) Add some more statics
tron
parents: 1093
diff changeset
  1317
static void IConsoleDebugLibRegister(void)
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1318
{
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1319
	// debugging variables and functions
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1320
	extern bool _stdlib_con_developer; /* XXX extern in .c */
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
  1321
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1322
	IConsoleVarRegister("con_developer",    &_stdlib_con_developer, ICONSOLE_VAR_BOOLEAN, "Enable/disable console debugging information (internal)");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1323
	IConsoleCmdRegister("resettile",        ConResetTile);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1324
	IConsoleAliasRegister("dbg_echo",       "echo %A; echo %B");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1325
	IConsoleAliasRegister("dbg_echo2",      "echo %!");
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1326
}
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1327
#endif
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1328
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1329
/* ****************************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1330
/*  console command and variable registration */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1331
/* ****************************************** */
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1332
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1333
void IConsoleStdLibRegister(void)
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1334
{
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1335
	// stdlib
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1336
	extern byte _stdlib_developer; /* XXX extern in .c */
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1337
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1338
	// default variables and functions
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1339
	IConsoleCmdRegister("debug_level",  ConDebugLevel);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1340
	IConsoleCmdRegister("dump_vars",    ConListDumpVariables);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1341
	IConsoleCmdRegister("echo",         ConEcho);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1342
	IConsoleCmdRegister("echoc",        ConEchoC);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1343
	IConsoleCmdRegister("exec",         ConExec);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1344
	IConsoleCmdRegister("exit",         ConExit);
1814
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
  1345
	IConsoleCmdRegister("part",         ConPart);
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1346
	IConsoleCmdRegister("help",         ConHelp);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1347
	IConsoleCmdRegister("info_cmd",     ConInfoCmd);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1348
	IConsoleCmdRegister("info_var",     ConInfoVar);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1349
	IConsoleCmdRegister("list_cmds",    ConListCommands);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1350
	IConsoleCmdRegister("list_vars",    ConListVariables);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1351
	IConsoleCmdRegister("list_aliases", ConListAliases);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1352
	IConsoleCmdRegister("newgame",      ConNewGame);
289
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1353
	IConsoleCmdRegister("quit",         ConExit);
1e1102dd2a62 (svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents: 262
diff changeset
  1354
	IConsoleCmdRegister("resetengines", ConResetEngines);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1355
	IConsoleCmdRegister("return",       ConReturn);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1356
	IConsoleCmdRegister("screenshot",   ConScreenShot);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1357
	IConsoleCmdRegister("script",       ConScript);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1358
	IConsoleCmdRegister("scrollto",     ConScrollToTile);
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1359
	IConsoleCmdRegister("alias",        ConAlias);
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1360
	IConsoleCmdRegister("load",         ConLoad);
2415
1cee5796b5ef (svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents: 2373
diff changeset
  1361
	IConsoleCmdRegister("rm",           ConRemove);
2026
02dfa0aa2c2f (svn r2535) Tabs
tron
parents: 1992
diff changeset
  1362
	IConsoleCmdRegister("save",         ConSave);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1363
	IConsoleCmdRegister("ls",           ConListFiles);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1364
	IConsoleCmdRegister("cd",           ConChangeDirectory);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1365
	IConsoleCmdRegister("pwd",          ConPrintWorkingDirectory);
1827
b8a0edd6eb89 (svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents: 1819
diff changeset
  1366
	IConsoleCmdRegister("clear",        ConClearBuffer);
1939
8e0a1d297c4d (svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents: 1891
diff changeset
  1367
	IConsoleCmdRegister("stopall",      ConStopAllVehicles);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1368
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1369
	IConsoleAliasRegister("dir",      "ls");
2419
a2572881fd7c (svn r2945) Add 'del' alias to rm console command
Darkvater
parents: 2415
diff changeset
  1370
	IConsoleAliasRegister("del",      "rm %+");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1371
	IConsoleAliasRegister("newmap",   "newgame");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1372
	IConsoleAliasRegister("new_map",  "newgame");
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1373
	IConsoleAliasRegister("new_game", "newgame");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1374
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1375
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1376
	IConsoleVarRegister("developer", &_stdlib_developer, ICONSOLE_VAR_BYTE, "Redirect debugging output from the console/command line to the ingame console (value 2). Default value: 1");
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1377
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1378
	/* networking variables and functions */
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1379
#ifdef ENABLE_NETWORK
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1380
	/* Network hooks; only active in network */
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1381
	IConsoleCmdHookAdd ("stopall",      ICONSOLE_HOOK_ACCESS, ConHookNoNetwork);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1382
	IConsoleCmdHookAdd ("resetengines", ICONSOLE_HOOK_ACCESS, ConHookNoNetwork);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1383
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1384
	/*** Networking commands ***/
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1385
	IConsoleCmdRegister("say",             ConSay);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1386
	IConsoleCmdHookAdd("say",              ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1387
	IConsoleCmdRegister("say_player",      ConSayPlayer);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1388
	IConsoleCmdHookAdd("say_player",       ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1389
	IConsoleCmdRegister("say_client",      ConSayClient);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1390
	IConsoleCmdHookAdd("say_client",       ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1391
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1392
	IConsoleCmdRegister("connect",         ConNetworkConnect);
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1393
	IConsoleCmdHookAdd("connect",          ICONSOLE_HOOK_ACCESS, ConHookClientOnly);
1814
81a2b0bd33ea (svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents: 1805
diff changeset
  1394
	IConsoleAliasRegister("join",          "connect %A");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1395
	IConsoleCmdRegister("clients",         ConNetworkClients);
1761
00d296fcdc76 (svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents: 1755
diff changeset
  1396
	IConsoleCmdHookAdd("clients",          ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1397
	IConsoleCmdRegister("status",          ConStatus);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1398
	IConsoleCmdHookAdd("status",           ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1399
	IConsoleCmdRegister("server_info",     ConServerInfo);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1400
	IConsoleCmdHookAdd("server_info",      ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1401
	IConsoleAliasRegister("info",          "server_info");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1402
	IConsoleCmdRegister("rcon",            ConRcon);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1403
	IConsoleCmdHookAdd("rcon",             ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1404
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1405
	IConsoleCmdRegister("reset_company",   ConResetCompany);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1406
	IConsoleCmdHookAdd("reset_company",    ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1407
	IConsoleAliasRegister("clean_company", "reset_company %A");
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1408
	IConsoleCmdRegister("kick",            ConKick);
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1409
	IConsoleCmdHookAdd("kick",             ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1410
	IConsoleCmdRegister("ban",             ConBan);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1411
	IConsoleCmdHookAdd("ban",              ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1412
	IConsoleCmdRegister("unban",           ConUnBan);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1413
	IConsoleCmdHookAdd("unban",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1414
	IConsoleCmdRegister("banlist",         ConBanList);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1415
	IConsoleCmdHookAdd("banlist",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1416
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1417
	IConsoleCmdRegister("pause",           ConPauseGame);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1418
	IConsoleCmdHookAdd("pause",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1419
	IConsoleCmdRegister("unpause",         ConUnPauseGame);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1420
	IConsoleCmdHookAdd("unpause",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1421
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1422
	IConsoleCmdRegister("patch",           ConPatch);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1423
	IConsoleCmdHookAdd("patch",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1424
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1425
	/*** Networking variables ***/
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1426
	IConsoleVarRegister("net_frame_freq",        &_network_frame_freq, ICONSOLE_VAR_BYTE, "The amount of frames before a command will be (visibly) executed. Default value: 1");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1427
	IConsoleVarHookAdd("net_frame_freq",         ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1428
	IConsoleVarRegister("net_sync_freq",         &_network_sync_freq,  ICONSOLE_VAR_UINT16, "The amount of frames to check if the game is still in sync. Default value: 100");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1429
	IConsoleVarHookAdd("net_sync_freq",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1430
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1431
	IConsoleVarStringRegister("server_pw",       &_network_server_password, sizeof(_network_server_password), "Set the server password to protect your server. Use '*' to clear the password");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1432
	IConsoleVarHookAdd("server_pw",              ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1433
	IConsoleVarHookAdd("server_pw",              ICONSOLE_HOOK_POST_ACTION, ConHookServerPW);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1434
	IConsoleAliasRegister("server_password",     "server_pw %+");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1435
	IConsoleVarStringRegister("rcon_pw",         &_network_rcon_password, sizeof(_network_rcon_password), "Set the rcon-password to change server behaviour. Use '*' to disable rcon");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1436
	IConsoleVarHookAdd("rcon_pw",                ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1437
	IConsoleVarHookAdd("rcon_pw",                ICONSOLE_HOOK_POST_ACTION, ConHookRconPW);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1438
	IConsoleAliasRegister("rcon_password",       "rcon_pw %+");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1439
	IConsoleVarStringRegister("company_pw",      NULL, 0, "Set a password for your company, so no one without the correct password can join. Use '*' to clear the password");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1440
	IConsoleVarHookAdd("company_pw",             ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1441
	IConsoleVarProcAdd("company_pw",             NetworkChangeCompanyPassword);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1442
	IConsoleAliasRegister("company_password",    "company_pw %+");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1443
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1444
	IConsoleVarStringRegister("name",            &_network_player_name, sizeof(_network_player_name), "Set your name for multiplayer");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1445
	IConsoleVarHookAdd("name",                   ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1446
	IConsoleVarHookAdd("name",                   ICONSOLE_HOOK_POST_ACTION, ConProcPlayerName);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1447
	IConsoleVarStringRegister("server_name",     &_network_server_name, sizeof(_network_server_name), "Set the name of the server for multiplayer");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1448
	IConsoleVarHookAdd("server_name",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1449
	IConsoleVarHookAdd("server_name",            ICONSOLE_HOOK_POST_ACTION, ConHookServerName);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1450
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1451
	IConsoleVarRegister("server_port",           &_network_server_port, ICONSOLE_VAR_UINT32, "Set the server port. Changes take effect the next time you start a server");
1869
5057f2d5b509 (svn r2375) - CodeChange: add the newly added 'all' of server_ip to it's helptext.
Darkvater
parents: 1868
diff changeset
  1452
	IConsoleVarRegister("server_ip",             &_network_server_bind_ip, ICONSOLE_VAR_UINT32, "Set the IP the server binds to. Changes take effect the next time you start a server. Use 'all' to bind to any IP.");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1453
	IConsoleVarProcAdd("server_ip",              ConProcServerIP);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1454
	IConsoleAliasRegister("server_bind_ip",      "server_ip %+");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1455
	IConsoleAliasRegister("server_ip_bind",      "server_ip %+");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1456
	IConsoleAliasRegister("server_bind",         "server_ip %+");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1457
	IConsoleVarRegister("server_advertise",      &_network_advertise, ICONSOLE_VAR_BOOLEAN, "Set if the server will advertise to the master server and show up there");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1458
	IConsoleVarHookAdd("server_advertise",       ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1459
	IConsoleVarHookAdd("server_advertise",       ICONSOLE_HOOK_POST_ACTION, ConHookServerAdvertise);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1460
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1461
	IConsoleVarRegister("max_clients",           &_network_game_info.clients_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of connected players during runtime. Default value: 10");
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1462
	IConsoleVarHookAdd("max_clients",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1463
	IConsoleVarHookAdd("max_clients",            ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxClientsCount);
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1464
	IConsoleVarRegister("max_companies",         &_network_game_info.companies_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of active companies during runtime. Default value: 8");
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1465
	IConsoleVarHookAdd("max_companies",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
9925
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
  1466
	IConsoleVarHookAdd("max_companies",          ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxCompaniesCount);
2879
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1467
	IConsoleVarRegister("max_spectators",        &_network_game_info.spectators_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of active spectators during runtime. Default value: 9");
d270cb37c0ec (svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents: 2863
diff changeset
  1468
	IConsoleVarHookAdd("max_spectators",         ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
9925
30810c6f84c6 (svn r3955) - Fix: validate the setting of max_companies/spectators through the console. Backport of r3591, r3593 from trunk
Darkvater
parents: 2944
diff changeset
  1469
	IConsoleVarHookAdd("max_spectators",         ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxSpectatorsCount);
2880
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1470
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1471
	IConsoleVarRegister("max_join_time",         &_network_max_join_time, ICONSOLE_VAR_UINT16, "Set the maximum amount of time (ticks) a client is allowed to join. Default value: 500");
dd0bf065fd07 (svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents: 2879
diff changeset
  1472
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1473
	IConsoleVarRegister("pause_on_join",         &_network_pause_on_join, ICONSOLE_VAR_BOOLEAN, "Set if the server should pause gameplay while a client is joining. This might help slow users");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1474
	IConsoleVarHookAdd("pause_on_join",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1475
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1476
	IConsoleVarRegister("autoclean_companies",   &_network_autoclean_companies, ICONSOLE_VAR_BOOLEAN, "Automatically shut down inactive companies to free them up for other players. Customize with 'autoclean_(un)protected'");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1477
	IConsoleVarHookAdd("autoclean_companies",    ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1478
	IConsoleVarRegister("autoclean_protected",   &_network_autoclean_protected, ICONSOLE_VAR_BYTE, "Automatically remove the password from an inactive company after the given amount of months");
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1479
	IConsoleVarHookAdd("autoclean_protected",    ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
1992
2d080274ed85 (svn r2498) -Fix: [1230241] The console variable autoclean_unprotected was linked to the variable _network_autoclean_protected
tron
parents: 1962
diff changeset
  1480
	IConsoleVarRegister("autoclean_unprotected", &_network_autoclean_unprotected, ICONSOLE_VAR_BYTE, "Automatically shut down inactive companies after the given amount of months");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1481
	IConsoleVarHookAdd("autoclean_unprotected",  ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
2461
e5b01332b175 (svn r2987) -Fix: restart_game_date is an UINT16, not a BYTE. Now setting the game restart year via the console should work (Debolaz)
tron
parents: 2419
diff changeset
  1482
	IConsoleVarRegister("restart_game_date",     &_network_restart_game_date, ICONSOLE_VAR_UINT16, "Auto-restart the server when Jan 1st of the set year is reached. Use '0' to disable this");
1739
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1483
	IConsoleVarHookAdd("restart_game_date",      ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
4f3082735fbc (svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents: 1602
diff changeset
  1484
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1485
#endif /* ENABLE_NETWORK */
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1486
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1487
	// debugging stuff
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1488
#ifdef _DEBUG
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1489
	IConsoleDebugLibRegister();
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1490
#endif
222
b88456001397 (svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents: 220
diff changeset
  1491
}