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