console_cmds.c
author darkvater
Mon, 24 Jan 2005 21:33:44 +0000
changeset 1147 3fae4b3e16a0
parent 1138 b0926a703887
child 1299 0a6510cc889b
permissions -rw-r--r--
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
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
     1
/* -------------------- dont cross this line --------------------- */
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
     2
#include "stdafx.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
     3
#include "ttd.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
     4
#include "console.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
     5
#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
     6
#include "functions.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
     7
#include "variables.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
     8
#include "network_data.h"
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
     9
#include "network_client.h"
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    10
#include "network_server.h"
766
47b970b3b66a (svn r1231) -Fix: missing header file for console_cmds.c
truelight
parents: 765
diff changeset
    11
#include "network_udp.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    12
#include "command.h"
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
    13
#include "settings.h"
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
    14
#include "hal.h" /* for file list */
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
    15
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    16
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    17
// ** scriptfile handling ** //
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    18
static FILE * _script_file;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    19
static bool _script_running;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    20
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
    21
// ** console command / variable defines ** //
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    22
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
    23
#define DEF_CONSOLE_CMD(yyyy) static _iconsole_var * yyyy(byte argc, char* argv[], byte argt[])
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
    24
#define DEF_CONSOLE_CMD_HOOK(yyyy) static bool yyyy(_iconsole_cmd * hookcmd)
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
#define DEF_CONSOLE_VAR_HOOK(yyyy) static bool yyyy(_iconsole_var * hookvar)
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
    26
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    27
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    28
// ** supporting functions ** //
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
    29
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
    30
static uint32 GetArgumentInteger(const char* arg)
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
    31
{
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
    32
	uint32 result;
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
    33
	sscanf(arg, "%u", &result);
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
    34
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
    35
	if (result == 0 && arg[0] == '0' && arg[1] == 'x')
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
    36
		sscanf(arg, "%x", &result);
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
    37
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
    38
	return result;
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
    39
}
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
    40
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
    41
/* **************************** */
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
    42
/* 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
    43
/* **************************** */
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
    44
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    45
#ifdef ENABLE_NETWORK
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    46
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
    47
DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetwork)
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
    48
{
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
    49
	if (_networking) {
301
f30c8c628dc6 (svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents: 289
diff changeset
    50
		IConsoleError("This command 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
    51
		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
    52
	}
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
    53
	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
    54
}
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
    55
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
    56
DEF_CONSOLE_VAR_HOOK(ConVarHookNoNetClient)
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
    57
{
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    58
	if (!_network_available) {
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    59
		IConsoleError("You can not use this command because there is no network available.");
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    60
		return false;
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    61
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    62
	if (!_network_server) {
301
f30c8c628dc6 (svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents: 289
diff changeset
    63
		IConsoleError("This variable only makes sense for a network server.");
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
    64
		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
    65
	}
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
    66
	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
    67
}
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
    68
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    69
DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetClient)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    70
{
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    71
	if (!_network_available) {
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    72
		IConsoleError("You can not use this command because there is no network available.");
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    73
		return false;
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    74
	}
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    75
	if (!_network_server) {
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    76
		IConsoleError("This command is only available for a network server.");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    77
		return false;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    78
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    79
	return true;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    80
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    81
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    82
DEF_CONSOLE_CMD_HOOK(ConCmdHookNoNetServer)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    83
{
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    84
	if (!_network_available) {
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    85
		IConsoleError("You can not use this command because there is no network available.");
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    86
		return false;
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    87
	}
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    88
	if (_network_server) {
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    89
		IConsoleError("You can not use this command because you are a network-server.");
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    90
		return false;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    91
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    92
	return true;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    93
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    94
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    95
DEF_CONSOLE_CMD_HOOK(ConCmdHookNeedNetwork)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
    96
{
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    97
	if (!_network_available) {
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    98
		IConsoleError("You can not use this command because there is no network available.");
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
    99
		return false;
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
   100
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   101
	if (!_networking) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   102
		IConsoleError("Not connected. Multiplayer only command.");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   103
		return false;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   104
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   105
	return true;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   106
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   107
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   108
#endif /* ENABLE_NETWORK */
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   109
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
   110
/* **************************** */
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
   111
/* reset 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
   112
/* **************************** */
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
   113
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
   114
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
   115
{
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
	StartupEngines();
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
	return 0;
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
   118
}
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
   119
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
   120
#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
   121
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
   122
{
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
	if (argc == 2) {
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
   124
		TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]);
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
		DoClearSquare(tile);
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
	}
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
   127
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
	return 0;
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
}
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
   130
#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
   131
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
   132
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
   133
{
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
	if (argc == 2) {
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
		TileIndex tile = (TileIndex)GetArgumentInteger(argv[1]);
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
   136
		ScrollMainWindowToTile(tile);
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
   137
	}
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
   138
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
   139
	return 0;
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
   140
}
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
   141
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   142
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
   143
extern void BuildFileList(void);
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   144
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
   145
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   146
/* Load a file-number from current dir */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   147
static void LoadMap(uint no)
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   148
{
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   149
	/* Build file list */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   150
	BuildFileList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   151
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   152
	/* Check if in range */
887
36dcc100b6c0 (svn r1373) -Fix: compilation fix for windows
darkvater
parents: 885
diff changeset
   153
	if (no != 0 && no <= (uint)_fios_num) {
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   154
		const FiosItem *item = &_fios_list[no - 1];
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   155
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   156
		if (item->type == FIOS_TYPE_FILE) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   157
			/* Load the file */
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   158
			_switch_mode = SM_LOAD;
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   159
			SetFiosType(item->type);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   160
			strcpy(_file_to_saveload.name, FiosBrowseTo(item));
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   161
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   162
			IConsolePrint(_iconsole_color_default, "Loading map...");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   163
		} else
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   164
			IConsolePrint(_iconsole_color_error, "That is not a map.");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   165
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   166
	} else /* Show usages */
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   167
		IConsolePrint(_iconsole_color_error, "Unknown map. Use 'list_files' and 'goto_dir' to find the numbers of the savegame.");
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   168
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   169
	/* Free the file-list */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   170
	FiosFreeSavegameList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   171
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   172
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   173
/* Load a file from a map */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   174
DEF_CONSOLE_CMD(ConLoad)
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   175
{
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   176
	/* We need 1 argument */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   177
	if (argc == 2) {
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   178
		/* Load the map */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   179
		LoadMap(atoi(argv[1]));
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   180
		return NULL;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   181
	}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   182
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   183
	/* Give usage */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   184
	IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: load <file-no>");
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   185
	return NULL;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   186
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   187
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   188
/* 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
   189
DEF_CONSOLE_CMD(ConListFiles)
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   190
{
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   191
	const FiosItem *item;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   192
	int pos = 0;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   193
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   194
	/* Build the file-list */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   195
	BuildFileList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   196
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   197
	/* As long as we have files */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   198
	while (pos < _fios_num) {
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   199
		item = _fios_list + pos;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   200
		pos++;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   201
		/* Show them */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   202
		IConsolePrintF(_iconsole_color_default, "%d) %s", pos, item->title[0] ? item->title : item->name);
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   203
	}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   204
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   205
	/* Destroy the file list */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   206
	FiosFreeSavegameList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   207
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   208
	return NULL;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   209
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   210
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   211
/* Get an Specific file */
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   212
DEF_CONSOLE_CMD(ConScanFiles)
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   213
{
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   214
	const FiosItem *item;
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   215
	int pos = 0;
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   216
	_iconsole_var* result;
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   217
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   218
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   219
	result = IConsoleVarAlloc(ICONSOLE_VAR_STRING);
1019
6363b8a4273e (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 934
diff changeset
   220
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   221
	if (argc <= 1) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   222
		IConsoleVarSetString(result, "0");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   223
		return result; // return an zero
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   224
	}
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   225
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   226
	/* Build the file-list */
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   227
	BuildFileList();
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   228
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   229
	/* As long as we have files */
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   230
	while (pos < _fios_num) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   231
		item = _fios_list + pos;
1019
6363b8a4273e (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 934
diff changeset
   232
		pos++;
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   233
		if (strcmp(argv[1], "..") == 0) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   234
			if (item->type == FIOS_TYPE_PARENT) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   235
				// huh we are searching for the parent directory
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   236
				char buffer[10];
934
81642cba8833 (svn r1422) Fixed linux compiling, that was broken in r1420
dominik
parents: 932
diff changeset
   237
				sprintf(buffer, "%d", pos);
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   238
				IConsoleVarSetString(result, buffer);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   239
				return result;
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   240
			}
1019
6363b8a4273e (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 934
diff changeset
   241
		} else
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   242
			// file records ?
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   243
			if (item->type == FIOS_TYPE_FILE) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   244
				if (strcmp(argv[1], item->name) == 0) {
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   245
					char buffer[10];
934
81642cba8833 (svn r1422) Fixed linux compiling, that was broken in r1420
dominik
parents: 932
diff changeset
   246
					sprintf(buffer, "%d", pos);
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   247
					IConsoleVarSetString(result, buffer);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   248
					return result;
1019
6363b8a4273e (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 934
diff changeset
   249
				}
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   250
			}
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   251
	}
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   252
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   253
	/* Destroy the file list */
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   254
	FiosFreeSavegameList();
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   255
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   256
	return NULL;
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   257
}
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
   258
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   259
/* Change the dir via console */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   260
DEF_CONSOLE_CMD(ConGotoDir)
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   261
{
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   262
	char *file;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   263
	int no;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   264
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   265
	/* We need 1 argument */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   266
	if (argc != 2) {
1138
b0926a703887 (svn r1639) Fixed spelling: Wrong command in error for goto_dir
dominik
parents: 1130
diff changeset
   267
		IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: goto_dir <dir-no>");
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   268
		return NULL;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   269
	}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   270
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   271
	no = atoi(argv[1]);
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   272
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   273
	/* Make the file list */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   274
	BuildFileList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   275
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   276
	/* Check if we are in range */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   277
	if (no != 0 && no <= _fios_num) {
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   278
		const FiosItem *item = &_fios_list[no - 1];
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   279
		/* Only DIR and PARENT we do allow here */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   280
		if (item->type == FIOS_TYPE_DIR || item->type == FIOS_TYPE_PARENT) {
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   281
			/* Goto the map */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   282
			file = FiosBrowseTo(item);
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   283
			FiosFreeSavegameList();
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   284
			return NULL;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   285
		}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   286
	}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   287
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   288
	/* Report error */
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   289
	IConsolePrint(_iconsole_color_default, "That number is no directory.");
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   290
	FiosFreeSavegameList();
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
	return NULL;
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   293
}
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
   294
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   295
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
   296
// ********************************* //
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
   297
// * 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
   298
// ********************************* //
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
   299
#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
   300
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   301
DEF_CONSOLE_CMD(ConBan)
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   302
{
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   303
	NetworkClientInfo *ci;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   304
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   305
	if (argc == 2) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   306
		uint32 index = atoi(argv[1]);
1089
36d75679919a (svn r1590) -Fix: [1107347] ban 1 crashes dedicated server. Dedicated server cannot ban itself :)
darkvater
parents: 1046
diff changeset
   307
		if (index == NETWORK_SERVER_INDEX) {
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   308
			IConsolePrint(_iconsole_color_default, "Silly boy, you can not ban yourself!");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   309
			return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   310
		}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   311
		if (index == 0) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   312
			IConsoleError("Invalid Client-ID");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   313
			return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   314
		}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   315
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   316
		ci = NetworkFindClientInfoFromIndex(index);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   317
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   318
		if (ci != NULL) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   319
			uint i;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   320
			/* Add user to ban-list */
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   321
			for (i = 0; i < lengthof(_network_ban_list); i++) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   322
				if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0') {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   323
					_network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ci->client_ip));
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   324
					break;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   325
				}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   326
			}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   327
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   328
			SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   329
			return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   330
		} else {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   331
			IConsoleError("Client-ID not found");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   332
			return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   333
		}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   334
	}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   335
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   336
	IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: ban <client-id>. For client-ids, see 'clients'.");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   337
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   338
	return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   339
}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   340
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   341
DEF_CONSOLE_CMD(ConUnBan)
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   342
{
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   343
	if (argc == 2) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   344
		uint i;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   345
		for (i = 0; i < lengthof(_network_ban_list); i++) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   346
			if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0')
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   347
				continue;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   348
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   349
			if (strncmp(_network_ban_list[i], argv[1], strlen(_network_ban_list[i])) == 0) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   350
				_network_ban_list[i][0] = '\0';
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   351
				IConsolePrint(_iconsole_color_default, "IP unbanned.");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   352
				return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   353
			}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   354
		}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   355
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   356
		IConsolePrint(_iconsole_color_default, "IP not in ban-list.");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   357
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   358
		return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   359
	}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   360
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   361
	IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: unban <ip>.");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   362
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   363
	return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   364
}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   365
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   366
DEF_CONSOLE_CMD(ConBanList)
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   367
{
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   368
	uint i;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   369
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   370
	IConsolePrint(_iconsole_color_default, "Banlist: ");
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   371
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   372
	for (i = 0; i < lengthof(_network_ban_list); i++) {
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   373
		if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0')
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   374
			continue;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   375
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   376
		IConsolePrintF(_iconsole_color_default, "  %d) %s", i + 1, _network_ban_list[i]);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   377
	}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   378
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   379
	return NULL;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   380
}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
   381
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
   382
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
   383
{
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   384
	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
   385
		DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   386
		IConsolePrint(_iconsole_color_default, "Game paused.");
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   387
	} else
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   388
		IConsolePrint(_iconsole_color_default, "Game is already paused.");
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   389
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   390
	return NULL;
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   391
}
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   392
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   393
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
   394
{
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   395
	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
   396
		DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   397
		IConsolePrint(_iconsole_color_default, "Game unpaused.");
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   398
	} else
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   399
		IConsolePrint(_iconsole_color_default, "Game is already unpaused.");
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   400
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   401
	return NULL;
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   402
}
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
   403
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   404
DEF_CONSOLE_CMD(ConRcon)
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   405
{
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   406
	if (argc < 3) {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   407
		IConsolePrint(_iconsole_color_default, "Usage: rcon <password> <command>");
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   408
		return NULL;
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   409
	}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   410
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   411
	SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]);
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   412
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   413
	return NULL;
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   414
}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   415
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   416
DEF_CONSOLE_CMD(ConStatus)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   417
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   418
	const char *status;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   419
	int lag;
716
40a349345f82 (svn r1168) -Cleanup: [Network] Cleaned the network code a bit. Added 'const'
truelight
parents: 693
diff changeset
   420
	const NetworkClientState *cs;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   421
	const NetworkClientInfo *ci;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   422
	FOR_ALL_CLIENTS(cs) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   423
		lag = NetworkCalculateLag(cs);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   424
		ci = DEREF_CLIENT_INFO(cs);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   425
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   426
		switch (cs->status) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   427
			case STATUS_INACTIVE:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   428
				status = "inactive";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   429
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   430
			case STATUS_AUTH:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   431
				status = "authorized";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   432
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   433
			case STATUS_MAP:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   434
				status = "loading map";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   435
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   436
			case STATUS_DONE_MAP:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   437
				status = "done map";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   438
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   439
			case STATUS_PRE_ACTIVE:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   440
				status = "ready";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   441
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   442
			case STATUS_ACTIVE:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   443
				status = "active";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   444
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   445
			default:
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   446
				status = "unknown";
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   447
				break;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   448
		}
602
9bbe42a9e3ed (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents: 554
diff changeset
   449
		IConsolePrintF(8, "Client #%d/%s  status: %s  frame-lag: %d  play-as: %d  unique-id: %s",
9bbe42a9e3ed (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents: 554
diff changeset
   450
			cs->index, ci->client_name, status, lag, ci->client_playas, ci->unique_id);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   451
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   452
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   453
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   454
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   455
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   456
DEF_CONSOLE_CMD(ConKick)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   457
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   458
	NetworkClientInfo *ci;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   459
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   460
	if (argc == 2) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   461
		uint32 index = atoi(argv[1]);
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   462
		if (index == NETWORK_SERVER_INDEX) {
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   463
			IConsolePrint(_iconsole_color_default, "Silly boy, you can not kick yourself!");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   464
			return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   465
		}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   466
		if (index == 0) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   467
			IConsoleError("Invalid Client-ID");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   468
			return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   469
		}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   470
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   471
		ci = NetworkFindClientInfoFromIndex(index);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   472
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   473
		if (ci != NULL) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   474
			SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   475
			return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   476
		} else {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   477
			IConsoleError("Client-ID not found");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   478
			return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   479
		}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   480
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   481
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   482
	IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: kick <client-id>. For client-ids, see 'clients'.");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   483
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   484
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   485
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   486
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   487
DEF_CONSOLE_CMD(ConResetCompany)
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   488
{
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   489
	Player *p;
716
40a349345f82 (svn r1168) -Cleanup: [Network] Cleaned the network code a bit. Added 'const'
truelight
parents: 693
diff changeset
   490
	NetworkClientState *cs;
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   491
	NetworkClientInfo *ci;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   492
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   493
	if (argc == 2) {
1130
236aa7efbe7a (svn r1631) A couple of fixes for the signed/unsigned warnings. Only train_cmd.c remains to need fixing...
dominik
parents: 1095
diff changeset
   494
		byte index = atoi(argv[1]);
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   495
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   496
		/* Check valid range */
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   497
		if (index < 1 || index > MAX_PLAYERS) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   498
			IConsolePrintF(_iconsole_color_error, "Company does not exist. Company-ID must be between 1 and %d.", MAX_PLAYERS);
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   499
			return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   500
		}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   501
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   502
		/* Check if company does exist */
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   503
		index--;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   504
		p = DEREF_PLAYER(index);
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   505
		if (!p->is_active) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   506
			IConsolePrintF(_iconsole_color_error, "Company does not exist.");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   507
			return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   508
		}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   509
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   510
		if (p->is_ai) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   511
			IConsolePrintF(_iconsole_color_error, "Company is owned by an AI.");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   512
			return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   513
		}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   514
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   515
		/* Check if the company has active players */
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   516
		FOR_ALL_CLIENTS(cs) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   517
			ci = DEREF_CLIENT_INFO(cs);
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   518
			if (ci->client_playas-1 == index) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   519
				IConsolePrintF(_iconsole_color_error, "Cannot remove company: a client is connected to that company.");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   520
				return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   521
			}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   522
		}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   523
		ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   524
		if (ci->client_playas-1 == index) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   525
			IConsolePrintF(_iconsole_color_error, "Cannot remove company: a client is connected to that company.");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   526
			return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   527
		}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   528
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   529
		/* It is safe to remove this company */
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   530
		DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL);
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   531
		IConsolePrint(_iconsole_color_default, "Company deleted.");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   532
		return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   533
	}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   534
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   535
	IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: reset_company <company-id>.");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   536
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   537
	return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   538
}
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
   539
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   540
DEF_CONSOLE_CMD(ConNetworkClients)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   541
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   542
	NetworkClientInfo *ci;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   543
	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
   544
		if (ci->client_index != NETWORK_EMPTY_INDEX) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   545
			IConsolePrintF(8,"Client #%d   name: %s  play-as: %d", ci->client_index, ci->client_name, ci->client_playas);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   546
		}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   547
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   548
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   549
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   550
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   551
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
   552
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
   553
{
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
   554
	char* ip;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   555
	const byte *port = NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   556
	const byte *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
   557
	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
   558
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
   559
	if (argc<2) return NULL;
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
   560
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   561
	if (_networking) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   562
		// We are in network-mode, first close it!
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   563
		NetworkDisconnect();
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   564
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   565
228
f65dec6727d9 (svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents: 222
diff changeset
   566
	ip = argv[1];
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   567
	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
   568
228
f65dec6727d9 (svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents: 222
diff changeset
   569
	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
   570
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
   571
	IConsolePrintF(_iconsole_color_default, "Connecting to %s...", ip);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   572
	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
   573
		_network_playas = atoi(player);
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
   574
		IConsolePrintF(_iconsole_color_default, "    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
   575
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   576
	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
   577
		rport = atoi(port);
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
   578
		IConsolePrintF(_iconsole_color_default, "    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
   579
	}
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
   580
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   581
	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
   582
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
   583
	return NULL;
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
   584
}
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
   585
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   586
#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
   587
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   588
/* ******************************** */
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   589
/*   script file console commands   */
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   590
/* ******************************** */
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   591
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   592
DEF_CONSOLE_CMD(ConExec)
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   593
{
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   594
	char cmd[1024];
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   595
	bool doerror;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   596
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   597
	if (argc<2) return NULL;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   598
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   599
	doerror = true;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   600
	_script_file = fopen(argv[1], "r");
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   601
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   602
	if (_script_file == NULL) {
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   603
		if (argc>2) if (atoi(argv[2])==0) doerror=false;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   604
		if (doerror) IConsoleError("script file not found");
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   605
		return NULL;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   606
		}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   607
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   608
	_script_running = true;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   609
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   610
	fgets(cmd, sizeof(cmd), _script_file);
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   611
	while (!feof(_script_file) && _script_running) {
636
799b9e2c7eae (svn r1067) -Add: [Console] Added comment for scripts (everything behind the # is
truelight
parents: 634
diff changeset
   612
		strtok(cmd, "\r\n#");
799b9e2c7eae (svn r1067) -Add: [Console] Added comment for scripts (everything behind the # is
truelight
parents: 634
diff changeset
   613
		if (strlen(cmd) > 0 && cmd[0] != '#')
799b9e2c7eae (svn r1067) -Add: [Console] Added comment for scripts (everything behind the # is
truelight
parents: 634
diff changeset
   614
			IConsoleCmdExec(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
   615
		fgets(cmd, sizeof(cmd), _script_file);
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   616
	}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   617
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   618
	_script_running = false;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   619
	fclose(_script_file);
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   620
	return NULL;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   621
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   622
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   623
DEF_CONSOLE_CMD(ConReturn)
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   624
{
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   625
	_script_running = false;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   626
	return NULL;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   627
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   628
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
   629
/* **************************** */
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
   630
/*   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
   631
/* **************************** */
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
   632
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
   633
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
   634
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
   635
{
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
   636
	extern FILE* _iconsole_output_file;
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
   637
	if (!CloseConsoleLogIfActive()) {
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
   638
		if (argc < 2) return NULL;
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
   639
		IConsolePrintF(_iconsole_color_default, "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
   640
		_iconsole_output_file = fopen(argv[1], "ab");
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   641
		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
   642
	}
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
   643
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   644
	return NULL;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   645
}
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   646
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   647
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
   648
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
   649
{
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
   650
	if (argc < 2) return 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
   651
	IConsolePrint(_iconsole_color_default, argv[1]);
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
   652
	return NULL;
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
   653
}
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
   654
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
   655
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
   656
{
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
   657
	if (argc < 3) return 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
   658
	IConsolePrint(atoi(argv[1]), argv[2]);
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
   659
	return NULL;
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
   660
}
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
   661
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   662
extern void SwitchMode(int new_mode);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   663
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   664
DEF_CONSOLE_CMD(ConNewGame)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   665
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   666
	_docommand_recursive = 0;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   667
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   668
	_random_seeds[0][0] = Random();
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   669
	_random_seeds[0][1] = InteractiveRandom();
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   670
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   671
	SwitchMode(SM_NEWGAME);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   672
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   673
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   674
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
   675
DEF_CONSOLE_CMD(ConPrintF)
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
   676
{
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
   677
	if (argc < 3) return NULL;
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
   678
	IConsolePrintF(_iconsole_color_default, argv[1] , argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13], argv[14], argv[15], argv[16], argv[17], argv[18], argv[19]); /* XXX ugh... */
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
   679
	return NULL;
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
   680
}
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
   681
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
   682
DEF_CONSOLE_CMD(ConPrintFC)
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
   683
{
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
   684
	if (argc < 3) return NULL;
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
   685
	IConsolePrintF(atoi(argv[1]), argv[2] , argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13], argv[14], argv[15], argv[16], argv[17], argv[18], argv[19]); /* XXX ugh... */
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
   686
	return NULL;
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
   687
}
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
   688
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   689
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
   690
{
644
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   691
	_iconsole_alias* alias;
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   692
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   693
	if (argc < 3) return NULL;
644
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   694
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   695
	alias = IConsoleAliasGet(argv[1]);
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   696
	if (alias == NULL) {
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   697
		IConsoleAliasRegister(argv[1],argv[2]);
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   698
	} else {
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   699
		free(alias->cmdline);
e833509107ad (svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents: 637
diff changeset
   700
		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
   701
	}
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   702
	return NULL;
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   703
}
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   704
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
   705
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
   706
{
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
   707
	if (argc < 2) {
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
   708
		_make_screenshot = 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
   709
	} else {
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
   710
		if (strcmp(argv[1], "big") == 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
   711
			_make_screenshot=2;
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
   712
		if (strcmp(argv[1], "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
   713
			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
   714
			_make_screenshot = 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
   715
		}
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
   716
	}
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
   717
	return NULL;
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
   718
}
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
229
b94bfdf02bae (svn r230) -Feature: IConsoleWarning for warning messages
signde
parents: 228
diff changeset
   720
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
   721
{
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
   722
	if (argc < 2) return NULL;
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
   723
	if (argt[1] != ICONSOLE_VAR_REFERENCE) {
232
c3d08de192ed (svn r233) -Fix: german language fixes (Tron)
signde
parents: 229
diff changeset
   724
		IConsoleError("first argument has to be a variable reference");
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
   725
	} else {
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
   726
		_iconsole_var* item;
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
   727
		item = (_iconsole_var*)argv[1];
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
   728
		IConsolePrintF(_iconsole_color_default, "var_name: %s", item->name);
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
   729
		IConsolePrintF(_iconsole_color_default, "var_type: %i", item->type);
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
   730
		IConsolePrintF(_iconsole_color_default, "var_addr: %i", item->data.addr);
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
   731
		if (item->_malloc)
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
   732
			IConsolePrintF(_iconsole_color_default, "var_malloc: internal");
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
   733
		else
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
   734
			IConsolePrintF(_iconsole_color_default, "var_malloc: external");
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   735
		if (item->hook_access) IConsoleWarning("var_access hooked");
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   736
		if (item->hook_before_change) IConsoleWarning("var_before_change hooked");
229
b94bfdf02bae (svn r230) -Feature: IConsoleWarning for warning messages
signde
parents: 228
diff changeset
   737
		if (item->hook_after_change) IConsoleWarning("var_after_change hooked");
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
   738
	}
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
   739
	return NULL;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   740
}
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(ConInfoCmd)
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   744
{
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
   745
	if (argc < 2) return NULL;
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
   746
	if (argt[1] != ICONSOLE_VAR_UNKNOWN) {
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   747
		IConsoleError("first argument has to be a command name");
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
   748
	} else {
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
   749
		_iconsole_cmd* item;
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   750
		item = IConsoleCmdGet(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
   751
		if (item == NULL) {
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   752
			IConsoleError("the given command was not found");
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   753
			return NULL;
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   754
		}
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
   755
		IConsolePrintF(_iconsole_color_default, "cmd_name: %s", item->name);
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
   756
		IConsolePrintF(_iconsole_color_default, "cmd_addr: %i", item->addr);
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   757
		if (item->hook_access) IConsoleWarning("cmd_access hooked");
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   758
		if (item->hook_before_exec) IConsoleWarning("cmd_before_exec hooked");
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   759
		if (item->hook_after_exec) IConsoleWarning("cmd_after_exec hooked");
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
   760
	}
247
1cbc32ff06eb (svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents: 232
diff changeset
   761
	return 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
   762
}
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
   763
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
   764
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
   765
{
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
   766
	if (argc < 2) return 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
   767
	SetDebugString(argv[1]);
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
   768
	return NULL;
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
   769
}
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
   770
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
   771
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
   772
{
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
   773
	_exit_game = 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
   774
	return NULL;
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
   775
}
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
   776
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
   777
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
   778
{
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
   779
	IConsolePrint(13, " -- console help -- ");
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
   780
	IConsolePrint( 1, " variables: [command to list them: list_vars]");
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   781
	IConsolePrint( 1, " temp_string = \"my little \"");
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
   782
	IConsolePrint( 1, "");
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
   783
	IConsolePrint( 1, " commands: [command to list them: list_cmds]");
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
   784
	IConsolePrint( 1, " [command] [\"string argument with spaces\"] [argument 2] ...");
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   785
	IConsolePrint( 1, " printf \"%s world\" temp_string");
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
   786
	IConsolePrint( 1, "");
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
   787
	IConsolePrint( 1, " command/variable returning a value into an variable:");
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   788
	IConsolePrint( 1, " temp_uint16 << random");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   789
	IConsolePrint( 1, " temp_uint16 << temp_uint16_2");
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
   790
	IConsolePrint( 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
   791
	return NULL;
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
   792
}
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
   793
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
DEF_CONSOLE_CMD(ConRandom)
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
{
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
   796
	_iconsole_var* result;
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
   797
	result = IConsoleVarAlloc(ICONSOLE_VAR_UINT16);
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
   798
	IConsoleVarSetValue(result, rand());
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
   799
	return result;
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
   800
}
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
   801
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
   802
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
   803
{
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
   804
	const _iconsole_cmd* item;
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
   805
	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
   806
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
   807
	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
   808
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
   809
	for (item = _iconsole_cmds; item != NULL; item = item->_next)
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
   810
		if (argv[1] == NULL || strncmp(item->name, argv[1], l) == 0)
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
   811
			IConsolePrintF(_iconsole_color_default, "%s", item->name);
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
   812
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
   813
	return NULL;
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
   814
}
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
   815
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
   816
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
   817
{
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
   818
	const _iconsole_var* item;
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
   819
	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
   820
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
   821
	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
   822
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
   823
	for (item = _iconsole_vars; item != NULL; item = item->_next)
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
   824
		if (argv[1] == NULL || strncmp(item->name, argv[1], l) == 0)
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
   825
			IConsolePrintF(_iconsole_color_default, "%s", item->name);
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
   826
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
   827
	return NULL;
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
   828
}
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
   829
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   830
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
   831
{
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   832
	const _iconsole_alias* item;
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   833
	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
   834
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   835
	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
   836
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   837
	for (item = _iconsole_aliases; item != NULL; item = item->_next)
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   838
		if (argv[1] == NULL || strncmp(item->name, argv[1], l) == 0)
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   839
			IConsolePrintF(_iconsole_color_default, "%s => %s", item->name, item->cmdline);
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   840
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   841
	return NULL;
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   842
}
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
   843
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
   844
DEF_CONSOLE_CMD(ConListDumpVariables)
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
   845
{
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
   846
	const _iconsole_var* item;
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
   847
	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
   848
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
   849
	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
   850
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
   851
	for (item = _iconsole_vars; item != NULL; item = item->_next)
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
   852
		if (argv[1] == NULL || strncmp(item->name, argv[1], l) == 0)
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
   853
			IConsoleVarDump(item, 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
   854
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
   855
	return NULL;
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
   856
}
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
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   858
#ifdef ENABLE_NETWORK
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   859
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   860
DEF_CONSOLE_CMD(ConSay)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   861
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   862
	if (argc == 2) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   863
		if (!_network_server)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   864
			SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0 /* param does not matter */, argv[1]);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   865
		else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   866
			NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, argv[1], NETWORK_SERVER_INDEX);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   867
	} else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   868
		IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: say \"<msg>\"");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   869
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   870
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   871
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   872
DEF_CONSOLE_CMD(ConSayPlayer)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   873
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   874
	if (argc == 3) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   875
		if (atoi(argv[1]) < 1 || atoi(argv[1]) > MAX_PLAYERS) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   876
			IConsolePrintF(_iconsole_color_default, "Unknown player. Player range is between 1 and %d.", MAX_PLAYERS);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   877
			return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   878
		}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   879
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   880
		if (!_network_server)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   881
			SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_PLAYER, DESTTYPE_PLAYER, atoi(argv[1]), argv[2]);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   882
		else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   883
			NetworkServer_HandleChat(NETWORK_ACTION_CHAT_PLAYER, DESTTYPE_PLAYER, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   884
	} else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   885
		IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: say_player <playerno> \"<msg>\"");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   886
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   887
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   888
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   889
DEF_CONSOLE_CMD(ConSayClient)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   890
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   891
	if (argc == 3) {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   892
		if (!_network_server)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   893
			SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2]);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   894
		else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   895
			NetworkServer_HandleChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   896
	} else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   897
		IConsolePrint(_iconsole_color_default, "Unknown usage. Usage: say_client <clientno> \"<msg>\"");
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   898
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   899
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   900
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   901
#endif /* ENABLE_NETWORK */
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   902
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   903
/* **************************** */
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   904
/*   the "set" command          */
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   905
/* **************************** */
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   906
627
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
   907
extern void ConsoleSetPatchSetting(char *name, char *value);
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
   908
extern void ConsoleGetPatchSetting(char *name);
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
   909
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   910
DEF_CONSOLE_CMD(ConSet) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   911
	if (argc < 2) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   912
		IConsolePrint(_iconsole_color_warning, "Unknonw usage. Usage: set [setting] [value].");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   913
		return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   914
	}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   915
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   916
#ifdef ENABLE_NETWORK
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   917
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   918
	// setting the server password
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   919
	if ((strcmp(argv[1],"server_pw") == 0) || (strcmp(argv[1],"server_password") == 0)) {
627
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
   920
		if (!_network_server) {
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
   921
			IConsolePrintF(_iconsole_color_error, "You are not the server");
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   922
			return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   923
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   924
		if (argc == 3) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   925
			// Change server password
665
c96dc0b4ef98 (svn r1101) -Fix: [Console] Removed magic numbers
truelight
parents: 664
diff changeset
   926
			if (strncmp(argv[2], "*", NETWORK_PASSWORD_LENGTH) == 0) {
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   927
				_network_server_password[0] = '\0';
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   928
				_network_game_info.use_password = 0;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   929
			} else {
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   930
				ttd_strlcpy(_network_server_password, argv[2], sizeof(_network_server_password));
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   931
				_network_game_info.use_password = 1;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   932
			}
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   933
			IConsolePrintF(_iconsole_color_warning, "Game-password changed to '%s'", _network_server_password);
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   934
			ttd_strlcpy(_network_game_info.server_password, _network_server_password, sizeof(_network_game_info.server_password));
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   935
		} else {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   936
			IConsolePrintF(_iconsole_color_default, "Current game-password is set to '%s'", _network_game_info.server_password);
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   937
			IConsolePrint(_iconsole_color_warning, "Usage: set server_pw \"<password>\".   Use * as <password> to set no password.");
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   938
		}
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   939
		return NULL;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   940
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
   941
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   942
	// setting the rcon password
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   943
	if ((strcmp(argv[1], "rcon_pw") == 0) || (strcmp(argv[1], "rcon_password") == 0)) {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   944
		if (!_network_server) {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   945
			IConsolePrintF(_iconsole_color_error, "You are not the server");
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   946
			return NULL;
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   947
		}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   948
		if (argc == 3) {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   949
			// Change server password
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   950
			if (strncmp(argv[2], "*", NETWORK_PASSWORD_LENGTH) == 0) {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   951
				_network_rcon_password[0] = '\0';
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   952
			} else {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   953
				ttd_strlcpy(_network_rcon_password, argv[2], sizeof(_network_rcon_password));
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   954
			}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   955
			IConsolePrintF(_iconsole_color_warning, "Rcon-password changed to '%s'", _network_rcon_password);
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   956
			ttd_strlcpy(_network_game_info.rcon_password, _network_rcon_password, sizeof(_network_game_info.rcon_password));
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   957
		} else {
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   958
			IConsolePrintF(_iconsole_color_default, "Current rcon-password is set to '%s'", _network_game_info.rcon_password);
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   959
			IConsolePrint(_iconsole_color_warning, "Usage: set rcon_pw \"<password>\".   Use * as <password> to disable rcon.");
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   960
		}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   961
		return NULL;
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   962
	}
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
   963
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   964
	// setting the company password
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   965
	if ((strcmp(argv[1],"company_pw") == 0) || (strcmp(argv[1],"company_password") == 0)) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   966
		if (!_networking) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   967
			IConsolePrintF(_iconsole_color_error,"No network game running");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   968
			return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   969
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   970
		if (_local_player >= MAX_PLAYERS) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   971
			IConsolePrintF(_iconsole_color_default, "You have to own a company to make use of this command.");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   972
			return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   973
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   974
		if (argc == 3) {
773
0c5d7a4bac3d (svn r1239) -Feature: Added gui option of setting company password. It can be found in the 'company information' window
darkvater
parents: 766
diff changeset
   975
			NetworkChangeCompanyPassword(argv[2]);
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   976
		} else {
773
0c5d7a4bac3d (svn r1239) -Feature: Added gui option of setting company password. It can be found in the 'company information' window
darkvater
parents: 766
diff changeset
   977
			IConsolePrint(_iconsole_color_default, "'set company_pw' sets a password for your company, so no-one without the correct password can join.");
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   978
			IConsolePrint(_iconsole_color_warning, "Usage: set company_pw \"<password>\".   Use * as <password> to set no password.");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   979
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   980
		return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   981
	}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   982
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   983
	// setting the player name
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   984
	if (strcmp(argv[1],"name") == 0) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   985
		NetworkClientInfo *ci;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   986
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   987
		if (!_networking) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   988
			IConsolePrintF(_iconsole_color_error,"No network game running");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   989
			return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   990
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   991
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   992
		ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   993
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   994
		if (argc == 3 && ci != NULL) {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   995
			if (!_network_server)
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   996
				SEND_COMMAND(PACKET_CLIENT_SET_NAME)(argv[2]);
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   997
			else {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
   998
				if (NetworkFindName(argv[2])) {
722
d0b031be5232 (svn r1174) -Fix: [Network] All strings can now be translated (no more hardcoded strings)
truelight
parents: 716
diff changeset
   999
					NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, argv[2]);
665
c96dc0b4ef98 (svn r1101) -Fix: [Console] Removed magic numbers
truelight
parents: 664
diff changeset
  1000
					ttd_strlcpy(ci->client_name, argv[2], sizeof(ci->client_name));
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1001
					NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1002
				}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1003
			}
637
7a7f57ccfdcd (svn r1068) -Fix: [Console] Let the client remember his own name-change
truelight
parents: 636
diff changeset
  1004
			/* Also keep track of the new name on the client itself */
665
c96dc0b4ef98 (svn r1101) -Fix: [Console] Removed magic numbers
truelight
parents: 664
diff changeset
  1005
			ttd_strlcpy(_network_player_name, argv[2], sizeof(_network_player_name));
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1006
		} else {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1007
			IConsolePrint(_iconsole_color_default, "With 'set name' you can change your network-player name.");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1008
			IConsolePrint(_iconsole_color_warning, "Usage: set name \"<name>\".");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1009
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1010
		return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1011
	}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1012
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1013
	// setting the server name
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1014
	if (strcmp(argv[1],"server_name") == 0) {
627
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1015
		if (!_network_server) {
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1016
			IConsolePrintF(_iconsole_color_error, "You are not the server");
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1017
			return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1018
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1019
		if (argc == 3) {
693
d52f31c390c1 (svn r1137) -Fix: [Network] Replaces all strncpy with ttd_strlcpy.. windows really
truelight
parents: 690
diff changeset
  1020
			ttd_strlcpy(_network_server_name, argv[2], sizeof(_network_server_name));
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1021
			IConsolePrintF(_iconsole_color_warning, "Server-name changed to '%s'", _network_server_name);
665
c96dc0b4ef98 (svn r1101) -Fix: [Console] Removed magic numbers
truelight
parents: 664
diff changeset
  1022
			ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name));
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1023
		} else {
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1024
			IConsolePrintF(_iconsole_color_default, "Current server-name is '%s'", _network_server_name);
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1025
			IConsolePrint(_iconsole_color_warning, "Usage: set server_name \"<GameName>\".");
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1026
		}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1027
		return NULL;
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1028
	}
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1029
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1030
	// setting the server port
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1031
	if (strcmp(argv[1],"server_port") == 0) {
627
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1032
		if (argc == 3 && atoi(argv[2]) != 0) {
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1033
			_network_server_port = atoi(argv[2]);
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1034
			IConsolePrintF(_iconsole_color_warning, "Server-port changed to '%d'", _network_server_port);
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1035
			IConsolePrintF(_iconsole_color_warning, "Changes will take effect the next time you start a server.");
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1036
		} else {
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1037
			IConsolePrintF(_iconsole_color_default, "Current server-port is '%d'", _network_server_port);
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1038
			IConsolePrint(_iconsole_color_warning, "Usage: set server_port <port>.");
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1039
		}
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1040
		return NULL;
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1041
	}
a78f58e07142 (svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents: 625
diff changeset
  1042
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1043
	// setting the server ip
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1044
	if (strcmp(argv[1],"server_bind_ip") == 0 || strcmp(argv[1],"server_ip_bind") == 0 ||
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1045
			strcmp(argv[1],"server_ip") == 0 || strcmp(argv[1],"server_bind") == 0) {
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1046
		if (argc == 3) {
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1047
			_network_server_bind_ip = inet_addr(argv[2]);
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1048
			snprintf(_network_server_bind_ip_host, sizeof(_network_server_bind_ip_host), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1049
			IConsolePrintF(_iconsole_color_warning, "Server-bind-ip changed to '%s'", _network_server_bind_ip_host);
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1050
			IConsolePrintF(_iconsole_color_warning, "Changes will take effect the next time you start a server.");
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1051
		} else {
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1052
			IConsolePrintF(_iconsole_color_default, "Current server-bind-ip is '%s'", _network_server_bind_ip_host);
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1053
			IConsolePrint(_iconsole_color_warning, "Usage: set server_bind_ip <ip>.");
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1054
		}
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1055
		return NULL;
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1056
	}
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1057
678
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1058
	// setting the server advertising on/off
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1059
	if (strcmp(argv[1],"server_advertise") == 0) {
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1060
		if (!_network_server) {
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1061
			IConsolePrintF(_iconsole_color_error, "You are not the server");
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1062
			return NULL;
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1063
		}
678
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1064
		if (argc == 3) {
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1065
			if (strcmp(argv[2], "on") == 0 || atoi(argv[2]) == 1)
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1066
				_network_advertise = true;
765
7e9c5cdfdf1c (svn r1228) -Add: [Network] When a server normally shuts down, it removed itself
truelight
parents: 722
diff changeset
  1067
			else {
7e9c5cdfdf1c (svn r1228) -Add: [Network] When a server normally shuts down, it removed itself
truelight
parents: 722
diff changeset
  1068
				NetworkUDPRemoveAdvertise();
678
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1069
				_network_advertise = false;
765
7e9c5cdfdf1c (svn r1228) -Add: [Network] When a server normally shuts down, it removed itself
truelight
parents: 722
diff changeset
  1070
			}
678
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1071
			IConsolePrintF(_iconsole_color_warning, "Server-advertise changed to '%s'", (_network_advertise)?"on":"off");
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1072
		} else {
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1073
			IConsolePrintF(_iconsole_color_default, "Current server-advertise is '%s'", (_network_advertise)?"on":"off");
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1074
			IConsolePrint(_iconsole_color_warning, "Usage: set server_advertise on/off.");
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1075
		}
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1076
		return NULL;
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1077
	}
9c84b180ecd7 (svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents: 666
diff changeset
  1078
690
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1079
	// setting the server autoclean on/off
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1080
	if (strcmp(argv[1],"autoclean_companies") == 0) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1081
		if (!_network_server) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1082
			IConsolePrintF(_iconsole_color_error, "You are not the server");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1083
			return NULL;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1084
		}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1085
		if (argc == 3) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1086
			if (strcmp(argv[2], "on") == 0 || atoi(argv[2]) == 1)
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1087
				_network_autoclean_companies = true;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1088
			else
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1089
				_network_autoclean_companies = false;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1090
			IConsolePrintF(_iconsole_color_warning, "Autoclean-companies changed to '%s'", (_network_autoclean_companies)?"on":"off");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1091
		} else {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1092
			IConsolePrintF(_iconsole_color_default, "Current autoclean-companies is '%s'", (_network_autoclean_companies)?"on":"off");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1093
			IConsolePrint(_iconsole_color_warning, "Usage: set autoclean_companies on/off.");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1094
		}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1095
		return NULL;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1096
	}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1097
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1098
	// setting the server autoclean protected
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1099
	if (strcmp(argv[1],"autoclean_protected") == 0) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1100
		if (!_network_server) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1101
			IConsolePrintF(_iconsole_color_error, "You are not the server");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1102
			return NULL;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1103
		}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1104
		if (argc == 3) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1105
			_network_autoclean_protected = atoi(argv[2]);
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1106
			IConsolePrintF(_iconsole_color_warning, "Autoclean-protected changed to '%d'", _network_autoclean_protected);
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1107
		} else {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1108
			IConsolePrintF(_iconsole_color_default, "Current autoclean-protected is '%d'", _network_autoclean_protected);
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1109
			IConsolePrint(_iconsole_color_warning, "Usage: set autoclean_protected <months>.");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1110
		}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1111
		return NULL;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1112
	}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1113
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1114
	// setting the server autoclean protected
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1115
	if (strcmp(argv[1],"autoclean_unprotected") == 0) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1116
		if (!_network_server) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1117
			IConsolePrintF(_iconsole_color_error, "You are not the server");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1118
			return NULL;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1119
		}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1120
		if (argc == 3) {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1121
			_network_autoclean_unprotected = atoi(argv[2]);
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1122
			IConsolePrintF(_iconsole_color_warning, "Autoclean-unprotected changed to '%d'", _network_autoclean_unprotected);
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1123
		} else {
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1124
			IConsolePrintF(_iconsole_color_default, "Current autoclean-unprotected is '%d'", _network_autoclean_unprotected);
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1125
			IConsolePrint(_iconsole_color_warning, "Usage: set autoclean_unprotected <months>.");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1126
		}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1127
		return NULL;
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1128
	}
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1129
785
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1130
	// setting the server auto restart date
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1131
	if (strcmp(argv[1],"restart_game_date") == 0) {
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1132
		if (!_network_server) {
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1133
			IConsolePrintF(_iconsole_color_error, "You are not the server");
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1134
			return NULL;
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1135
		}
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1136
		if (argc == 3) {
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1137
			_network_restart_game_date = atoi(argv[2]);
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1138
			IConsolePrintF(_iconsole_color_warning, "Restart Game Date changed to '%d'", _network_restart_game_date);
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1139
		} else {
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1140
			IConsolePrintF(_iconsole_color_default, "Current Restart Game Date is '%d'", _network_restart_game_date);
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1141
			IConsolePrint(_iconsole_color_warning, "Usage: set restart_game_date <year>. '0' means disabled.");
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1142
			IConsolePrint(_iconsole_color_warning, " Auto-restart the server when 1 jan of this year is reached (e.g.: 2030).");
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1143
		}
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1144
		return NULL;
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1145
	}
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1146
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1147
#endif /* ENABLE_NETWORK */
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1148
625
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1149
	// Patch-options
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1150
	if (strcmp(argv[1],"patch") == 0) {
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1151
		if (_networking && !_network_server) {
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1152
			IConsolePrintF(_iconsole_color_error, "You are not the server");
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1153
			return NULL;
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1154
		}
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1155
		if (argc == 3)
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1156
			ConsoleGetPatchSetting(argv[2]);
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1157
		else if (argc == 4)
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1158
			ConsoleSetPatchSetting(argv[2], argv[3]);
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1159
		else
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1160
			IConsolePrint(_iconsole_color_warning, "Usage: set patch <patch_name> [<value>].");
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1161
		return NULL;
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1162
	}
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1163
682ead270492 (svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents: 623
diff changeset
  1164
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1165
	IConsolePrint(_iconsole_color_error, "Unknown setting");
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1166
	IConsolePrint(_iconsole_color_error, "Known settings are:");
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1167
#ifdef ENABLE_NETWORK
690
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1168
	IConsolePrint(_iconsole_color_error, " - autoclean_companies on/off");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1169
	IConsolePrint(_iconsole_color_error, " - autoclean_protected <months>");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1170
	IConsolePrint(_iconsole_color_error, " - autoclean_unprotected <months>");
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1171
	IConsolePrint(_iconsole_color_error, " - company_pw \"<password>\"");
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1172
	IConsolePrint(_iconsole_color_error, " - name \"<playername>\"");
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
  1173
	IConsolePrint(_iconsole_color_error, " - rcon_pw \"<password>\"");
690
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1174
	IConsolePrint(_iconsole_color_error, " - server_name \"<name>\"");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1175
	IConsolePrint(_iconsole_color_error, " - server_advertise on/off");
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1176
	IConsolePrint(_iconsole_color_error, " - server_bind_ip <ip>");
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1177
	IConsolePrint(_iconsole_color_error, " - server_port <port>");
690
9f449a6b133e (svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents: 688
diff changeset
  1178
	IConsolePrint(_iconsole_color_error, " - server_pw \"<password>\"");
785
e9ca2bcc9c8f (svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents: 784
diff changeset
  1179
	IConsolePrint(_iconsole_color_error, " - restart_game_date \"<year>\"");
629
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1180
#endif /* ENABLE_NETWORK */
ce914eb4023d (svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents: 628
diff changeset
  1181
	IConsolePrint(_iconsole_color_error, " - patch <patch_name> [<value>]");
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1182
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1183
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1184
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1185
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1186
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
  1187
#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
  1188
/* ****************************************** */
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
  1189
/*  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
  1190
/* ****************************************** */
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
  1191
1095
90220990fd7c (svn r1596) Add some more statics
tron
parents: 1093
diff changeset
  1192
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
  1193
{
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1194
	// 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
  1195
	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
  1196
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
  1197
	IConsoleVarRegister("con_developer", &_stdlib_con_developer, ICONSOLE_VAR_BOOLEAN);
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1198
	IConsoleVarMemRegister("temp_string2", ICONSOLE_VAR_STRING);
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
  1199
	IConsoleVarMemRegister("temp_uint16_2", ICONSOLE_VAR_UINT16);
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
  1200
	IConsoleCmdRegister("resettile", ConResetTile);
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1201
	IConsoleAliasRegister("dbg_echo","echo %A; echo %B");
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1202
	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
  1203
}
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
  1204
#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
  1205
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
  1206
/* ****************************************** */
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
  1207
/*  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
  1208
/* ****************************************** */
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
  1209
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1210
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
  1211
{
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
  1212
	// 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
  1213
	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
  1214
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1215
	// 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
  1216
	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
  1217
	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
  1218
	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
  1219
	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
  1220
	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
  1221
	IConsoleCmdRegister("exit",         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
  1222
	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
  1223
	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
  1224
	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
  1225
	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
  1226
	IConsoleCmdRegister("list_vars",    ConListVariables);
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1227
	IConsoleCmdRegister("list_aliases",    ConListAliases);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1228
	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
  1229
	IConsoleCmdRegister("printf",       ConPrintF);
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
  1230
	IConsoleCmdRegister("printfc",      ConPrintFC);
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
  1231
	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
  1232
	IConsoleCmdRegister("random",       ConRandom);
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
  1233
	IConsoleCmdRegister("resetengines", ConResetEngines);
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
  1234
	IConsoleCmdRegister("return",     ConReturn);
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1235
	IConsoleCmdRegister("screenshot", ConScreenShot);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1236
	IConsoleCmdRegister("script",     ConScript);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1237
	IConsoleCmdRegister("scrollto",   ConScrollToTile);
623
e0e3e0340097 (svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents: 602
diff changeset
  1238
	IConsoleCmdRegister("set",			ConSet);
634
88d9420048db (svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents: 629
diff changeset
  1239
	IConsoleCmdRegister("alias",		ConAlias);
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
  1240
	IConsoleCmdRegister("load",			ConLoad);
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
  1241
	IConsoleCmdRegister("list_files", ConListFiles);
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1242
	IConsoleCmdRegister("scan_files", ConScanFiles);
885
c9509db963ac (svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents: 841
diff changeset
  1243
	IConsoleCmdRegister("goto_dir", ConGotoDir);
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1244
	IConsoleAliasRegister("new_game", "newgame");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1245
	IConsoleAliasRegister("newmap", "newgame");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1246
	IConsoleAliasRegister("new_map", "newgame");
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1247
	IConsoleAliasRegister("load_game", "temp_string << scan_files %!;load temp_string");
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1248
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1249
	IConsoleVarRegister("developer", &_stdlib_developer, ICONSOLE_VAR_BYTE);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1250
932
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1251
	// temporary data containers for alias scripting
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1252
	IConsoleVarMemRegister("temp_string", ICONSOLE_VAR_STRING);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1253
	IConsoleVarMemRegister("temp_bool", ICONSOLE_VAR_BOOLEAN);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1254
	IConsoleVarMemRegister("temp_int16", ICONSOLE_VAR_INT16);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1255
	IConsoleVarMemRegister("temp_int32", ICONSOLE_VAR_INT32);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1256
	IConsoleVarMemRegister("temp_pointer", ICONSOLE_VAR_POINTER);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1257
	IConsoleVarMemRegister("temp_uint16", ICONSOLE_VAR_UINT16);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1258
	IConsoleVarMemRegister("temp_uint32", ICONSOLE_VAR_UINT32);
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1259
5fcff6cdc612 (svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents: 887
diff changeset
  1260
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1261
	// networking variables and functions
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1262
#ifdef ENABLE_NETWORK
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1263
	IConsoleCmdRegister("say",        ConSay);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1264
	IConsoleCmdHook("say", ICONSOLE_HOOK_ACCESS, ConCmdHookNeedNetwork);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1265
	IConsoleCmdRegister("say_player", ConSayPlayer);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1266
	IConsoleCmdHook("say_player", ICONSOLE_HOOK_ACCESS, ConCmdHookNeedNetwork);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1267
	IConsoleCmdRegister("say_client", ConSayClient);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1268
	IConsoleCmdHook("say_client", ICONSOLE_HOOK_ACCESS, ConCmdHookNeedNetwork);
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1269
	IConsoleCmdRegister("kick",         ConKick);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1270
	IConsoleCmdHook("kick", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1271
	IConsoleCmdRegister("reset_company",         ConResetCompany);
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1272
	IConsoleCmdHook("reset_company", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1273
	IConsoleCmdRegister("connect", ConNetworkConnect);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1274
	IConsoleCmdHook("connect", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetServer);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1275
	IConsoleCmdRegister("clients", ConNetworkClients);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1276
	IConsoleCmdRegister("status",   ConStatus);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1277
	IConsoleCmdHook("status", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1278
	IConsoleCmdHook("resetengines", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetwork);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1279
1026
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
  1280
	IConsoleCmdRegister("rcon",        ConRcon);
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
  1281
	IConsoleCmdHook("rcon", ICONSOLE_HOOK_ACCESS, ConCmdHookNeedNetwork);
5b2681cad645 (svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents: 1023
diff changeset
  1282
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1283
	IConsoleCmdRegister("ban",   ConBan);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1284
	IConsoleCmdHook("ban", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1285
	IConsoleCmdRegister("unban",   ConUnBan);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1286
	IConsoleCmdHook("unban", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1287
	IConsoleCmdRegister("banlist",   ConBanList);
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1288
	IConsoleCmdHook("banlist", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
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
  1289
	IConsoleCmdRegister("pause",   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
  1290
	IConsoleCmdHook("pause", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
3fae4b3e16a0 (svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents: 1138
diff changeset
  1291
	IConsoleCmdRegister("unpause",   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
  1292
	IConsoleCmdHook("unpause", ICONSOLE_HOOK_ACCESS, ConCmdHookNoNetClient);
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 785
diff changeset
  1293
784
f7081b6256f4 (svn r1251) -Fix: [Console] The alias 'clean_company' is now working correctly
truelight
parents: 783
diff changeset
  1294
	IConsoleAliasRegister("clean_company",		"reset_company %A");
688
bcaa5256253d (svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents: 678
diff changeset
  1295
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1296
	IConsoleVarRegister("net_frame_freq", &_network_frame_freq, ICONSOLE_VAR_UINT8);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1297
	IConsoleVarHook("net_frame_freq", ICONSOLE_HOOK_ACCESS, ConVarHookNoNetClient);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1298
	IConsoleVarRegister("net_sync_freq", &_network_sync_freq, ICONSOLE_VAR_UINT16);
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1299
	IConsoleVarHook("net_sync_freq", ICONSOLE_HOOK_ACCESS, ConVarHookNoNetClient);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 301
diff changeset
  1300
#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
  1301
554
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1302
	// debugging stuff
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1303
#ifdef _DEBUG
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1304
	IConsoleDebugLibRegister();
670b089d7772 (svn r954) -Fix: [Console] Hook fixes (sign_de)
truelight
parents: 543
diff changeset
  1305
#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
  1306
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
  1307
}
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
  1308
/* -------------------- don't cross this line --------------------- */