author | KUDr |
Fri, 20 Apr 2007 19:43:06 +0000 | |
changeset 6513 | 454347ca3dfb |
parent 6453 | 226bcddeba32 |
child 6566 | 91db7c3ad8d3 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
3 |
/** @file console_cmds.cpp */ |
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
4 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1869
diff
changeset
|
6 |
#include "openttd.h" |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
7 |
#include "console.h" |
1299
39c06aba09aa
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1147
diff
changeset
|
8 |
#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
|
9 |
#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
|
10 |
#include "functions.h" |
6453
226bcddeba32
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6429
diff
changeset
|
11 |
#include "landscape.h" |
2162
b98e430ffd10
(svn r2672) Move saving/loading related declarations to saveload.h
tron
parents:
2099
diff
changeset
|
12 |
#include "saveload.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
|
13 |
#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
|
14 |
#include "variables.h" |
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5296
diff
changeset
|
15 |
#include "network/network_data.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5296
diff
changeset
|
16 |
#include "network/network_client.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5296
diff
changeset
|
17 |
#include "network/network_server.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5296
diff
changeset
|
18 |
#include "network/network_udp.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
19 |
#include "command.h" |
623
3c50358d5a1b
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
20 |
#include "settings.h" |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4184
diff
changeset
|
21 |
#include "fios.h" |
1939
0b35a69165ce
(svn r2445) * Add: "stopall" console command, which forcibly stops all vehicles (useful for debugging).
matthijs
parents:
1891
diff
changeset
|
22 |
#include "vehicle.h" |
3123 | 23 |
#include "station.h" |
3818
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
24 |
#include "strings.h" |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
25 |
#include "screenshot.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
26 |
#include "genworld.h" |
4261
28670f743746
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4223
diff
changeset
|
27 |
#include "date.h" |
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5296
diff
changeset
|
28 |
#include "network/network.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
|
29 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
30 |
// ** scriptfile handling ** // |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
31 |
static FILE *_script_file; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
32 |
static bool _script_running; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
33 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
34 |
// ** console command / variable defines ** // |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
35 |
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[]) |
6247 | 36 |
#define DEF_CONSOLE_HOOK(function) static bool function() |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
37 |
|
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
|
38 |
|
b88456001397
(svn r223) -Fix: 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 |
/* 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
|
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 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
43 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
44 |
|
6247 | 45 |
static inline bool NetworkAvailable() |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
46 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
47 |
if (!_network_available) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
48 |
IConsoleError("You cannot use this command because there is no network available."); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
49 |
return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
50 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
51 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
52 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
53 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
54 |
DEF_CONSOLE_HOOK(ConHookServerOnly) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
55 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
56 |
if (!NetworkAvailable()) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
57 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
58 |
if (!_network_server) { |
1788
225888344e0c
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
59 |
IConsoleError("This command/variable is only available to a network server."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
60 |
return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
61 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
62 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
63 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
64 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
65 |
DEF_CONSOLE_HOOK(ConHookClientOnly) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
66 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
67 |
if (!NetworkAvailable()) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
68 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
69 |
if (_network_server) { |
1788
225888344e0c
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
70 |
IConsoleError("This command/variable is not available to a network server."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
71 |
return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
72 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
73 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
74 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
75 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
76 |
DEF_CONSOLE_HOOK(ConHookNeedNetwork) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
77 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
78 |
if (!NetworkAvailable()) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
79 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
80 |
if (!_networking) { |
1788
225888344e0c
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
81 |
IConsoleError("Not connected. This command/variable is only available in multiplayer."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
82 |
return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
83 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
84 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
85 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
86 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
87 |
DEF_CONSOLE_HOOK(ConHookNoNetwork) |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
88 |
{ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
89 |
if (_networking) { |
1788
225888344e0c
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
90 |
IConsoleError("This command/variable is forbidden in multiplayer."); |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
91 |
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
|
92 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
93 |
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
|
94 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
95 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
96 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
97 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
98 |
static void IConsoleHelp(const char *str) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
99 |
{ |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
100 |
IConsolePrintF(_icolour_warn, "- %s", str); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
101 |
} |
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
|
102 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
103 |
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
|
104 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
105 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
106 |
IConsoleHelp("Reset status data of all engines. This might solve some issues with 'lost' engines. Usage: 'resetengines'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
107 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
108 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
109 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
110 |
StartupEngines(); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
111 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
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 |
|
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
|
114 |
#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
|
115 |
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
|
116 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
117 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
118 |
IConsoleHelp("Reset a tile to bare land. Usage: 'resettile <tile>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
119 |
IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
120 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
121 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
122 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
123 |
if (argc == 2) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
124 |
uint32 result; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
125 |
if (GetArgumentInteger(&result, argv[1])) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
126 |
DoClearSquare((TileIndex)result); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
127 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
128 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
129 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
130 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
131 |
return false; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
132 |
} |
3647
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
133 |
|
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
134 |
DEF_CONSOLE_CMD(ConStopAllVehicles) |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
135 |
{ |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
136 |
Vehicle* v; |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
137 |
if (argc == 0) { |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
138 |
IConsoleHelp("Stops all vehicles in the game. For debugging only! Use at your own risk... Usage: 'stopall'"); |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
139 |
return true; |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
140 |
} |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
141 |
|
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
142 |
FOR_ALL_VEHICLES(v) { |
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4329
diff
changeset
|
143 |
/* Code ripped from CmdStartStopTrain. Can't call it, because of |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4329
diff
changeset
|
144 |
* ownership problems, so we'll duplicate some code, for now */ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6247
diff
changeset
|
145 |
if (v->type == VEH_TRAIN) |
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4329
diff
changeset
|
146 |
v->u.rail.days_since_order_progr = 0; |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4329
diff
changeset
|
147 |
v->vehstatus |= VS_STOPPED; |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4329
diff
changeset
|
148 |
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4329
diff
changeset
|
149 |
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); |
3647
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
150 |
} |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
151 |
return true; |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
152 |
} |
1740
f7af92074430
(svn r2244) - Fix: 'scrollto' is not debug only..sorry :)
Darkvater
parents:
1739
diff
changeset
|
153 |
#endif /* _DEBUG */ |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
154 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
155 |
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
|
156 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
157 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
158 |
IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto <tile>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
159 |
IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
160 |
return true; |
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
|
161 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
162 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
163 |
if (argc == 2) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
164 |
uint32 result; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
165 |
if (GetArgumentInteger(&result, argv[1])) { |
4585
26566ec6643c
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
166 |
if (result >= MapSize()) { |
26566ec6643c
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
167 |
IConsolePrint(_icolour_err, "Tile does not exist"); |
26566ec6643c
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
168 |
return true; |
26566ec6643c
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
169 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
170 |
ScrollMainWindowToTile((TileIndex)result); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
171 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
172 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
173 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
174 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
175 |
return false; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
176 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
177 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
178 |
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm); |
6247 | 179 |
extern void BuildFileList(); |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
180 |
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
|
181 |
|
1565
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
182 |
/* Save the map to a file */ |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
183 |
DEF_CONSOLE_CMD(ConSave) |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
184 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
185 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
186 |
IConsoleHelp("Save the current game. Usage: 'save <filename>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
187 |
return true; |
1565
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
188 |
} |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
189 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
190 |
if (argc == 2) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
191 |
char buf[200]; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
192 |
|
5296
e7acddfdd8a7
(svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because
Darkvater
parents:
4912
diff
changeset
|
193 |
snprintf(buf, lengthof(buf), "%s%s%s.sav", _paths.save_dir, PATHSEP, argv[1]); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
194 |
IConsolePrint(_icolour_def, "Saving map..."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
195 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
196 |
if (SaveOrLoad(buf, SL_SAVE) != SL_OK) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
197 |
IConsolePrint(_icolour_err, "SaveMap failed"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
198 |
} else { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
199 |
IConsolePrintF(_icolour_def, "Map sucessfully saved to %s", buf); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
200 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
201 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
202 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
203 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
204 |
return false; |
1565
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
205 |
} |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
206 |
|
5507
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
207 |
/* Explicitly save the configuration */ |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
208 |
DEF_CONSOLE_CMD(ConSaveConfig) |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
209 |
{ |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
210 |
if (argc == 0) { |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
211 |
IConsoleHelp("Saves the current config, typically to 'openttd.cfg'."); |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
212 |
return true; |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
213 |
} |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
214 |
|
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
215 |
SaveToConfig(); |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
216 |
IConsolePrint(_icolour_def, "Saved config."); |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
217 |
return true; |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
218 |
} |
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
219 |
|
1581 | 220 |
static const FiosItem* GetFiosItem(const char* file) |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
221 |
{ |
1581 | 222 |
int i; |
223 |
||
1798
7098e1e359eb
(svn r2302) - Fix: when you started a server 'load <file>' did not work prior to doing 'ls'. Fixed by moving the changing of saveload_mode into BuildFileList()
Darkvater
parents:
1794
diff
changeset
|
224 |
_saveload_mode = SLD_LOAD_GAME; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
225 |
BuildFileList(); |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
226 |
|
1581 | 227 |
for (i = 0; i < _fios_num; i++) { |
228 |
if (strcmp(file, _fios_list[i].name) == 0) break; |
|
2099
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
229 |
if (strcmp(file, _fios_list[i].title) == 0) break; |
1581 | 230 |
} |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
231 |
|
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
232 |
if (i == _fios_num) { // If no name matches, try to parse it as number |
1581 | 233 |
char* endptr; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
234 |
|
1581 | 235 |
i = strtol(file, &endptr, 10); |
236 |
if (file == endptr || *endptr != '\0') i = -1; |
|
237 |
} |
|
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
238 |
|
1581 | 239 |
return IS_INT_INSIDE(i, 0, _fios_num) ? &_fios_list[i] : NULL; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
240 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
241 |
|
1581 | 242 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
243 |
DEF_CONSOLE_CMD(ConLoad) |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
244 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
245 |
const FiosItem *item; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
246 |
const char *file; |
1581 | 247 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
248 |
if (argc == 0) { |
2540
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
249 |
IConsoleHelp("Load a game by name or index. Usage: 'load <file | number>'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
250 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
251 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
252 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
253 |
if (argc != 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
254 |
|
1581 | 255 |
file = argv[1]; |
256 |
item = GetFiosItem(file); |
|
257 |
if (item != NULL) { |
|
258 |
switch (item->type) { |
|
2099
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
259 |
case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: { |
1581 | 260 |
_switch_mode = SM_LOAD; |
261 |
SetFiosType(item->type); |
|
2099
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
262 |
|
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
263 |
ttd_strlcpy(_file_to_saveload.name, FiosBrowseTo(item), sizeof(_file_to_saveload.name)); |
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
264 |
ttd_strlcpy(_file_to_saveload.title, item->title, sizeof(_file_to_saveload.title)); |
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
265 |
} break; |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
266 |
default: IConsolePrintF(_icolour_err, "%s: Not a savegame.", file); |
1581 | 267 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
268 |
} else { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
269 |
IConsolePrintF(_icolour_err, "%s: No such file or directory.", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
270 |
} |
1581 | 271 |
|
272 |
FiosFreeSavegameList(); |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
273 |
return true; |
885
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 |
|
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
276 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
277 |
DEF_CONSOLE_CMD(ConRemove) |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
278 |
{ |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
279 |
const FiosItem* item; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
280 |
const char* file; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
281 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
282 |
if (argc == 0) { |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
283 |
IConsoleHelp("Remove a savegame by name or index. Usage: 'rm <file | number>'"); |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
284 |
return true; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
285 |
} |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
286 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
287 |
if (argc != 2) return false; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
288 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
289 |
file = argv[1]; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
290 |
item = GetFiosItem(file); |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
291 |
if (item != NULL) { |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
292 |
if (!FiosDelete(item->name)) |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
293 |
IConsolePrintF(_icolour_err, "%s: Failed to delete file", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
294 |
} else { |
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
295 |
IConsolePrintF(_icolour_err, "%s: No such file or directory.", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
296 |
} |
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
297 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
298 |
FiosFreeSavegameList(); |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
299 |
return true; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
300 |
} |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
301 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
302 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
303 |
/* 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
|
304 |
DEF_CONSOLE_CMD(ConListFiles) |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
305 |
{ |
1581 | 306 |
int i; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
307 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
308 |
if (argc == 0) { |
2540
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
309 |
IConsoleHelp("List all loadable savegames and directories in the current dir via console. Usage: 'ls | dir'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
310 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
311 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
312 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
313 |
BuildFileList(); |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
314 |
|
1581 | 315 |
for (i = 0; i < _fios_num; i++) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
316 |
const FiosItem *item = &_fios_list[i]; |
2099
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
317 |
IConsolePrintF(_icolour_def, "%d) %s", i, item->title); |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
318 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
319 |
|
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
320 |
FiosFreeSavegameList(); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
321 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
322 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
323 |
|
1581 | 324 |
/* Change the dir via console */ |
325 |
DEF_CONSOLE_CMD(ConChangeDirectory) |
|
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
326 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
327 |
const FiosItem *item; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
328 |
const char *file; |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
329 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
330 |
if (argc == 0) { |
2540
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
331 |
IConsoleHelp("Change the dir via console. Usage: 'cd <directory | number>'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
332 |
return true; |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
333 |
} |
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
334 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
335 |
if (argc != 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
336 |
|
1581 | 337 |
file = argv[1]; |
338 |
item = GetFiosItem(file); |
|
339 |
if (item != NULL) { |
|
340 |
switch (item->type) { |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
341 |
case FIOS_TYPE_DIR: case FIOS_TYPE_DRIVE: case FIOS_TYPE_PARENT: |
1581 | 342 |
FiosBrowseTo(item); |
343 |
break; |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
344 |
default: IConsolePrintF(_icolour_err, "%s: Not a directory.", file); |
1581 | 345 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
346 |
} else { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
347 |
IConsolePrintF(_icolour_err, "%s: No such file or directory.", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
348 |
} |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
349 |
|
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
350 |
FiosFreeSavegameList(); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
351 |
return true; |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
352 |
} |
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
353 |
|
1581 | 354 |
DEF_CONSOLE_CMD(ConPrintWorkingDirectory) |
355 |
{ |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
356 |
const char *path; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
357 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
358 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
359 |
IConsoleHelp("Print out the current working directory. Usage: 'pwd'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
360 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
361 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
362 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
363 |
// XXX - Workaround for broken file handling |
4223
d4c9ef555f43
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4184
diff
changeset
|
364 |
FiosGetSavegameList(SLD_LOAD_GAME); |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
365 |
FiosFreeSavegameList(); |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
366 |
|
1596
483007886b59
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1581
diff
changeset
|
367 |
FiosGetDescText(&path, NULL); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
368 |
IConsolePrint(_icolour_def, path); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
369 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
370 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
371 |
|
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
372 |
DEF_CONSOLE_CMD(ConClearBuffer) |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
373 |
{ |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
374 |
if (argc == 0) { |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
375 |
IConsoleHelp("Clear the console buffer. Usage: 'clear'"); |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
376 |
return true; |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
377 |
} |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
378 |
|
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
379 |
IConsoleClearBuffer(); |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
380 |
InvalidateWindow(WC_CONSOLE, 0); |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
381 |
return true; |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
382 |
} |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
383 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
384 |
|
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
|
385 |
// ********************************* // |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
386 |
// * 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
|
387 |
// ********************************* // |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
388 |
#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
|
389 |
|
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
390 |
DEF_CONSOLE_CMD(ConBan) |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
391 |
{ |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
392 |
NetworkClientInfo *ci; |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
393 |
const char *banip = NULL; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
394 |
uint32 index; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
395 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
396 |
if (argc == 0) { |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
397 |
IConsoleHelp("Ban a player from a network game. Usage: 'ban <ip | client-id>'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
398 |
IConsoleHelp("For client-id's, see the command 'clients'"); |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
399 |
IConsoleHelp("If the client is no longer online, you can still ban his/her IP"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
400 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
401 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
402 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
403 |
if (argc != 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
404 |
|
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
405 |
if (strchr(argv[1], '.') == NULL) { // banning with ID |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
406 |
index = atoi(argv[1]); |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
407 |
ci = NetworkFindClientInfoFromIndex(index); |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
408 |
} else { // banning IP |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
409 |
ci = NetworkFindClientInfoFromIP(argv[1]); |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
410 |
if (ci == NULL) { |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
411 |
banip = argv[1]; |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
412 |
index = (uint32)-1; |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
413 |
} else { |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
414 |
index = ci->client_index; |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
415 |
} |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
416 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
417 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
418 |
if (index == NETWORK_SERVER_INDEX) { |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
419 |
IConsoleError("Silly boy, you can not ban yourself!"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
420 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
421 |
} |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
422 |
|
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
423 |
if (index == 0 || (ci == NULL && index != (uint32)-1)) { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
424 |
IConsoleError("Invalid client"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
425 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
426 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
427 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
428 |
if (ci != NULL) { |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
429 |
banip = inet_ntoa(*(struct in_addr *)&ci->client_ip); |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
430 |
SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
431 |
IConsolePrint(_icolour_def, "Client banned"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
432 |
} else { |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
433 |
IConsolePrint(_icolour_def, "Client not online, banned IP"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
434 |
} |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
435 |
|
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
436 |
/* Add user to ban-list */ |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
437 |
for (index = 0; index < lengthof(_network_ban_list); index++) { |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
438 |
if (_network_ban_list[index] == NULL) { |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
439 |
_network_ban_list[index] = strdup(banip); |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
440 |
break; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
441 |
} |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
442 |
} |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
443 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
444 |
return true; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
445 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
446 |
|
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
447 |
DEF_CONSOLE_CMD(ConUnBan) |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
448 |
{ |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
449 |
uint i, index; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
450 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
451 |
if (argc == 0) { |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
452 |
IConsoleHelp("Unban a player from a network game. Usage: 'unban <ip | client-id>'"); |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
453 |
IConsoleHelp("For a list of banned IP's, see the command 'banlist'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
454 |
return true; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
455 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
456 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
457 |
if (argc != 2) return false; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
458 |
|
2541
959903599cb9
(svn r3070) - it doesn't matter where the '.' is found for the IP, if it is found, it is not a normal index when unbanning clients ('\0' should of course be NULL); thx Tron
Darkvater
parents:
2540
diff
changeset
|
459 |
index = (strchr(argv[1], '.') == NULL) ? atoi(argv[1]) : 0; |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
460 |
index--; |
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
461 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
462 |
for (i = 0; i < lengthof(_network_ban_list); i++) { |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
463 |
if (_network_ban_list[i] == NULL) continue; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
464 |
|
4025
5a43f8978255
(svn r5264) -Fix: The wrong IP could get unbanned, e.g. 'unban 1.2.3.42' could result in unbanning 1.2.3.4
tron
parents:
3857
diff
changeset
|
465 |
if (strcmp(_network_ban_list[i], argv[1]) == 0 || index == i) { |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
466 |
free(_network_ban_list[i]); |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
467 |
_network_ban_list[i] = NULL; |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
468 |
IConsolePrint(_icolour_def, "IP unbanned."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
469 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
470 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
471 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
472 |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
473 |
IConsolePrint(_icolour_def, "IP not in ban-list."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
474 |
return true; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
475 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
476 |
|
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
477 |
DEF_CONSOLE_CMD(ConBanList) |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
478 |
{ |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
479 |
uint i; |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
480 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
481 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
482 |
IConsoleHelp("List the IP's of banned clients: Usage 'banlist'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
483 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
484 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
485 |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
486 |
IConsolePrint(_icolour_def, "Banlist: "); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
487 |
|
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
488 |
for (i = 0; i < lengthof(_network_ban_list); i++) { |
2914
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
489 |
if (_network_ban_list[i] != NULL) |
ccfa238c6645
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
490 |
IConsolePrintF(_icolour_def, " %d) %s", i + 1, _network_ban_list[i]); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
491 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
492 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
493 |
return true; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
494 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
495 |
|
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
|
496 |
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
|
497 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
498 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
499 |
IConsoleHelp("Pause a network game. Usage: 'pause'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
500 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
501 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
502 |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6123
diff
changeset
|
503 |
if (_pause_game == 0) { |
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
|
504 |
DoCommandP(0, 1, 0, NULL, CMD_PAUSE); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
505 |
IConsolePrint(_icolour_def, "Game paused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
506 |
} else { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
507 |
IConsolePrint(_icolour_def, "Game is already paused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
508 |
} |
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
|
509 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
510 |
return true; |
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
|
511 |
} |
786d631229d8
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
512 |
|
786d631229d8
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
513 |
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
|
514 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
515 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
516 |
IConsoleHelp("Unpause a network game. Usage: 'unpause'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
517 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
518 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
519 |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6123
diff
changeset
|
520 |
if (_pause_game != 0) { |
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
|
521 |
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
522 |
IConsolePrint(_icolour_def, "Game unpaused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
523 |
} else { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
524 |
IConsolePrint(_icolour_def, "Game is already unpaused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
525 |
} |
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
|
526 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
527 |
return true; |
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
|
528 |
} |
786d631229d8
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
529 |
|
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
530 |
DEF_CONSOLE_CMD(ConRcon) |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
531 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
532 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
533 |
IConsoleHelp("Remote control the server from another client. Usage: 'rcon <password> <command>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
534 |
IConsoleHelp("Remember to enclose the command in quotes, otherwise only the first parameter is sent"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
535 |
return true; |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
536 |
} |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
537 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
538 |
if (argc < 3) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
539 |
|
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
540 |
SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
541 |
return true; |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
542 |
} |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
543 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
544 |
DEF_CONSOLE_CMD(ConStatus) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
545 |
{ |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
546 |
static const char* const stat_str[] = { |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
547 |
"inactive", |
6235
a4ea32acd914
(svn r9038) -Fix [FS#115]: inactive connections are not automatically kicked, i.e. people who only open a telnet (or similar) connection to a server.
rubidium
parents:
6231
diff
changeset
|
548 |
"authorizing", |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
549 |
"authorized", |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
550 |
"waiting", |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
551 |
"loading map", |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
552 |
"map done", |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
553 |
"ready", |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
554 |
"active" |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
555 |
}; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
556 |
|
5624
6afe9d27430a
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5587
diff
changeset
|
557 |
NetworkTCPSocketHandler *cs; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
558 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
559 |
if (argc == 0) { |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
560 |
IConsoleHelp("List the status of all clients connected to the server. Usage 'status'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
561 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
562 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
563 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
564 |
FOR_ALL_CLIENTS(cs) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
565 |
int lag = NetworkCalculateLag(cs); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
566 |
const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
567 |
const char* status; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
568 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
569 |
status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown"); |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
570 |
IConsolePrintF(8, "Client #%1d name: '%s' status: '%s' frame-lag: %3d company: %1d IP: %s unique-id: '%s'", |
4878
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
571 |
cs->index, ci->client_name, status, lag, |
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
572 |
ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0), |
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
573 |
GetPlayerIP(ci), ci->unique_id); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
574 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
575 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
576 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
577 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
578 |
|
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
579 |
DEF_CONSOLE_CMD(ConServerInfo) |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
580 |
{ |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
581 |
const NetworkGameInfo *gi; |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
582 |
|
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
583 |
if (argc == 0) { |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
584 |
IConsoleHelp("List current and maximum client/player limits. Usage 'server_info'"); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
585 |
IConsoleHelp("You can change these values by setting the variables 'max_clients', 'max_companies' and 'max_spectators'"); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
586 |
return true; |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
587 |
} |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
588 |
|
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
589 |
gi = &_network_game_info; |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
590 |
IConsolePrintF(_icolour_def, "Current/maximum clients: %2d/%2d", gi->clients_on, gi->clients_max); |
2944
2360b2da2bb0
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2914
diff
changeset
|
591 |
IConsolePrintF(_icolour_def, "Current/maximum companies: %2d/%2d", ActivePlayerCount(), gi->companies_max); |
2360b2da2bb0
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2914
diff
changeset
|
592 |
IConsolePrintF(_icolour_def, "Current/maximum spectators: %2d/%2d", NetworkSpectatorCount(), gi->spectators_max); |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
593 |
|
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
594 |
return true; |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
595 |
} |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
596 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
597 |
DEF_CONSOLE_HOOK(ConHookValidateMaxClientsCount) |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
598 |
{ |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
599 |
/* XXX - hardcoded, string limiation -- TrueLight |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
600 |
* XXX - also see network.c:NetworkStartup ~1356 */ |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
601 |
if (_network_game_info.clients_max > 10) { |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
602 |
_network_game_info.clients_max = 10; |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
603 |
IConsoleError("Maximum clients out of bounds, truncating to limit."); |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
604 |
} |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
605 |
|
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
606 |
return true; |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
607 |
} |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
608 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
609 |
DEF_CONSOLE_HOOK(ConHookValidateMaxCompaniesCount) |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
610 |
{ |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
611 |
if (_network_game_info.companies_max > MAX_PLAYERS) { |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
612 |
_network_game_info.companies_max = MAX_PLAYERS; |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
613 |
IConsoleError("Maximum companies out of bounds, truncating to limit."); |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
614 |
} |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
615 |
|
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
616 |
return true; |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
617 |
} |
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
618 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
619 |
DEF_CONSOLE_HOOK(ConHookValidateMaxSpectatorsCount) |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
620 |
{ |
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
621 |
/* XXX see ConHookValidateMaxClientsCount */ |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
622 |
if (_network_game_info.spectators_max > 10) { |
3013 | 623 |
_network_game_info.spectators_max = 10; |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
624 |
IConsoleError("Maximum spectators out of bounds, truncating to limit."); |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
625 |
} |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
626 |
|
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
627 |
return true; |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
628 |
} |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
629 |
|
4716
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
630 |
DEF_CONSOLE_HOOK(ConHookCheckMinPlayers) |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
631 |
{ |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
632 |
CheckMinPlayers(); |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
633 |
return true; |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
634 |
} |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
635 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
636 |
DEF_CONSOLE_CMD(ConKick) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
637 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
638 |
NetworkClientInfo *ci; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
639 |
uint32 index; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
640 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
641 |
if (argc == 0) { |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
642 |
IConsoleHelp("Kick a player from a network game. Usage: 'kick <ip | client-id>'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
643 |
IConsoleHelp("For client-id's, see the command 'clients'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
644 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
645 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
646 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
647 |
if (argc != 2) return false; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
648 |
|
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
649 |
if (strchr(argv[1], '.') == NULL) { |
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
650 |
index = atoi(argv[1]); |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
651 |
ci = NetworkFindClientInfoFromIndex(index); |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
652 |
} else { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
653 |
ci = NetworkFindClientInfoFromIP(argv[1]); |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
654 |
index = (ci == NULL) ? 0 : ci->client_index; |
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
655 |
} |
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
656 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
657 |
if (index == NETWORK_SERVER_INDEX) { |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
658 |
IConsoleError("Silly boy, you can not kick yourself!"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
659 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
660 |
} |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
661 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
662 |
if (index == 0) { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
663 |
IConsoleError("Invalid client"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
664 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
665 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
666 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
667 |
if (ci != NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
668 |
SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
669 |
} else { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
670 |
IConsoleError("Client not found"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
671 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
672 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
673 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
674 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
675 |
|
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
676 |
DEF_CONSOLE_CMD(ConResetCompany) |
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
677 |
{ |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
678 |
const Player *p; |
5624
6afe9d27430a
(svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState.
rubidium
parents:
5587
diff
changeset
|
679 |
NetworkTCPSocketHandler *cs; |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
680 |
const NetworkClientInfo *ci; |
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
681 |
PlayerID index; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
682 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
683 |
if (argc == 0) { |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
684 |
IConsoleHelp("Remove an idle company from the game. Usage: 'reset_company <company-id>'"); |
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
685 |
IConsoleHelp("For company-id's, see the list of companies from the dropdown menu. Player 1 is 1, etc."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
686 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
687 |
} |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
688 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
689 |
if (argc != 2) return false; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
690 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
691 |
index = (PlayerID)(atoi(argv[1]) - 1); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
692 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
693 |
/* Check valid range */ |
4878
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
694 |
if (!IsValidPlayer(index)) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
695 |
IConsolePrintF(_icolour_err, "Company does not exist. Company-id must be between 1 and %d.", MAX_PLAYERS); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
696 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
697 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
698 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
699 |
/* Check if company does exist */ |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1943
diff
changeset
|
700 |
p = GetPlayer(index); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
701 |
if (!p->is_active) { |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
702 |
IConsoleError("Company does not exist."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
703 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
704 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
705 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
706 |
if (p->is_ai) { |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
707 |
IConsoleError("Company is owned by an AI."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
708 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
709 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
710 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
711 |
/* Check if the company has active players */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
712 |
FOR_ALL_CLIENTS(cs) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
713 |
ci = DEREF_CLIENT_INFO(cs); |
4878
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
714 |
if (ci->client_playas == index) { |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
715 |
IConsoleError("Cannot remove company: a client is connected to that company."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
716 |
return true; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
717 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
718 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
719 |
ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); |
4878
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
720 |
if (ci->client_playas == index) { |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
721 |
IConsoleError("Cannot remove company: the server is connected to that company."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
722 |
return true; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
723 |
} |
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
724 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
725 |
/* It is safe to remove this company */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
726 |
DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
727 |
IConsolePrint(_icolour_def, "Company deleted."); |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
728 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
729 |
return true; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
730 |
} |
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
731 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
732 |
DEF_CONSOLE_CMD(ConNetworkClients) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
733 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
734 |
NetworkClientInfo *ci; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
735 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
736 |
if (argc == 0) { |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
737 |
IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
738 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
739 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
740 |
|
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
741 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
742 |
IConsolePrintF(8, "Client #%1d name: '%s' company: %1d IP: %s", |
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
743 |
ci->client_index, ci->client_name, |
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
744 |
ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0), |
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
745 |
GetPlayerIP(ci)); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
746 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
747 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
748 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
749 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
750 |
|
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
|
751 |
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
|
752 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
753 |
char *ip; |
1329 | 754 |
const char *port = NULL; |
755 |
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
|
756 |
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
|
757 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
758 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
759 |
IConsoleHelp("Connect to a remote OTTD server and join the game. Usage: 'connect <ip>'"); |
4861
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
760 |
IConsoleHelp("IP can contain port and player: 'IP[[#Player]:Port]', eg: 'server.ottd.org#2:443'"); |
4878
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
761 |
IConsoleHelp("Player #255 is spectator all others are a certain company with Company 1 being #1"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
762 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
763 |
} |
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
|
764 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
765 |
if (argc < 2) return false; |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
766 |
if (_networking) NetworkDisconnect(); // we are in network-mode, first close it! |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
767 |
|
228
f65dec6727d9
(svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents:
222
diff
changeset
|
768 |
ip = argv[1]; |
4861
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
769 |
/* Default settings: default port and new company */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
770 |
rport = NETWORK_DEFAULT_PORT; |
4861
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
771 |
_network_playas = PLAYER_NEW_COMPANY; |
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
|
772 |
|
228
f65dec6727d9
(svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents:
222
diff
changeset
|
773 |
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
|
774 |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
775 |
IConsolePrintF(_icolour_def, "Connecting to %s...", ip); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
776 |
if (player != NULL) { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
777 |
_network_playas = (PlayerID)atoi(player); |
4861
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
778 |
IConsolePrintF(_icolour_def, " player-no: %d", _network_playas); |
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
779 |
|
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
780 |
/* From a user pov 0 is a new player, internally it's different and all |
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
781 |
* players are offset by one to ease up on users (eg players 1-8 not 0-7) */ |
4878
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
782 |
if (_network_playas != PLAYER_SPECTATOR) { |
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
783 |
_network_playas--; |
4d4f76a898fd
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
784 |
if (!IsValidPlayer(_network_playas)) return false; |
4861
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
785 |
} |
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
|
786 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
787 |
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
|
788 |
rport = atoi(port); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
789 |
IConsolePrintF(_icolour_def, " port: %s", port); |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
790 |
} |
b88456001397
(svn r223) -Fix: 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 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
792 |
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
|
793 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
794 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
795 |
} |
b88456001397
(svn r223) -Fix: 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 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
797 |
#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
|
798 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
799 |
/* ******************************** */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
800 |
/* script file console commands */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
801 |
/* ******************************** */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
802 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
803 |
DEF_CONSOLE_CMD(ConExec) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
804 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
805 |
char cmdline[ICON_CMDLN_SIZE]; |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
806 |
char *cmdptr; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
807 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
808 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
809 |
IConsoleHelp("Execute a local script file. Usage: 'exec <script> <?>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
810 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
811 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
812 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
813 |
if (argc < 2) return false; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
814 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
815 |
_script_file = fopen(argv[1], "r"); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
816 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
817 |
if (_script_file == NULL) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
818 |
if (argc == 2 || atoi(argv[2]) != 0) IConsoleError("script file not found"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
819 |
return true; |
1383 | 820 |
} |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
821 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
822 |
_script_running = true; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
823 |
|
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
824 |
while (_script_running && fgets(cmdline, sizeof(cmdline), _script_file) != NULL) { |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
825 |
/* Remove newline characters from the executing script */ |
1819 | 826 |
for (cmdptr = cmdline; *cmdptr != '\0'; cmdptr++) { |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
827 |
if (*cmdptr == '\n' || *cmdptr == '\r') { |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
828 |
*cmdptr = '\0'; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
829 |
break; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
830 |
} |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
831 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
832 |
IConsoleCmdExec(cmdline); |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
833 |
} |
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
|
834 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
835 |
if (ferror(_script_file)) |
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
|
836 |
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
|
837 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
838 |
_script_running = false; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
839 |
fclose(_script_file); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
840 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
841 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
842 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
843 |
DEF_CONSOLE_CMD(ConReturn) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
844 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
845 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
846 |
IConsoleHelp("Stop executing a running script. Usage: 'return'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
847 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
848 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
849 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
850 |
_script_running = false; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
851 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
852 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
853 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
854 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
855 |
/* 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
|
856 |
/* **************************** */ |
6247 | 857 |
extern bool CloseConsoleLogIfActive(); |
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
|
858 |
|
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
|
859 |
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
|
860 |
{ |
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
|
861 |
extern FILE* _iconsole_output_file; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
862 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
863 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
864 |
IConsoleHelp("Start or stop logging console output to a file. Usage: 'script <filename>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
865 |
IConsoleHelp("If filename is omitted, a running log is stopped if it is active"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
866 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
867 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
868 |
|
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
|
869 |
if (!CloseConsoleLogIfActive()) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
870 |
if (argc < 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
871 |
|
2026 | 872 |
IConsolePrintF(_icolour_def, "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
|
873 |
_iconsole_output_file = fopen(argv[1], "ab"); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
874 |
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
|
875 |
} |
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
|
876 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
877 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
878 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
879 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
880 |
|
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
|
881 |
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
|
882 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
883 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
884 |
IConsoleHelp("Print back the first argument to the console. Usage: 'echo <arg>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
885 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
886 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
887 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
888 |
if (argc < 2) return false; |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
889 |
IConsolePrint(_icolour_def, argv[1]); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
890 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
891 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
892 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
893 |
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
|
894 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
895 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
896 |
IConsoleHelp("Print back the first argument to the console in a given colour. Usage: 'echoc <colour> <arg2>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
897 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
898 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
899 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
900 |
if (argc < 3) return false; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
901 |
IConsolePrint(atoi(argv[1]), argv[2]); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
902 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
903 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
904 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
905 |
DEF_CONSOLE_CMD(ConNewGame) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
906 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
907 |
if (argc == 0) { |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
908 |
IConsoleHelp("Start a new game. Usage: 'newgame [seed]'"); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
909 |
IConsoleHelp("The server can force a new game using 'newgame'; any client joined will rejoin after the server is done generating the new game."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
910 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
911 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
912 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
913 |
StartNewGameWithoutGUI((argc == 2) ? (uint)atoi(argv[1]) : GENERATE_NEW_SEED); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
914 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
915 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
916 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
917 |
extern void SwitchMode(int new_mode); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
918 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
919 |
DEF_CONSOLE_CMD(ConRestart) |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
920 |
{ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
921 |
if (argc == 0) { |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
922 |
IConsoleHelp("Restart game. Usage: 'restart'"); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
923 |
IConsoleHelp("Restarts a game. It tries to reproduce the exact same map as the game started with."); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
924 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
925 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
926 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
927 |
/* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
928 |
_patches.map_x = MapLogX(); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
929 |
_patches.map_y = FindFirstBit(MapSizeY()); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
930 |
SwitchMode(SM_NEWGAME); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
931 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
932 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
933 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
934 |
DEF_CONSOLE_CMD(ConGetSeed) |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
935 |
{ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
936 |
if (argc == 0) { |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
937 |
IConsoleHelp("Returns the seed used to create this game. Usage: 'getseed'"); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
938 |
IConsoleHelp("The seed can be used to reproduce the exact same map as the game started with."); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
939 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
940 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
941 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
942 |
IConsolePrintF(_icolour_def, "Generation Seed: %u", _patches.generation_seed); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
943 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
944 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
945 |
|
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
946 |
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
|
947 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
948 |
IConsoleAlias *alias; |
644
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
949 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
950 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
951 |
IConsoleHelp("Add a new alias, or redefine the behaviour of an existing alias . Usage: 'alias <name> <command>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
952 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
953 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
954 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
955 |
if (argc < 3) return false; |
644
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
956 |
|
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
957 |
alias = IConsoleAliasGet(argv[1]); |
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
958 |
if (alias == NULL) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
959 |
IConsoleAliasRegister(argv[1], argv[2]); |
644
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
960 |
} else { |
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
961 |
free(alias->cmdline); |
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
962 |
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
|
963 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
964 |
return true; |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
965 |
} |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
966 |
|
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
|
967 |
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
|
968 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
969 |
if (argc == 0) { |
2540
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
970 |
IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | no_con]'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
971 |
IConsoleHelp("'big' makes a screenshot of the whole map, 'no_con' hides the console to create the screenshot"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
972 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
973 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
974 |
|
2539
dc2cd88223fb
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
975 |
if (argc > 3) return false; |
dc2cd88223fb
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
976 |
|
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
977 |
SetScreenshotType(SC_VIEWPORT); |
2539
dc2cd88223fb
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
978 |
if (argc > 1) { |
dc2cd88223fb
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
979 |
if (strcmp(argv[1], "big") == 0 || (argc == 3 && strcmp(argv[2], "big") == 0)) |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
980 |
SetScreenshotType(SC_WORLD); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
981 |
|
2539
dc2cd88223fb
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
982 |
if (strcmp(argv[1], "no_con") == 0 || (argc == 3 && strcmp(argv[2], "no_con") == 0)) |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
983 |
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
|
984 |
} |
2539
dc2cd88223fb
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
985 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
986 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
987 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
988 |
|
229
b94bfdf02bae
(svn r230) -Feature: IConsoleWarning for warning messages
signde
parents:
228
diff
changeset
|
989 |
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
|
990 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
991 |
static const char *_icon_vartypes[] = {"boolean", "byte", "uint16", "uint32", "int16", "int32", "string"}; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
992 |
const IConsoleVar *var; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
993 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
994 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
995 |
IConsoleHelp("Print out debugging information about a variable. Usage: 'info_var <var>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
996 |
return true; |
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
|
997 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
998 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
999 |
if (argc < 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1000 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1001 |
var = IConsoleVarGet(argv[1]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1002 |
if (var == NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1003 |
IConsoleError("the given variable was not found"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1004 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1005 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1006 |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1007 |
IConsolePrintF(_icolour_def, "variable name: %s", var->name); |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1008 |
IConsolePrintF(_icolour_def, "variable type: %s", _icon_vartypes[var->type]); |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1009 |
IConsolePrintF(_icolour_def, "variable addr: 0x%X", var->addr); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1010 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1011 |
if (var->hook.access) IConsoleWarning("variable is access hooked"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1012 |
if (var->hook.pre) IConsoleWarning("variable is pre hooked"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1013 |
if (var->hook.post) IConsoleWarning("variable is post hooked"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1014 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1015 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1016 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1017 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1018 |
DEF_CONSOLE_CMD(ConInfoCmd) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1019 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1020 |
const IConsoleCmd *cmd; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1021 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1022 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1023 |
IConsoleHelp("Print out debugging information about a command. Usage: 'info_cmd <cmd>'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1024 |
return true; |
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
|
1025 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1026 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1027 |
if (argc < 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1028 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1029 |
cmd = IConsoleCmdGet(argv[1]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1030 |
if (cmd == NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1031 |
IConsoleError("the given command was not found"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1032 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1033 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1034 |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1035 |
IConsolePrintF(_icolour_def, "command name: %s", cmd->name); |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1036 |
IConsolePrintF(_icolour_def, "command proc: 0x%X", cmd->proc); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1037 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1038 |
if (cmd->hook.access) IConsoleWarning("command is access hooked"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1039 |
if (cmd->hook.pre) IConsoleWarning("command is pre hooked"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1040 |
if (cmd->hook.post) IConsoleWarning("command is post hooked"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1041 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1042 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1043 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1044 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1045 |
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
|
1046 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1047 |
if (argc == 0) { |
1847
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1048 |
IConsoleHelp("Get/set the default debugging level for the game. Usage: 'debug_level [<level>]'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1049 |
IConsoleHelp("Level can be any combination of names, levels. Eg 'net=5 ms=4'. Remember to enclose it in \"'s"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1050 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1051 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1052 |
|
1847
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1053 |
if (argc > 2) return false; |
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1054 |
|
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1055 |
if (argc == 1) { |
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1056 |
IConsolePrintF(_icolour_def, "Current debug-level: '%s'", GetDebugString()); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1057 |
} else { |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1058 |
SetDebugString(argv[1]); |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1059 |
} |
1847
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1060 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1061 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1062 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1063 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1064 |
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
|
1065 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1066 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1067 |
IConsoleHelp("Exit the game. Usage: 'exit'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1068 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1069 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1070 |
|
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
|
1071 |
_exit_game = true; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1072 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1073 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1074 |
|
1814
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1075 |
DEF_CONSOLE_CMD(ConPart) |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1076 |
{ |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1077 |
if (argc == 0) { |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1078 |
IConsoleHelp("Leave the currently joined/running game (only ingame). Usage: 'part'"); |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1079 |
return true; |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1080 |
} |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1081 |
|
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1082 |
if (_game_mode != GM_NORMAL) return false; |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1083 |
|
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1084 |
_switch_mode = SM_MENU; |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1085 |
return true; |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1086 |
} |
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1087 |
|
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
|
1088 |
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
|
1089 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1090 |
if (argc == 2) { |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1091 |
const IConsoleCmd *cmd; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1092 |
const IConsoleVar *var; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1093 |
const IConsoleAlias *alias; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1094 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1095 |
cmd = IConsoleCmdGet(argv[1]); |
2026 | 1096 |
if (cmd != NULL) { |
1097 |
cmd->proc(0, NULL); |
|
1098 |
return true; |
|
1099 |
} |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1100 |
|
2026 | 1101 |
alias = IConsoleAliasGet(argv[1]); |
1102 |
if (alias != NULL) { |
|
1103 |
cmd = IConsoleCmdGet(alias->cmdline); |
|
1104 |
if (cmd != NULL) { |
|
1105 |
cmd->proc(0, NULL); |
|
1106 |
return true; |
|
1107 |
} |
|
1108 |
IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline); |
|
1109 |
return true; |
|
1110 |
} |
|
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1111 |
|
2026 | 1112 |
var = IConsoleVarGet(argv[1]); |
1113 |
if (var != NULL && var->help != NULL) { |
|
1114 |
IConsoleHelp(var->help); |
|
1115 |
return true; |
|
1116 |
} |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1117 |
|
2026 | 1118 |
IConsoleError("command or variable not found"); |
1119 |
return true; |
|
1120 |
} |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1121 |
|
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
1122 |
IConsolePrint(13, " ---- OpenTTD Console Help ---- "); |
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
1123 |
IConsolePrint( 1, " - variables: [command to list all variables: list_vars]"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1124 |
IConsolePrint( 1, " set value with '<var> = <value>', use '++/--' to in-or decrement"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1125 |
IConsolePrint( 1, " or omit '=' and just '<var> <value>'. get value with typing '<var>'"); |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
1126 |
IConsolePrint( 1, " - commands: [command to list all commands: list_cmds]"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1127 |
IConsolePrint( 1, " call commands with '<command> <arg2> <arg3>...'"); |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
1128 |
IConsolePrint( 1, " - to assign strings, or use them as arguments, enclose it within quotes"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1129 |
IConsolePrint( 1, " like this: '<command> \"string argument with spaces\"'"); |
2540
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
1130 |
IConsolePrint( 1, " - use 'help <command> | <variable>' to get specific information"); |
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
1131 |
IConsolePrint( 1, " - scroll console output with shift + (up | down) | (pageup | pagedown))"); |
c8b07e7aa73e
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
1132 |
IConsolePrint( 1, " - scroll console input history with the up | down arrows"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1133 |
IConsolePrint( 1, ""); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1134 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1135 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1136 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1137 |
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
|
1138 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1139 |
const IConsoleCmd *cmd; |
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
|
1140 |
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
|
1141 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1142 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1143 |
IConsoleHelp("List all registered commands. Usage: 'list_cmds [<pre-filter>]'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1144 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1145 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1146 |
|
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
|
1147 |
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
|
1148 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1149 |
for (cmd = _iconsole_cmds; cmd != NULL; cmd = cmd->next) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1150 |
if (argv[1] == NULL || strncmp(cmd->name, argv[1], l) == 0) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1151 |
IConsolePrintF(_icolour_def, "%s", cmd->name); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1152 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1153 |
} |
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
|
1154 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1155 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1156 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1157 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1158 |
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
|
1159 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1160 |
const IConsoleVar *var; |
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
|
1161 |
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
|
1162 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1163 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1164 |
IConsoleHelp("List all registered variables. Usage: 'list_vars [<pre-filter>]'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1165 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1166 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1167 |
|
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
|
1168 |
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
|
1169 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1170 |
for (var = _iconsole_vars; var != NULL; var = var->next) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1171 |
if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0) |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1172 |
IConsolePrintF(_icolour_def, "%s", var->name); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1173 |
} |
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
|
1174 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1175 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1176 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1177 |
|
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1178 |
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
|
1179 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1180 |
const IConsoleAlias *alias; |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1181 |
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
|
1182 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1183 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1184 |
IConsoleHelp("List all registered aliases. Usage: 'list_aliases [<pre-filter>]'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1185 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1186 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1187 |
|
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1188 |
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
|
1189 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1190 |
for (alias = _iconsole_aliases; alias != NULL; alias = alias->next) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1191 |
if (argv[1] == NULL || strncmp(alias->name, argv[1], l) == 0) |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1192 |
IConsolePrintF(_icolour_def, "%s => %s", alias->name, alias->cmdline); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1193 |
} |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1194 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1195 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1196 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1197 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1198 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1199 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1200 |
DEF_CONSOLE_CMD(ConSay) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1201 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1202 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1203 |
IConsoleHelp("Chat to your fellow players in a multiplayer game. Usage: 'say \"<msg>\"'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1204 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1205 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1206 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1207 |
if (argc != 2) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1208 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1209 |
if (!_network_server) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1210 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0 /* param does not matter */, argv[1]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1211 |
} else { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1212 |
NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, argv[1], NETWORK_SERVER_INDEX); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1213 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1214 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1215 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1216 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1217 |
|
4826
6a545d194528
(svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents:
4716
diff
changeset
|
1218 |
#ifdef ENABLE_NETWORK |
6a545d194528
(svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents:
4716
diff
changeset
|
1219 |
#include "table/strings.h" |
6a545d194528
(svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents:
4716
diff
changeset
|
1220 |
#endif /* ENABLE_NETWORK */ |
6a545d194528
(svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents:
4716
diff
changeset
|
1221 |
|
3818
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1222 |
DEF_CONSOLE_CMD(ConPlayers) |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1223 |
{ |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1224 |
Player *p; |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1225 |
|
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1226 |
if (argc == 0) { |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1227 |
IConsoleHelp("List the in-game details of all clients connected to the server. Usage 'players'"); |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1228 |
return true; |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1229 |
} |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1230 |
NetworkPopulateCompanyInfo(); |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1231 |
|
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1232 |
FOR_ALL_PLAYERS(p) { |
3847
2605e667c3bb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1233 |
char buffer[512]; |
2605e667c3bb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1234 |
|
2605e667c3bb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1235 |
if (!p->is_active) continue; |
2605e667c3bb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1236 |
|
4912
0f51b47cb983
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4906
diff
changeset
|
1237 |
GetString(buffer, STR_00D1_DARK_BLUE + _player_colors[p->index], lastof(buffer)); |
3857
94fe68306d8b
(svn r4889) - Codechange: added vehicle count in 'players' console command
glx
parents:
3852
diff
changeset
|
1238 |
IConsolePrintF(8, "#:%d(%s) Company Name: '%s' Year Founded: %d Money: %d Loan: %d Value: %" OTTD_PRINTF64 "d (T:%d, R:%d, P:%d, S:%d)", |
4329
0e6e689f66e7
(svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant.
rubidium
parents:
4300
diff
changeset
|
1239 |
p->index + 1, buffer, _network_player_info[p->index].company_name, p->inaugurated_year, p->player_money, p->current_loan, CalculateCompanyValue(p), |
3857
94fe68306d8b
(svn r4889) - Codechange: added vehicle count in 'players' console command
glx
parents:
3852
diff
changeset
|
1240 |
/* trains */ _network_player_info[p->index].num_vehicle[0], |
94fe68306d8b
(svn r4889) - Codechange: added vehicle count in 'players' console command
glx
parents:
3852
diff
changeset
|
1241 |
/* lorry + bus */ _network_player_info[p->index].num_vehicle[1] + _network_player_info[p->index].num_vehicle[2], |
94fe68306d8b
(svn r4889) - Codechange: added vehicle count in 'players' console command
glx
parents:
3852
diff
changeset
|
1242 |
/* planes */ _network_player_info[p->index].num_vehicle[3], |
94fe68306d8b
(svn r4889) - Codechange: added vehicle count in 'players' console command
glx
parents:
3852
diff
changeset
|
1243 |
/* ships */ _network_player_info[p->index].num_vehicle[4]); |
3818
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1244 |
} |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1245 |
|
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1246 |
return true; |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1247 |
} |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1248 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1249 |
DEF_CONSOLE_CMD(ConSayPlayer) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1250 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1251 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1252 |
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_player <player-no> \"<msg>\"'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1253 |
IConsoleHelp("PlayerNo is the player that plays as company <playerno>, 1 through max_players"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1254 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1255 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1256 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1257 |
if (argc != 3) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1258 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1259 |
if (atoi(argv[1]) < 1 || atoi(argv[1]) > MAX_PLAYERS) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1260 |
IConsolePrintF(_icolour_def, "Unknown player. Player range is between 1 and %d.", MAX_PLAYERS); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1261 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1262 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1263 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1264 |
if (!_network_server) { |
4906
935e6280c093
(svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents:
4883
diff
changeset
|
1265 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1266 |
} else { |
4906
935e6280c093
(svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents:
4883
diff
changeset
|
1267 |
NetworkServer_HandleChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1268 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1269 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1270 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1271 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1272 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1273 |
DEF_CONSOLE_CMD(ConSayClient) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1274 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1275 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1276 |
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_client <client-no> \"<msg>\"'"); |
2026 | 1277 |
IConsoleHelp("For client-id's, see the command 'clients'"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1278 |
return true; |
627
5495f77a0e7c
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents:
625
diff
changeset
|
1279 |
} |
5495f77a0e7c
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents:
625
diff
changeset
|
1280 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1281 |
if (argc != 3) return false; |
1602
79f98b4b83fc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1596
diff
changeset
|
1282 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1283 |
if (!_network_server) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1284 |
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1285 |
} else { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1286 |
NetworkServer_HandleChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1287 |
} |
678
f62cae2abc0c
(svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents:
666
diff
changeset
|
1288 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1289 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1290 |
} |
1602
79f98b4b83fc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1596
diff
changeset
|
1291 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1292 |
DEF_CONSOLE_HOOK(ConHookServerPW) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1293 |
{ |
4026
035972c11282
(svn r5265) Replace a dozen bogus uses of strncmp() by strcmp()
tron
parents:
4025
diff
changeset
|
1294 |
if (strcmp(_network_server_password, "*") == 0) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1295 |
_network_server_password[0] = '\0'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1296 |
_network_game_info.use_password = 0; |
2863
c428bffc6ae5
(svn r3411) - Fix: When changing the server password via the console, actually set the password as well as flag whether it is required.
peter1138
parents:
2860
diff
changeset
|
1297 |
} else { |
c428bffc6ae5
(svn r3411) - Fix: When changing the server password via the console, actually set the password as well as flag whether it is required.
peter1138
parents:
2860
diff
changeset
|
1298 |
ttd_strlcpy(_network_game_info.server_password, _network_server_password, sizeof(_network_server_password)); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1299 |
_network_game_info.use_password = 1; |
2863
c428bffc6ae5
(svn r3411) - Fix: When changing the server password via the console, actually set the password as well as flag whether it is required.
peter1138
parents:
2860
diff
changeset
|
1300 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1301 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1302 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1303 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1304 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1305 |
DEF_CONSOLE_HOOK(ConHookRconPW) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1306 |
{ |
4026
035972c11282
(svn r5265) Replace a dozen bogus uses of strncmp() by strcmp()
tron
parents:
4025
diff
changeset
|
1307 |
if (strcmp(_network_rcon_password, "*") == 0) |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1308 |
_network_rcon_password[0] = '\0'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1309 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1310 |
ttd_strlcpy(_network_game_info.rcon_password, _network_rcon_password, sizeof(_network_game_info.rcon_password)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1311 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1312 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1313 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1314 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1315 |
/* Also use from within player_gui to change the password graphically */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1316 |
bool NetworkChangeCompanyPassword(byte argc, char *argv[]) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1317 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1318 |
if (argc == 0) { |
4850
93095755db8c
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4826
diff
changeset
|
1319 |
if (!IsValidPlayer(_local_player)) return true; // dedicated server |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1320 |
IConsolePrintF(_icolour_warn, "Current value for 'company_pw': %s", _network_player_info[_local_player].password); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1321 |
return true; |
690
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1322 |
} |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1323 |
|
4850
93095755db8c
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4826
diff
changeset
|
1324 |
if (!IsValidPlayer(_local_player)) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1325 |
IConsoleError("You have to own a company to make use of this command."); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1326 |
return false; |
690
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1327 |
} |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1328 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1329 |
if (argc != 1) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1330 |
|
4026
035972c11282
(svn r5265) Replace a dozen bogus uses of strncmp() by strcmp()
tron
parents:
4025
diff
changeset
|
1331 |
if (strcmp(argv[0], "*") == 0) argv[0][0] = '\0'; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1332 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1333 |
ttd_strlcpy(_network_player_info[_local_player].password, argv[0], sizeof(_network_player_info[_local_player].password)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1334 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1335 |
if (!_network_server) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1336 |
SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1337 |
|
1866
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1847
diff
changeset
|
1338 |
IConsolePrintF(_icolour_warn, "'company_pw' changed to: %s", _network_player_info[_local_player].password); |
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1847
diff
changeset
|
1339 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1340 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1341 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1342 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1343 |
DEF_CONSOLE_HOOK(ConProcPlayerName) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1344 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1345 |
NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1346 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1347 |
if (ci == NULL) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1348 |
|
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1349 |
/* Don't change the name if it is the same as the old name */ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1350 |
if (strcmp(ci->client_name, _network_player_name) != 0) { |
785
bba7b3b35dec
(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents:
784
diff
changeset
|
1351 |
if (!_network_server) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1352 |
SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_network_player_name); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1353 |
} else { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1354 |
if (NetworkFindName(_network_player_name)) { |
2373
e073ec69bf56
(svn r2899) -Fix: Several format string vulnerabilities and buffer overflows in the network code
tron
parents:
2186
diff
changeset
|
1355 |
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, "%s", _network_player_name); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1356 |
ttd_strlcpy(ci->client_name, _network_player_name, sizeof(ci->client_name)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1357 |
NetworkUpdateClientInfo(NETWORK_SERVER_INDEX); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1358 |
} |
785
bba7b3b35dec
(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents:
784
diff
changeset
|
1359 |
} |
bba7b3b35dec
(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents:
784
diff
changeset
|
1360 |
} |
bba7b3b35dec
(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents:
784
diff
changeset
|
1361 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1362 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1363 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1364 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1365 |
DEF_CONSOLE_HOOK(ConHookServerName) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1366 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1367 |
ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1368 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1369 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1370 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1371 |
DEF_CONSOLE_HOOK(ConHookServerAdvertise) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1372 |
{ |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1827
diff
changeset
|
1373 |
if (!_network_advertise) // remove us from advertising |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1374 |
NetworkUDPRemoveAdvertise(); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1375 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1376 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1377 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1378 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1379 |
DEF_CONSOLE_CMD(ConProcServerIP) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1380 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1381 |
if (argc == 0) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1798
diff
changeset
|
1382 |
IConsolePrintF(_icolour_warn, "Current value for 'server_ip': %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip)); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1383 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1384 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1385 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1386 |
if (argc != 1) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1387 |
|
1868
99ba6fdbae20
(svn r2374) - CodeChange: giving server_ip a value of 'all' will make the server listen on any interface (0.0.0.0); also fix a typo in one of the script example files: s/ports/interfaces
Darkvater
parents:
1866
diff
changeset
|
1388 |
_network_server_bind_ip = (strcmp(argv[0], "all") == 0) ? inet_addr("0.0.0.0") : inet_addr(argv[0]); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1389 |
snprintf(_network_server_bind_ip_host, sizeof(_network_server_bind_ip_host), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip)); |
1866
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1847
diff
changeset
|
1390 |
IConsolePrintF(_icolour_warn, "'server_ip' changed to: %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip)); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1391 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1392 |
} |
4614
3b28b8e7d4b6
(svn r6471) -Fix (r6450): ConPatch was moved from network-only, but the function was
Darkvater
parents:
4600
diff
changeset
|
1393 |
#endif /* ENABLE_NETWORK */ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1394 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1395 |
DEF_CONSOLE_CMD(ConPatch) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1396 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1397 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1398 |
IConsoleHelp("Change patch variables for all players. Usage: 'patch <name> [<value>]'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1399 |
IConsoleHelp("Omitting <value> will print out the current value of the patch-setting."); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1400 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1401 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1402 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1403 |
if (argc == 1 || argc > 3) return false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1404 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1405 |
if (argc == 2) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1406 |
IConsoleGetPatchSetting(argv[1]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1407 |
} else { |
4279
ec2e69af6b6b
(svn r5909) -Fix (r5908): silence signedness warning
rubidium
parents:
4278
diff
changeset
|
1408 |
uint32 val; |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1409 |
|
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1410 |
if (GetArgumentInteger(&val, argv[2])) { |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1411 |
if (!IConsoleSetPatchSetting(argv[1], val)) { |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1412 |
IConsoleError("This command/variable is only available to a network server."); |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1413 |
} |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1414 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1415 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1416 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1417 |
return true; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1418 |
} |
623
3c50358d5a1b
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
1419 |
|
6429
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1420 |
DEF_CONSOLE_CMD(ConListPatches) |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1421 |
{ |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1422 |
if (argc == 0) { |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1423 |
IConsoleHelp("List patch options. Usage: 'list_patches'"); |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1424 |
return true; |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1425 |
} |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1426 |
|
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1427 |
if (argc != 1) return false; |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1428 |
|
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1429 |
IConsoleListPatches(); |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1430 |
return true; |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1431 |
} |
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1432 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1433 |
DEF_CONSOLE_CMD(ConListDumpVariables) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1434 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1435 |
const IConsoleVar *var; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1436 |
size_t l = 0; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1437 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1438 |
if (argc == 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1439 |
IConsoleHelp("List all variables with their value. Usage: 'dump_vars [<pre-filter>]'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1440 |
return true; |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1441 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1442 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1443 |
if (argv[1] != NULL) l = strlen(argv[1]); |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1444 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1445 |
for (var = _iconsole_vars; var != NULL; var = var->next) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1446 |
if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1447 |
IConsoleVarPrintGetValue(var); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1448 |
} |
623
3c50358d5a1b
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
1449 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1450 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1451 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1452 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1453 |
|
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
|
1454 |
#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
|
1455 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1456 |
/* 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
|
1457 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1458 |
|
6247 | 1459 |
static void IConsoleDebugLibRegister() |
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
|
1460 |
{ |
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1461 |
/* debugging variables and functions */ |
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1462 |
extern bool _stdlib_con_developer; // XXX extern in .cpp |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1463 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1464 |
IConsoleVarRegister("con_developer", &_stdlib_con_developer, ICONSOLE_VAR_BOOLEAN, "Enable/disable console debugging information (internal)"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1465 |
IConsoleCmdRegister("resettile", ConResetTile); |
3621
5d2e486e7a8b
(svn r4518) - Fix: specify the 'stopall' console command as a debug command. Mostly because stopped airplanes in mid-air 1. look funny 2. won't ever budge again. (change of r2449)
Darkvater
parents:
3431
diff
changeset
|
1466 |
IConsoleCmdRegister("stopall", ConStopAllVehicles); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1467 |
IConsoleAliasRegister("dbg_echo", "echo %A; echo %B"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1468 |
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
|
1469 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1470 |
#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
|
1471 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1472 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1473 |
/* 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
|
1474 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1475 |
|
6247 | 1476 |
void IConsoleStdLibRegister() |
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
|
1477 |
{ |
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1478 |
/* stdlib */ |
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1479 |
extern byte _stdlib_developer; // XXX extern in .cpp |
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
|
1480 |
|
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1481 |
/* 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
|
1482 |
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
|
1483 |
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
|
1484 |
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
|
1485 |
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
|
1486 |
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
|
1487 |
IConsoleCmdRegister("exit", ConExit); |
1814
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1488 |
IConsoleCmdRegister("part", ConPart); |
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
|
1489 |
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
|
1490 |
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
|
1491 |
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
|
1492 |
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
|
1493 |
IConsoleCmdRegister("list_vars", ConListVariables); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1494 |
IConsoleCmdRegister("list_aliases", ConListAliases); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1495 |
IConsoleCmdRegister("newgame", ConNewGame); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
1496 |
IConsoleCmdRegister("restart", ConRestart); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
1497 |
IConsoleCmdRegister("getseed", ConGetSeed); |
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
|
1498 |
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
|
1499 |
IConsoleCmdRegister("resetengines", ConResetEngines); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1500 |
IConsoleCmdRegister("return", ConReturn); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1501 |
IConsoleCmdRegister("screenshot", ConScreenShot); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1502 |
IConsoleCmdRegister("script", ConScript); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1503 |
IConsoleCmdRegister("scrollto", ConScrollToTile); |
2026 | 1504 |
IConsoleCmdRegister("alias", ConAlias); |
1505 |
IConsoleCmdRegister("load", ConLoad); |
|
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
1506 |
IConsoleCmdRegister("rm", ConRemove); |
2026 | 1507 |
IConsoleCmdRegister("save", ConSave); |
5507
02ba56cb4272
(svn r7801) -Feature: add command line option to prevent saving of highscore and configuration on exit and a console command to manually initiate a configuration save (Aloysha).
rubidium
parents:
5475
diff
changeset
|
1508 |
IConsoleCmdRegister("saveconfig", ConSaveConfig); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1509 |
IConsoleCmdRegister("ls", ConListFiles); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1510 |
IConsoleCmdRegister("cd", ConChangeDirectory); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1511 |
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory); |
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
1512 |
IConsoleCmdRegister("clear", ConClearBuffer); |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1513 |
IConsoleCmdRegister("patch", ConPatch); |
6429
3512a65a7cfe
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6259
diff
changeset
|
1514 |
IConsoleCmdRegister("list_patches", ConListPatches); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1515 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1516 |
IConsoleAliasRegister("dir", "ls"); |
2419
076f0b1403dd
(svn r2945) Add 'del' alias to rm console command
Darkvater
parents:
2415
diff
changeset
|
1517 |
IConsoleAliasRegister("del", "rm %+"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1518 |
IConsoleAliasRegister("newmap", "newgame"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1519 |
IConsoleAliasRegister("new_map", "newgame"); |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1520 |
IConsoleAliasRegister("new_game", "newgame"); |
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1521 |
|
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1522 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1523 |
IConsoleVarRegister("developer", &_stdlib_developer, ICONSOLE_VAR_BYTE, "Redirect debugging output from the console/command line to the ingame console (value 2). Default value: 1"); |
554 | 1524 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1525 |
/* networking variables and functions */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1526 |
#ifdef ENABLE_NETWORK |
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1527 |
/* Network hooks; only active in network */ |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1528 |
IConsoleCmdHookAdd ("resetengines", ICONSOLE_HOOK_ACCESS, ConHookNoNetwork); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1529 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1530 |
/*** Networking commands ***/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1531 |
IConsoleCmdRegister("say", ConSay); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1532 |
IConsoleCmdHookAdd("say", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
3818
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1533 |
IConsoleCmdRegister("players", ConPlayers); |
4683949ba485
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1534 |
IConsoleCmdHookAdd("players", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1535 |
IConsoleCmdRegister("say_player", ConSayPlayer); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1536 |
IConsoleCmdHookAdd("say_player", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1537 |
IConsoleCmdRegister("say_client", ConSayClient); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1538 |
IConsoleCmdHookAdd("say_client", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1539 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1540 |
IConsoleCmdRegister("connect", ConNetworkConnect); |
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1541 |
IConsoleCmdHookAdd("connect", ICONSOLE_HOOK_ACCESS, ConHookClientOnly); |
1814
9fd6011c77d8
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1542 |
IConsoleAliasRegister("join", "connect %A"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1543 |
IConsoleCmdRegister("clients", ConNetworkClients); |
1761
f5eea0a214bb
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
1544 |
IConsoleCmdHookAdd("clients", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1545 |
IConsoleCmdRegister("status", ConStatus); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1546 |
IConsoleCmdHookAdd("status", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1547 |
IConsoleCmdRegister("server_info", ConServerInfo); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1548 |
IConsoleCmdHookAdd("server_info", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1549 |
IConsoleAliasRegister("info", "server_info"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1550 |
IConsoleCmdRegister("rcon", ConRcon); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1551 |
IConsoleCmdHookAdd("rcon", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
1552 |
|
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1553 |
IConsoleCmdRegister("reset_company", ConResetCompany); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1554 |
IConsoleCmdHookAdd("reset_company", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1555 |
IConsoleAliasRegister("clean_company", "reset_company %A"); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1556 |
IConsoleCmdRegister("kick", ConKick); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1557 |
IConsoleCmdHookAdd("kick", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1558 |
IConsoleCmdRegister("ban", ConBan); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1559 |
IConsoleCmdHookAdd("ban", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1560 |
IConsoleCmdRegister("unban", ConUnBan); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1561 |
IConsoleCmdHookAdd("unban", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1562 |
IConsoleCmdRegister("banlist", ConBanList); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1563 |
IConsoleCmdHookAdd("banlist", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1564 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1565 |
IConsoleCmdRegister("pause", ConPauseGame); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1566 |
IConsoleCmdHookAdd("pause", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1567 |
IConsoleCmdRegister("unpause", ConUnPauseGame); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1568 |
IConsoleCmdHookAdd("unpause", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
1569 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1570 |
/*** Networking variables ***/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1571 |
IConsoleVarRegister("net_frame_freq", &_network_frame_freq, ICONSOLE_VAR_BYTE, "The amount of frames before a command will be (visibly) executed. Default value: 1"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1572 |
IConsoleVarHookAdd("net_frame_freq", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1573 |
IConsoleVarRegister("net_sync_freq", &_network_sync_freq, ICONSOLE_VAR_UINT16, "The amount of frames to check if the game is still in sync. Default value: 100"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1574 |
IConsoleVarHookAdd("net_sync_freq", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1575 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1576 |
IConsoleVarStringRegister("server_pw", &_network_server_password, sizeof(_network_server_password), "Set the server password to protect your server. Use '*' to clear the password"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1577 |
IConsoleVarHookAdd("server_pw", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1578 |
IConsoleVarHookAdd("server_pw", ICONSOLE_HOOK_POST_ACTION, ConHookServerPW); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1579 |
IConsoleAliasRegister("server_password", "server_pw %+"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1580 |
IConsoleVarStringRegister("rcon_pw", &_network_rcon_password, sizeof(_network_rcon_password), "Set the rcon-password to change server behaviour. Use '*' to disable rcon"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1581 |
IConsoleVarHookAdd("rcon_pw", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1582 |
IConsoleVarHookAdd("rcon_pw", ICONSOLE_HOOK_POST_ACTION, ConHookRconPW); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1583 |
IConsoleAliasRegister("rcon_password", "rcon_pw %+"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1584 |
IConsoleVarStringRegister("company_pw", NULL, 0, "Set a password for your company, so no one without the correct password can join. Use '*' to clear the password"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1585 |
IConsoleVarHookAdd("company_pw", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1586 |
IConsoleVarProcAdd("company_pw", NetworkChangeCompanyPassword); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1587 |
IConsoleAliasRegister("company_password", "company_pw %+"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1588 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1589 |
IConsoleVarStringRegister("name", &_network_player_name, sizeof(_network_player_name), "Set your name for multiplayer"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1590 |
IConsoleVarHookAdd("name", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1591 |
IConsoleVarHookAdd("name", ICONSOLE_HOOK_POST_ACTION, ConProcPlayerName); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1592 |
IConsoleVarStringRegister("server_name", &_network_server_name, sizeof(_network_server_name), "Set the name of the server for multiplayer"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1593 |
IConsoleVarHookAdd("server_name", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1594 |
IConsoleVarHookAdd("server_name", ICONSOLE_HOOK_POST_ACTION, ConHookServerName); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1595 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1596 |
IConsoleVarRegister("server_port", &_network_server_port, ICONSOLE_VAR_UINT32, "Set the server port. Changes take effect the next time you start a server"); |
1869
a8dc64882a95
(svn r2375) - CodeChange: add the newly added 'all' of server_ip to it's helptext.
Darkvater
parents:
1868
diff
changeset
|
1597 |
IConsoleVarRegister("server_ip", &_network_server_bind_ip, ICONSOLE_VAR_UINT32, "Set the IP the server binds to. Changes take effect the next time you start a server. Use 'all' to bind to any IP."); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1598 |
IConsoleVarProcAdd("server_ip", ConProcServerIP); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1599 |
IConsoleAliasRegister("server_bind_ip", "server_ip %+"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1600 |
IConsoleAliasRegister("server_ip_bind", "server_ip %+"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1601 |
IConsoleAliasRegister("server_bind", "server_ip %+"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1602 |
IConsoleVarRegister("server_advertise", &_network_advertise, ICONSOLE_VAR_BOOLEAN, "Set if the server will advertise to the master server and show up there"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1603 |
IConsoleVarHookAdd("server_advertise", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1604 |
IConsoleVarHookAdd("server_advertise", ICONSOLE_HOOK_POST_ACTION, ConHookServerAdvertise); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1605 |
|
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1606 |
IConsoleVarRegister("max_clients", &_network_game_info.clients_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of connected players during runtime. Default value: 10"); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1607 |
IConsoleVarHookAdd("max_clients", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1608 |
IConsoleVarHookAdd("max_clients", ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxClientsCount); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1609 |
IConsoleVarRegister("max_companies", &_network_game_info.companies_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of active companies during runtime. Default value: 8"); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1610 |
IConsoleVarHookAdd("max_companies", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
1611 |
IConsoleVarHookAdd("max_companies", ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxCompaniesCount); |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1612 |
IConsoleVarRegister("max_spectators", &_network_game_info.spectators_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of active spectators during runtime. Default value: 9"); |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
1613 |
IConsoleVarHookAdd("max_spectators", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
3011
9b27a8056d2b
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
1614 |
IConsoleVarHookAdd("max_spectators", ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxSpectatorsCount); |
2880
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1615 |
|
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1616 |
IConsoleVarRegister("max_join_time", &_network_max_join_time, ICONSOLE_VAR_UINT16, "Set the maximum amount of time (ticks) a client is allowed to join. Default value: 500"); |
d3416670195c
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1617 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1618 |
IConsoleVarRegister("pause_on_join", &_network_pause_on_join, ICONSOLE_VAR_BOOLEAN, "Set if the server should pause gameplay while a client is joining. This might help slow users"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1619 |
IConsoleVarHookAdd("pause_on_join", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1620 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1621 |
IConsoleVarRegister("autoclean_companies", &_network_autoclean_companies, ICONSOLE_VAR_BOOLEAN, "Automatically shut down inactive companies to free them up for other players. Customize with 'autoclean_(un)protected'"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1622 |
IConsoleVarHookAdd("autoclean_companies", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1623 |
IConsoleVarRegister("autoclean_protected", &_network_autoclean_protected, ICONSOLE_VAR_BYTE, "Automatically remove the password from an inactive company after the given amount of months"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1624 |
IConsoleVarHookAdd("autoclean_protected", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
1992
f8f90d2ab9b5
(svn r2498) -Fix: [1230241] The console variable autoclean_unprotected was linked to the variable _network_autoclean_protected
tron
parents:
1962
diff
changeset
|
1625 |
IConsoleVarRegister("autoclean_unprotected", &_network_autoclean_unprotected, ICONSOLE_VAR_BYTE, "Automatically shut down inactive companies after the given amount of months"); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1626 |
IConsoleVarHookAdd("autoclean_unprotected", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4285
19cb745c694e
(svn r5915) -Cleanup: some variables were named *_date while they were only holding years; rename these variables to match this.
rubidium
parents:
4279
diff
changeset
|
1627 |
IConsoleVarRegister("restart_game_year", &_network_restart_game_year, ICONSOLE_VAR_UINT16, "Auto-restart the server when Jan 1st of the set year is reached. Use '0' to disable this"); |
19cb745c694e
(svn r5915) -Cleanup: some variables were named *_date while they were only holding years; rename these variables to match this.
rubidium
parents:
4279
diff
changeset
|
1628 |
IConsoleVarHookAdd("restart_game_year", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1629 |
|
4716
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
1630 |
IConsoleVarRegister("min_players", &_network_min_players, ICONSOLE_VAR_BYTE, "Automatically pause the game when the number of active players passes below the given amount"); |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
1631 |
IConsoleVarHookAdd("min_players", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
1632 |
IConsoleVarHookAdd("min_players", ICONSOLE_HOOK_POST_ACTION, ConHookCheckMinPlayers); |
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
1633 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1634 |
#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
|
1635 |
|
554 | 1636 |
// debugging stuff |
1637 |
#ifdef _DEBUG |
|
1638 |
IConsoleDebugLibRegister(); |
|
1639 |
#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
|
1640 |
} |