author | rubidium |
Thu, 17 Jul 2008 20:13:01 +0000 | |
changeset 9652 | 0405e98d8e96 |
parent 9612 | 316df1347f4e |
child 9659 | 187142ff9b6c |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8786
diff
changeset
|
3 |
/** @file console_cmds.cpp Implementation of the console hooks. */ |
6123
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" |
9336 | 7 |
#include "console_internal.h" |
1299
39c06aba09aa
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1147
diff
changeset
|
8 |
#include "debug.h" |
8786
1823ff88a054
(svn r12490) -Codechange: rename engine.h to engine_func.h and remove unneeded inclusions of engine.h and/or replace them with engine_type.h.
rubidium
parents:
8504
diff
changeset
|
9 |
#include "engine_func.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
|
10 |
#include "landscape.h" |
2162
b98e430ffd10
(svn r2672) Move saving/loading related declarations to saveload.h
tron
parents:
2099
diff
changeset
|
11 |
#include "saveload.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
|
12 |
#include "variables.h" |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
13 |
#include "network/network.h" |
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
14 |
#include "network/network_func.h" |
8116
8da76dcb3287
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8114
diff
changeset
|
15 |
#include "command_func.h" |
8208
3d0590aa2124
(svn r11771) -Codechange: split settings.h into better separated headers.
rubidium
parents:
8144
diff
changeset
|
16 |
#include "settings_func.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
|
17 |
#include "fios.h" |
6929
56470c1b8a66
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
6890
diff
changeset
|
18 |
#include "fileio.h" |
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
19 |
#include "screenshot.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
20 |
#include "genworld.h" |
8114
dd6d21dc99c1
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
7999
diff
changeset
|
21 |
#include "strings_func.h" |
8225
cd84a95b6630
(svn r11788) -Fix (11787): makedepend doesn't mark delete files as changed...
rubidium
parents:
8214
diff
changeset
|
22 |
#include "viewport_func.h" |
8131
160939e24ed3
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8121
diff
changeset
|
23 |
#include "window_func.h" |
160939e24ed3
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8121
diff
changeset
|
24 |
#include "functions.h" |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8131
diff
changeset
|
25 |
#include "map_func.h" |
8140
0d0d8c94f84b
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8139
diff
changeset
|
26 |
#include "date_func.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8140
diff
changeset
|
27 |
#include "vehicle_func.h" |
8214
971f861d5543
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8208
diff
changeset
|
28 |
#include "string_func.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8225
diff
changeset
|
29 |
#include "player_func.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8225
diff
changeset
|
30 |
#include "player_base.h" |
8270
e7c342f6b14c
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8265
diff
changeset
|
31 |
#include "settings_type.h" |
9457
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
32 |
#include "gamelog.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
|
33 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
34 |
#ifdef ENABLE_NETWORK |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
35 |
#include "table/strings.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
36 |
#endif /* ENABLE_NETWORK */ |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
37 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
38 |
// ** 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
|
39 |
static FILE *_script_file; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
40 |
static bool _script_running; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
41 |
|
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
|
42 |
// ** 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
|
43 |
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[]) |
6247 | 44 |
#define DEF_CONSOLE_HOOK(function) static bool function() |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
45 |
|
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
|
46 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
47 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
48 |
/* 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
|
49 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
50 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
51 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
52 |
|
6247 | 53 |
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
|
54 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
56 |
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
|
57 |
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
|
58 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
59 |
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
|
60 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
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 |
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
|
65 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
67 |
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
|
68 |
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
|
69 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
70 |
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
|
71 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
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 |
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
|
76 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
78 |
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
|
79 |
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
|
80 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
81 |
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
|
82 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
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 |
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
|
87 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
88 |
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
|
89 |
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
|
90 |
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
|
91 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
92 |
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
|
93 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
94 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
95 |
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
|
96 |
{ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
} |
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
|
101 |
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
|
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 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
104 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
105 |
|
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
|
106 |
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
|
107 |
{ |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
108 |
IConsolePrintF(CC_WARNING, "- %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
|
109 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
110 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
111 |
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
|
112 |
{ |
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
|
113 |
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
|
114 |
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
|
115 |
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
|
116 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
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
|
118 |
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
|
119 |
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
|
120 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
121 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
122 |
#ifdef _DEBUG |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
123 |
DEF_CONSOLE_CMD(ConResetTile) |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
124 |
{ |
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
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
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
|
129 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
130 |
|
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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
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
|
136 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
137 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
138 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
139 |
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
|
140 |
} |
3647
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 |
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
|
143 |
{ |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
144 |
if (argc == 0) { |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
145 |
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
|
146 |
return true; |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
147 |
} |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
148 |
|
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8140
diff
changeset
|
149 |
StopAllVehicles(); |
3647
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
150 |
return true; |
d7a1dbe385d8
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
151 |
} |
1740
f7af92074430
(svn r2244) - Fix: 'scrollto' is not debug only..sorry :)
Darkvater
parents:
1739
diff
changeset
|
152 |
#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
|
153 |
|
b88456001397
(svn r223) -Fix: 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 |
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
|
155 |
{ |
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
|
156 |
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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
} |
b88456001397
(svn r223) -Fix: 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 |
|
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
|
162 |
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
|
163 |
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
|
164 |
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
|
165 |
if (result >= MapSize()) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
166 |
IConsolePrint(CC_ERROR, "Tile does not exist"); |
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
|
167 |
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
|
168 |
} |
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
|
169 |
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
|
170 |
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
|
171 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
175 |
} |
b88456001397
(svn r223) -Fix: 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 |
|
6247 | 177 |
extern void BuildFileList(); |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
178 |
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
|
179 |
|
1565
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
180 |
/* Save the map to a file */ |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
181 |
DEF_CONSOLE_CMD(ConSave) |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
182 |
{ |
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
|
183 |
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
|
184 |
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
|
185 |
return true; |
1565
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
186 |
} |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
187 |
|
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
|
188 |
if (argc == 2) { |
6929
56470c1b8a66
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
6890
diff
changeset
|
189 |
char *filename = str_fmt("%s.sav", argv[1]); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
190 |
IConsolePrint(CC_DEFAULT, "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
|
191 |
|
6929
56470c1b8a66
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
6890
diff
changeset
|
192 |
if (SaveOrLoad(filename, SL_SAVE, SAVE_DIR) != SL_OK) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
193 |
IConsolePrint(CC_ERROR, "Saving map failed"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
194 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
195 |
IConsolePrintF(CC_DEFAULT, "Map sucessfully saved to %s", filename); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
196 |
} |
6929
56470c1b8a66
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
6890
diff
changeset
|
197 |
free(filename); |
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
|
198 |
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
|
199 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
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
|
201 |
return false; |
1565
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
202 |
} |
c40a588c5934
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
203 |
|
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
|
204 |
/* 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
|
205 |
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
|
206 |
{ |
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 |
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
|
208 |
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
|
209 |
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
|
210 |
} |
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 |
|
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 |
SaveToConfig(); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
213 |
IConsolePrint(CC_DEFAULT, "Saved config."); |
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
|
214 |
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
|
215 |
} |
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 |
|
1581 | 217 |
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
|
218 |
{ |
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
|
219 |
_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
|
220 |
BuildFileList(); |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
221 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
222 |
for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) { |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
223 |
if (strcmp(file, item->name) == 0) return item; |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
224 |
if (strcmp(file, item->title) == 0) return item; |
1581 | 225 |
} |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
226 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
227 |
/* If no name matches, try to parse it as number */ |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
228 |
char *endptr; |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
229 |
int i = strtol(file, &endptr, 10); |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
230 |
if (file == endptr || *endptr != '\0') i = -1; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
231 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
232 |
return IsInsideMM(i, 0, _fios_items.Length()) ? _fios_items.Get(i) : NULL; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
233 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
234 |
|
1581 | 235 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
236 |
DEF_CONSOLE_CMD(ConLoad) |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
237 |
{ |
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
|
238 |
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
|
239 |
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
|
240 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
241 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
242 |
|
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
|
243 |
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
|
244 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
245 |
const char *file = argv[1]; |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
246 |
const FiosItem *item = GetFiosItem(file); |
1581 | 247 |
if (item != NULL) { |
248 |
switch (item->type) { |
|
2099
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
249 |
case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: { |
1581 | 250 |
_switch_mode = SM_LOAD; |
251 |
SetFiosType(item->type); |
|
2099
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
252 |
|
02c5a49863e9
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
253 |
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
|
254 |
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
|
255 |
} break; |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
256 |
default: IConsolePrintF(CC_ERROR, "%s: Not a savegame.", file); |
1581 | 257 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
258 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
259 |
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
260 |
} |
1581 | 261 |
|
262 |
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
|
263 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
264 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
265 |
|
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
266 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
267 |
DEF_CONSOLE_CMD(ConRemove) |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
268 |
{ |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
269 |
if (argc == 0) { |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
270 |
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
|
271 |
return true; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
272 |
} |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
273 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
274 |
if (argc != 2) return false; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
275 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
276 |
const char *file = argv[1]; |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
277 |
const FiosItem *item = GetFiosItem(file); |
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
278 |
if (item != NULL) { |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
279 |
if (!FiosDelete(item->name)) |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
280 |
IConsolePrintF(CC_ERROR, "%s: Failed to delete file", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
281 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
282 |
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
283 |
} |
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
284 |
|
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
285 |
FiosFreeSavegameList(); |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
286 |
return true; |
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
287 |
} |
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 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
290 |
/* 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
|
291 |
DEF_CONSOLE_CMD(ConListFiles) |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
292 |
{ |
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
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
297 |
|
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
298 |
BuildFileList(); |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
299 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
300 |
for (uint i = 0; i < _fios_items.Length(); i++) { |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
301 |
IConsolePrintF(CC_DEFAULT, "%d) %s", i, _fios_items[i].title); |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
302 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
303 |
|
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
304 |
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
|
305 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
306 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
307 |
|
1581 | 308 |
/* Change the dir via console */ |
309 |
DEF_CONSOLE_CMD(ConChangeDirectory) |
|
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
310 |
{ |
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
|
311 |
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
|
312 |
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
|
313 |
return true; |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
314 |
} |
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
315 |
|
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 |
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
|
317 |
|
9441
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
318 |
const char *file = argv[1]; |
6f3d3595b42c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
9428
diff
changeset
|
319 |
const FiosItem *item = GetFiosItem(file); |
1581 | 320 |
if (item != NULL) { |
321 |
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
|
322 |
case FIOS_TYPE_DIR: case FIOS_TYPE_DRIVE: case FIOS_TYPE_PARENT: |
1581 | 323 |
FiosBrowseTo(item); |
324 |
break; |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
325 |
default: IConsolePrintF(CC_ERROR, "%s: Not a directory.", file); |
1581 | 326 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
327 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
328 |
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
329 |
} |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
330 |
|
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
331 |
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
|
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 |
|
1581 | 335 |
DEF_CONSOLE_CMD(ConPrintWorkingDirectory) |
336 |
{ |
|
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
|
337 |
const char *path; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
338 |
|
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
343 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
344 |
// 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
|
345 |
FiosGetSavegameList(SLD_LOAD_GAME); |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
346 |
FiosFreeSavegameList(); |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
347 |
|
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
|
348 |
FiosGetDescText(&path, NULL); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
349 |
IConsolePrint(CC_DEFAULT, 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
|
350 |
return true; |
885
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
351 |
} |
074558f61ce2
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
352 |
|
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
353 |
DEF_CONSOLE_CMD(ConClearBuffer) |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
354 |
{ |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
355 |
if (argc == 0) { |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
356 |
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
|
357 |
return true; |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
358 |
} |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
359 |
|
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
360 |
IConsoleClearBuffer(); |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
361 |
InvalidateWindow(WC_CONSOLE, 0); |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
362 |
return true; |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
363 |
} |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
364 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
365 |
|
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
|
366 |
// ********************************* // |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
367 |
// * 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
|
368 |
// ********************************* // |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
369 |
#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
|
370 |
|
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
371 |
DEF_CONSOLE_CMD(ConBan) |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
372 |
{ |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
373 |
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
|
374 |
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
|
375 |
uint32 index; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
376 |
|
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
|
377 |
if (argc == 0) { |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
378 |
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
|
379 |
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
|
380 |
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
|
381 |
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
|
382 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
383 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
384 |
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
|
385 |
|
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
|
386 |
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
|
387 |
index = atoi(argv[1]); |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
388 |
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
|
389 |
} else { // banning IP |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
390 |
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
|
391 |
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
|
392 |
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
|
393 |
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
|
394 |
} 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
|
395 |
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
|
396 |
} |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
397 |
} |
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 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
399 |
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
|
400 |
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
|
401 |
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
|
402 |
} |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
403 |
|
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
|
404 |
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
|
405 |
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
|
406 |
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
|
407 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
408 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
409 |
if (ci != NULL) { |
9608
754cb1e0e833
(svn r13661) -Fix: server crashing when banning the rconning client.
rubidium
parents:
9457
diff
changeset
|
410 |
IConsolePrint(CC_DEFAULT, "Client banned"); |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
411 |
banip = GetPlayerIP(ci); |
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
412 |
NetworkServerSendError(index, NETWORK_ERROR_KICKED); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
413 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
414 |
IConsolePrint(CC_DEFAULT, "Client not online, banned IP"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
415 |
} |
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
|
416 |
|
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
|
417 |
/* 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
|
418 |
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
|
419 |
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
|
420 |
_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
|
421 |
break; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
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 |
} |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
424 |
|
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; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
426 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
427 |
|
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
428 |
DEF_CONSOLE_CMD(ConUnBan) |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
429 |
{ |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
430 |
uint i, index; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
431 |
|
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
|
432 |
if (argc == 0) { |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
433 |
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
|
434 |
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
|
435 |
return true; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
436 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
437 |
|
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
|
438 |
if (argc != 2) return false; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
439 |
|
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
|
440 |
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
|
441 |
index--; |
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
442 |
|
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
|
443 |
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
|
444 |
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
|
445 |
|
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
|
446 |
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
|
447 |
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
|
448 |
_network_ban_list[i] = NULL; |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
449 |
IConsolePrint(CC_DEFAULT, "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
|
450 |
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
|
451 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
452 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
453 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
454 |
IConsolePrint(CC_DEFAULT, "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
|
455 |
return true; |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
456 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
457 |
|
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
458 |
DEF_CONSOLE_CMD(ConBanList) |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
459 |
{ |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
460 |
uint i; |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
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 |
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
|
463 |
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
|
464 |
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
|
465 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
466 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
467 |
IConsolePrint(CC_DEFAULT, "Banlist: "); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
468 |
|
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
469 |
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
|
470 |
if (_network_ban_list[i] != NULL) |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
471 |
IConsolePrintF(CC_DEFAULT, " %d) %s", i + 1, _network_ban_list[i]); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
472 |
} |
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
473 |
|
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 |
|
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
|
477 |
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
|
478 |
{ |
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
|
479 |
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
|
480 |
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
|
481 |
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
|
482 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6123
diff
changeset
|
484 |
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
|
485 |
DoCommandP(0, 1, 0, NULL, CMD_PAUSE); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
486 |
IConsolePrint(CC_DEFAULT, "Game paused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
487 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
488 |
IConsolePrint(CC_DEFAULT, "Game is already paused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
489 |
} |
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
|
490 |
|
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
|
491 |
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
|
492 |
} |
786d631229d8
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
493 |
|
786d631229d8
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
494 |
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
|
495 |
{ |
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
|
496 |
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
|
497 |
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
|
498 |
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
|
499 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6123
diff
changeset
|
501 |
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
|
502 |
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
503 |
IConsolePrint(CC_DEFAULT, "Game unpaused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
504 |
} else { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
505 |
IConsolePrint(CC_DEFAULT, "Game is already unpaused."); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
506 |
} |
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
|
507 |
|
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
|
508 |
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
|
509 |
} |
786d631229d8
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
510 |
|
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
511 |
DEF_CONSOLE_CMD(ConRcon) |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
512 |
{ |
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
|
513 |
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
|
514 |
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
|
515 |
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
|
516 |
return true; |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
517 |
} |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
518 |
|
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
|
519 |
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
|
520 |
|
9271
2f273a3d7d4d
(svn r13137) -Fix: do not send rcon commands of the server to the first client but do directly execute those on the server.
rubidium
parents:
9111
diff
changeset
|
521 |
if (_network_server) { |
2f273a3d7d4d
(svn r13137) -Fix: do not send rcon commands of the server to the first client but do directly execute those on the server.
rubidium
parents:
9111
diff
changeset
|
522 |
IConsoleCmdExec(argv[2]); |
2f273a3d7d4d
(svn r13137) -Fix: do not send rcon commands of the server to the first client but do directly execute those on the server.
rubidium
parents:
9111
diff
changeset
|
523 |
} else { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
524 |
NetworkClientSendRcon(argv[1], argv[2]); |
9271
2f273a3d7d4d
(svn r13137) -Fix: do not send rcon commands of the server to the first client but do directly execute those on the server.
rubidium
parents:
9111
diff
changeset
|
525 |
} |
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
|
526 |
return true; |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
527 |
} |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
528 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
529 |
DEF_CONSOLE_CMD(ConStatus) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
530 |
{ |
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
|
531 |
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
|
532 |
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
|
533 |
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
|
534 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
536 |
NetworkServerShowStatusToConsole(); |
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
|
537 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
538 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
539 |
|
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
|
540 |
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
|
541 |
{ |
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
|
542 |
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
|
543 |
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
|
544 |
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
|
545 |
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
|
546 |
} |
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
|
547 |
|
9451
0d6806ba5504
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
9441
diff
changeset
|
548 |
IConsolePrintF(CC_DEFAULT, "Current/maximum clients: %2d/%2d", _network_game_info.clients_on, _settings_client.network.max_clients); |
0d6806ba5504
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
9441
diff
changeset
|
549 |
IConsolePrintF(CC_DEFAULT, "Current/maximum companies: %2d/%2d", ActivePlayerCount(), _settings_client.network.max_companies); |
0d6806ba5504
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium
parents:
9441
diff
changeset
|
550 |
IConsolePrintF(CC_DEFAULT, "Current/maximum spectators: %2d/%2d", NetworkSpectatorCount(), _settings_client.network.max_spectators); |
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
|
551 |
|
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
|
552 |
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
|
553 |
} |
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
|
554 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
555 |
DEF_CONSOLE_CMD(ConKick) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
556 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
557 |
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
|
558 |
uint32 index; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
559 |
|
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
|
560 |
if (argc == 0) { |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
561 |
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
|
562 |
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
|
563 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
564 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
565 |
|
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
|
566 |
if (argc != 2) return false; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
567 |
|
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
568 |
if (strchr(argv[1], '.') == NULL) { |
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
569 |
index = atoi(argv[1]); |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
570 |
ci = NetworkFindClientInfoFromIndex(index); |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
571 |
} else { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
572 |
ci = NetworkFindClientInfoFromIP(argv[1]); |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
573 |
index = (ci == NULL) ? 0 : ci->client_index; |
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
574 |
} |
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
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 |
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
|
577 |
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
|
578 |
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
|
579 |
} |
2859
ed471404f531
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
580 |
|
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
|
581 |
if (index == 0) { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
582 |
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
|
583 |
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
|
584 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
585 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
586 |
if (ci != NULL) { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
587 |
NetworkServerSendError(index, NETWORK_ERROR_KICKED); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
588 |
} else { |
2860
92f1a57844f9
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
589 |
IConsoleError("Client not found"); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
590 |
} |
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
|
591 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
592 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
593 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
594 |
|
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
595 |
DEF_CONSOLE_CMD(ConResetCompany) |
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
596 |
{ |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
597 |
const Player *p; |
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
598 |
PlayerID index; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
599 |
|
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
|
600 |
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
|
601 |
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
|
602 |
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
|
603 |
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
|
604 |
} |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
605 |
|
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
|
606 |
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
|
607 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
608 |
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
|
609 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
610 |
/* Check valid range */ |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9612
diff
changeset
|
611 |
if (!IsValidPlayerID(index)) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
612 |
IConsolePrintF(CC_ERROR, "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
|
613 |
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
|
614 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
615 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
616 |
/* 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
|
617 |
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
|
618 |
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
|
619 |
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
|
620 |
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
|
621 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
622 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
623 |
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
|
624 |
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
|
625 |
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
|
626 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
627 |
|
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
628 |
if (NetworkCompanyHasPlayers(index)) { |
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
629 |
IConsoleError("Cannot remove company: a client is connected to that company."); |
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
630 |
return 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
|
631 |
} |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
632 |
const NetworkClientInfo *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
|
633 |
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
|
634 |
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
|
635 |
return true; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
636 |
} |
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
637 |
|
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
|
638 |
/* 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
|
639 |
DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
640 |
IConsolePrint(CC_DEFAULT, "Company deleted."); |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
641 |
|
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
|
642 |
return true; |
688
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
643 |
} |
1bf7db6d29b7
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
644 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
645 |
DEF_CONSOLE_CMD(ConNetworkClients) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
646 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
647 |
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
|
648 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
649 |
if (argc == 0) { |
2538
2e9c118c5e93
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
650 |
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
|
651 |
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
|
652 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
653 |
|
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
654 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
655 |
IConsolePrintF(CC_INFO, "Client #%1d name: '%s' company: %1d IP: %s", |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
656 |
ci->client_index, ci->client_name, |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9612
diff
changeset
|
657 |
ci->client_playas + (IsValidPlayerID(ci->client_playas) ? 1 : 0), |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
658 |
GetPlayerIP(ci)); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
659 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
660 |
|
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
|
661 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
662 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
663 |
|
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
|
664 |
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
|
665 |
{ |
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
|
666 |
char *ip; |
1329 | 667 |
const char *port = NULL; |
668 |
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
|
669 |
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
|
670 |
|
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
|
671 |
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
|
672 |
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
|
673 |
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
|
674 |
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
|
675 |
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
|
676 |
} |
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
|
677 |
|
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
|
678 |
if (argc < 2) return false; |
4883
c9c7d15c0b0b
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
679 |
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
|
680 |
|
228
f65dec6727d9
(svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents:
222
diff
changeset
|
681 |
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
|
682 |
/* Default settings: default port and new company */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
683 |
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
|
684 |
_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
|
685 |
|
228
f65dec6727d9
(svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents:
222
diff
changeset
|
686 |
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
|
687 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
688 |
IConsolePrintF(CC_DEFAULT, "Connecting to %s...", ip); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
689 |
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
|
690 |
_network_playas = (PlayerID)atoi(player); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
691 |
IConsolePrintF(CC_DEFAULT, " player-no: %d", _network_playas); |
4861
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
692 |
|
2119f5d46e41
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
693 |
/* 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
|
694 |
* 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
|
695 |
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
|
696 |
_network_playas--; |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9612
diff
changeset
|
697 |
if (!IsValidPlayerID(_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
|
698 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
699 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
700 |
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
|
701 |
rport = atoi(port); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
702 |
IConsolePrintF(CC_DEFAULT, " port: %s", port); |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
703 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
704 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
705 |
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
|
706 |
|
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
|
707 |
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
|
708 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
709 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
710 |
#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
|
711 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
712 |
/* ******************************** */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
713 |
/* script file console commands */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
714 |
/* ******************************** */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
715 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
716 |
DEF_CONSOLE_CMD(ConExec) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
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 |
char cmdline[ICON_CMDLN_SIZE]; |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
719 |
char *cmdptr; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
720 |
|
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
|
721 |
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
|
722 |
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
|
723 |
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
|
724 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (argc < 2) return false; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
727 |
|
8504
f4ea0ba39c03
(svn r12079) -Fix: Use search paths when opening console scripts.
peter1138
parents:
8270
diff
changeset
|
728 |
_script_file = FioFOpenFile(argv[1], "r", BASE_DIR); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
729 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
730 |
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
|
731 |
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
|
732 |
return true; |
1383 | 733 |
} |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
734 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
735 |
_script_running = true; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
736 |
|
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
737 |
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
|
738 |
/* Remove newline characters from the executing script */ |
1819 | 739 |
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
|
740 |
if (*cmdptr == '\n' || *cmdptr == '\r') { |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
741 |
*cmdptr = '\0'; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
742 |
break; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
743 |
} |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
744 |
} |
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
|
745 |
IConsoleCmdExec(cmdline); |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
746 |
} |
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
|
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 |
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
|
749 |
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
|
750 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
751 |
_script_running = false; |
8504
f4ea0ba39c03
(svn r12079) -Fix: Use search paths when opening console scripts.
peter1138
parents:
8270
diff
changeset
|
752 |
FioFCloseFile(_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
|
753 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
754 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
755 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
756 |
DEF_CONSOLE_CMD(ConReturn) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
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("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
|
760 |
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
|
761 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
763 |
_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
|
764 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
765 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
766 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
767 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
768 |
/* 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
|
769 |
/* **************************** */ |
6247 | 770 |
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
|
771 |
|
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
|
772 |
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
|
773 |
{ |
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
|
774 |
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
|
775 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
776 |
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
|
777 |
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
|
778 |
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
|
779 |
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
|
780 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
781 |
|
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
|
782 |
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
|
783 |
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
|
784 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
785 |
IConsolePrintF(CC_DEFAULT, "file output started to: %s", argv[1]); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
786 |
_iconsole_output_file = fopen(argv[1], "ab"); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
787 |
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
|
788 |
} |
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
|
789 |
|
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
|
790 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
791 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
792 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
793 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
794 |
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
|
795 |
{ |
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
|
796 |
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
|
797 |
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
|
798 |
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
|
799 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
800 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
801 |
if (argc < 2) return false; |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
802 |
IConsolePrint(CC_DEFAULT, 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
|
803 |
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
|
804 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
805 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
806 |
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
|
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("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
|
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 < 3) return false; |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
814 |
IConsolePrint((ConsoleColour)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
|
815 |
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
|
816 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
817 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
818 |
DEF_CONSOLE_CMD(ConNewGame) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
819 |
{ |
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
|
820 |
if (argc == 0) { |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
821 |
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
|
822 |
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
|
823 |
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
|
824 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
825 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
826 |
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
|
827 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
828 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
829 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
830 |
extern void SwitchMode(int new_mode); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
831 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
832 |
DEF_CONSOLE_CMD(ConRestart) |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
833 |
{ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
834 |
if (argc == 0) { |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
835 |
IConsoleHelp("Restart game. Usage: 'restart'"); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
836 |
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
|
837 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
838 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
839 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
840 |
/* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */ |
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
841 |
_settings_game.game_creation.map_x = MapLogX(); |
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
842 |
_settings_game.game_creation.map_y = FindFirstBit(MapSizeY()); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
843 |
SwitchMode(SM_NEWGAME); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
844 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
845 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
846 |
|
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
847 |
DEF_CONSOLE_CMD(ConGetSeed) |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
848 |
{ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
849 |
if (argc == 0) { |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
850 |
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
|
851 |
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
|
852 |
return true; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
853 |
} |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
854 |
|
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
855 |
IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings_game.game_creation.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
|
856 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
857 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
858 |
|
6890
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
859 |
DEF_CONSOLE_CMD(ConGetDate) |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
860 |
{ |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
861 |
if (argc == 0) { |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
862 |
IConsoleHelp("Returns the current date (day-month-year) of the game. Usage: 'getdate'"); |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
863 |
return true; |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
864 |
} |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
865 |
|
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
866 |
YearMonthDay ymd; |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
867 |
ConvertDateToYMD(_date, &ymd); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
868 |
IConsolePrintF(CC_DEFAULT, "Date: %d-%d-%d", ymd.day, ymd.month + 1, ymd.year); |
6890
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
869 |
return true; |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
870 |
} |
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
871 |
|
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
872 |
|
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
873 |
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
|
874 |
{ |
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
|
875 |
IConsoleAlias *alias; |
644
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
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 |
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
|
878 |
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
|
879 |
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
|
880 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
881 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
882 |
if (argc < 3) return false; |
644
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
883 |
|
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
884 |
alias = IConsoleAliasGet(argv[1]); |
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
885 |
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
|
886 |
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
|
887 |
} else { |
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
888 |
free(alias->cmdline); |
cd687cdec701
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
889 |
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
|
890 |
} |
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
|
891 |
return true; |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
892 |
} |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
893 |
|
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
|
894 |
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
|
895 |
{ |
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
|
896 |
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
|
897 |
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
|
898 |
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
|
899 |
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
|
900 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
901 |
|
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
|
902 |
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
|
903 |
|
4184
541f819f2125
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
904 |
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
|
905 |
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
|
906 |
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
|
907 |
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
|
908 |
|
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
|
909 |
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
|
910 |
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
|
911 |
} |
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
|
912 |
|
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
|
913 |
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
|
914 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
915 |
|
229
b94bfdf02bae
(svn r230) -Feature: IConsoleWarning for warning messages
signde
parents:
228
diff
changeset
|
916 |
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
|
917 |
{ |
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
|
918 |
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
|
919 |
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
|
920 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
921 |
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
|
922 |
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
|
923 |
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
|
924 |
} |
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
|
925 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
926 |
if (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
|
927 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
928 |
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
|
929 |
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
|
930 |
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
|
931 |
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
|
932 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
933 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
934 |
IConsolePrintF(CC_DEFAULT, "variable name: %s", var->name); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
935 |
IConsolePrintF(CC_DEFAULT, "variable type: %s", _icon_vartypes[var->type]); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
936 |
IConsolePrintF(CC_DEFAULT, "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
|
937 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
938 |
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
|
939 |
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
|
940 |
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
|
941 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
942 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
943 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
944 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
945 |
DEF_CONSOLE_CMD(ConInfoCmd) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
946 |
{ |
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
|
947 |
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
|
948 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
949 |
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
|
950 |
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
|
951 |
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
|
952 |
} |
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
|
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 |
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
|
955 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
956 |
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
|
957 |
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
|
958 |
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
|
959 |
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
|
960 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
961 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
962 |
IConsolePrintF(CC_DEFAULT, "command name: %s", cmd->name); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
963 |
IConsolePrintF(CC_DEFAULT, "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
|
964 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
965 |
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
|
966 |
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
|
967 |
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
|
968 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
970 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
971 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
972 |
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
|
973 |
{ |
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
|
974 |
if (argc == 0) { |
1847
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
975 |
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
|
976 |
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
|
977 |
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
|
978 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
979 |
|
1847
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
980 |
if (argc > 2) return false; |
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
981 |
|
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
982 |
if (argc == 1) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
983 |
IConsolePrintF(CC_DEFAULT, "Current debug-level: '%s'", GetDebugString()); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
984 |
} else { |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
985 |
SetDebugString(argv[1]); |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
986 |
} |
1847
d94ed71b61e7
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
987 |
|
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
|
988 |
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
|
989 |
} |
b88456001397
(svn r223) -Fix: 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 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
991 |
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
|
992 |
{ |
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
|
993 |
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
|
994 |
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
|
995 |
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
|
996 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
997 |
|
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
998 |
if (_game_mode == GM_NORMAL && _settings_client.gui.autosave_on_exit) DoExitSave(); |
7306
dfd61358ad88
(svn r10658) -Add: support for autosave_on_exit in the console, so dedicated servers can use it
glx
parents:
7047
diff
changeset
|
999 |
|
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
|
1000 |
_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
|
1001 |
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
|
1002 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1003 |
|
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
|
1004 |
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
|
1005 |
{ |
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
|
1006 |
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
|
1007 |
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
|
1008 |
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
|
1009 |
} |
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
|
1010 |
|
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
|
1011 |
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
|
1012 |
|
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
|
1013 |
_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
|
1014 |
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
|
1015 |
} |
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
|
1016 |
|
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
|
1017 |
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
|
1018 |
{ |
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
|
1019 |
if (argc == 2) { |
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1020 |
const IConsoleCmd *cmd; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1021 |
const IConsoleVar *var; |
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1022 |
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
|
1023 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
cmd = IConsoleCmdGet(argv[1]); |
2026 | 1025 |
if (cmd != NULL) { |
1026 |
cmd->proc(0, NULL); |
|
1027 |
return true; |
|
1028 |
} |
|
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
|
1029 |
|
2026 | 1030 |
alias = IConsoleAliasGet(argv[1]); |
1031 |
if (alias != NULL) { |
|
1032 |
cmd = IConsoleCmdGet(alias->cmdline); |
|
1033 |
if (cmd != NULL) { |
|
1034 |
cmd->proc(0, NULL); |
|
1035 |
return true; |
|
1036 |
} |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1037 |
IConsolePrintF(CC_ERROR, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline); |
2026 | 1038 |
return true; |
1039 |
} |
|
1743
882e7173493c
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1040 |
|
2026 | 1041 |
var = IConsoleVarGet(argv[1]); |
1042 |
if (var != NULL && var->help != NULL) { |
|
1043 |
IConsoleHelp(var->help); |
|
1044 |
return true; |
|
1045 |
} |
|
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
|
1046 |
|
2026 | 1047 |
IConsoleError("command or variable not found"); |
1048 |
return true; |
|
1049 |
} |
|
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
|
1050 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1051 |
IConsolePrint(CC_WARNING, " ---- OpenTTD Console Help ---- "); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1052 |
IConsolePrint(CC_DEFAULT, " - variables: [command to list all variables: list_vars]"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1053 |
IConsolePrint(CC_DEFAULT, " set value with '<var> = <value>', use '++/--' to in-or decrement"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1054 |
IConsolePrint(CC_DEFAULT, " or omit '=' and just '<var> <value>'. get value with typing '<var>'"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1055 |
IConsolePrint(CC_DEFAULT, " - commands: [command to list all commands: list_cmds]"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1056 |
IConsolePrint(CC_DEFAULT, " call commands with '<command> <arg2> <arg3>...'"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1057 |
IConsolePrint(CC_DEFAULT, " - to assign strings, or use them as arguments, enclose it within quotes"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1058 |
IConsolePrint(CC_DEFAULT, " like this: '<command> \"string argument with spaces\"'"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1059 |
IConsolePrint(CC_DEFAULT, " - use 'help <command> | <variable>' to get specific information"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1060 |
IConsolePrint(CC_DEFAULT, " - scroll console output with shift + (up | down) | (pageup | pagedown))"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1061 |
IConsolePrint(CC_DEFAULT, " - scroll console input history with the up | down arrows"); |
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1062 |
IConsolePrint(CC_DEFAULT, ""); |
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
|
1063 |
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
|
1064 |
} |
b88456001397
(svn r223) -Fix: 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 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1066 |
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
|
1067 |
{ |
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
|
1068 |
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
|
1069 |
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
|
1070 |
|
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
|
1071 |
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
|
1072 |
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
|
1073 |
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
|
1074 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1075 |
|
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
|
1076 |
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
|
1077 |
|
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
|
1078 |
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
|
1079 |
if (argv[1] == NULL || strncmp(cmd->name, argv[1], l) == 0) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1080 |
IConsolePrintF(CC_DEFAULT, "%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
|
1081 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1082 |
} |
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
|
1083 |
|
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
|
1084 |
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
|
1085 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1086 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1087 |
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
|
1088 |
{ |
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
|
1089 |
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
|
1090 |
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
|
1091 |
|
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
|
1092 |
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
|
1093 |
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
|
1094 |
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
|
1095 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1096 |
|
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
|
1097 |
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
|
1098 |
|
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
|
1099 |
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
|
1100 |
if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0) |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1101 |
IConsolePrintF(CC_DEFAULT, "%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
|
1102 |
} |
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
|
1103 |
|
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
|
1104 |
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
|
1105 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1106 |
|
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1107 |
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
|
1108 |
{ |
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
|
1109 |
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
|
1110 |
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
|
1111 |
|
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
|
1112 |
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
|
1113 |
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
|
1114 |
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
|
1115 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1116 |
|
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1117 |
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
|
1118 |
|
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
|
1119 |
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
|
1120 |
if (argv[1] == NULL || strncmp(alias->name, argv[1], l) == 0) |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1121 |
IConsolePrintF(CC_DEFAULT, "%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
|
1122 |
} |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1123 |
|
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 |
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
|
1125 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1126 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1127 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1128 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1129 |
DEF_CONSOLE_CMD(ConSay) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1130 |
{ |
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
|
1131 |
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
|
1132 |
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
|
1133 |
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
|
1134 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1135 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1136 |
if (argc != 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
|
1137 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1138 |
if (!_network_server) { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
1139 |
NetworkClientSendChat(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
|
1140 |
} else { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
1141 |
NetworkServerSendChat(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
|
1142 |
} |
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
|
1143 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1145 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1146 |
|
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
|
1147 |
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
|
1148 |
{ |
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
|
1149 |
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
|
1150 |
|
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
|
1151 |
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
|
1152 |
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
|
1153 |
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
|
1154 |
} |
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
|
1155 |
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
|
1156 |
|
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
|
1157 |
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
|
1158 |
char buffer[512]; |
2605e667c3bb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1159 |
|
2605e667c3bb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1160 |
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
|
1161 |
|
6566
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1162 |
const NetworkPlayerInfo *npi = &_network_player_info[p->index]; |
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1163 |
|
4912
0f51b47cb983
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4906
diff
changeset
|
1164 |
GetString(buffer, STR_00D1_DARK_BLUE + _player_colors[p->index], lastof(buffer)); |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1165 |
IConsolePrintF(CC_INFO, "#:%d(%s) Company Name: '%s' Year Founded: %d Money: %" OTTD_PRINTF64 "d Loan: %" OTTD_PRINTF64 "d Value: %" OTTD_PRINTF64 "d (T:%d, R:%d, P:%d, S:%d) %sprotected", |
7763
342e5357b592
(svn r11312) -Codechange: implement a overflow safe integer and use that for money and don't misuses CommandCost to have a overflow safe integer. Based on a patch by Noldo.
rubidium
parents:
7725
diff
changeset
|
1166 |
p->index + 1, buffer, npi->company_name, p->inaugurated_year, (int64)p->player_money, (int64)p->current_loan, (int64)CalculateCompanyValue(p), |
6566
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1167 |
/* trains */ npi->num_vehicle[0], |
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1168 |
/* lorry + bus */ npi->num_vehicle[1] + npi->num_vehicle[2], |
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1169 |
/* planes */ npi->num_vehicle[3], |
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1170 |
/* ships */ npi->num_vehicle[4], |
91db7c3ad8d3
(svn r9771) -Feature: (-tte) Add password protected status to 'players' (network server) console command. (mostly dihedral)
peter1138
parents:
6453
diff
changeset
|
1171 |
/* protected */ StrEmpty(npi->password) ? "un" : ""); |
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
|
1172 |
} |
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
|
1173 |
|
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
|
1174 |
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
|
1175 |
} |
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
|
1176 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1177 |
DEF_CONSOLE_CMD(ConSayPlayer) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1178 |
{ |
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
|
1179 |
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
|
1180 |
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
|
1181 |
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
|
1182 |
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
|
1183 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1184 |
|
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
|
1185 |
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
|
1186 |
|
9612
316df1347f4e
(svn r13665) -Fix[FS#2119]: Wrong PlayerID used for sending a message to.Patch by Yexo
belugas
parents:
9608
diff
changeset
|
1187 |
PlayerID player_id = (PlayerID)(atoi(argv[1]) - 1); |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9612
diff
changeset
|
1188 |
if (!IsValidPlayerID(player_id) || !GetPlayer(player_id)->is_active) { |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1189 |
IConsolePrintF(CC_DEFAULT, "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
|
1190 |
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
|
1191 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1192 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (!_network_server) { |
9612
316df1347f4e
(svn r13665) -Fix[FS#2119]: Wrong PlayerID used for sending a message to.Patch by Yexo
belugas
parents:
9608
diff
changeset
|
1194 |
NetworkClientSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, player_id, argv[2]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1195 |
} else { |
9612
316df1347f4e
(svn r13665) -Fix[FS#2119]: Wrong PlayerID used for sending a message to.Patch by Yexo
belugas
parents:
9608
diff
changeset
|
1196 |
NetworkServerSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, player_id, argv[2], NETWORK_SERVER_INDEX); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1197 |
} |
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
|
1198 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1199 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1200 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1201 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1202 |
DEF_CONSOLE_CMD(ConSayClient) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1203 |
{ |
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
|
1204 |
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
|
1205 |
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_client <client-no> \"<msg>\"'"); |
2026 | 1206 |
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
|
1207 |
return true; |
627
5495f77a0e7c
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents:
625
diff
changeset
|
1208 |
} |
5495f77a0e7c
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents:
625
diff
changeset
|
1209 |
|
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
|
1210 |
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
|
1211 |
|
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 |
if (!_network_server) { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
1213 |
NetworkClientSendChat(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
|
1214 |
} else { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
1215 |
NetworkServerSendChat(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
|
1216 |
} |
678
f62cae2abc0c
(svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents:
666
diff
changeset
|
1217 |
|
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
|
1218 |
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
|
1219 |
} |
1602
79f98b4b83fc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1596
diff
changeset
|
1220 |
|
7999
bb3a1508fd71
(svn r11557) -Codechange: send and store the passwords a little more secure to/in the servers.
rubidium
parents:
7954
diff
changeset
|
1221 |
extern void HashCurrentCompanyPassword(); |
bb3a1508fd71
(svn r11557) -Codechange: send and store the passwords a little more secure to/in the servers.
rubidium
parents:
7954
diff
changeset
|
1222 |
|
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
|
1223 |
/* 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
|
1224 |
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
|
1225 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1226 |
if (argc == 0) { |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9612
diff
changeset
|
1227 |
if (!IsValidPlayerID(_local_player)) return true; // dedicated server |
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1228 |
IConsolePrintF(CC_WARNING, "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
|
1229 |
return true; |
690
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1230 |
} |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1231 |
|
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9612
diff
changeset
|
1232 |
if (!IsValidPlayerID(_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
|
1233 |
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
|
1234 |
return false; |
690
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1235 |
} |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1236 |
|
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
|
1237 |
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
|
1238 |
|
4026
035972c11282
(svn r5265) Replace a dozen bogus uses of strncmp() by strcmp()
tron
parents:
4025
diff
changeset
|
1239 |
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
|
1240 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1241 |
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
|
1242 |
|
7999
bb3a1508fd71
(svn r11557) -Codechange: send and store the passwords a little more secure to/in the servers.
rubidium
parents:
7954
diff
changeset
|
1243 |
if (!_network_server) { |
9428
1ba05b499957
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
9426
diff
changeset
|
1244 |
NetworkClientSetPassword(); |
7999
bb3a1508fd71
(svn r11557) -Codechange: send and store the passwords a little more secure to/in the servers.
rubidium
parents:
7954
diff
changeset
|
1245 |
} else { |
bb3a1508fd71
(svn r11557) -Codechange: send and store the passwords a little more secure to/in the servers.
rubidium
parents:
7954
diff
changeset
|
1246 |
HashCurrentCompanyPassword(); |
bb3a1508fd71
(svn r11557) -Codechange: send and store the passwords a little more secure to/in the servers.
rubidium
parents:
7954
diff
changeset
|
1247 |
} |
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
|
1248 |
|
9337
ab6e0234bacc
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
9336
diff
changeset
|
1249 |
IConsolePrintF(CC_WARNING, "'company_pw' changed to: %s", _network_player_info[_local_player].password); |
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
|
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 |
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
|
1252 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4614
3b28b8e7d4b6
(svn r6471) -Fix (r6450): ConPatch was moved from network-only, but the function was
Darkvater
parents:
4600
diff
changeset
|
1254 |
#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
|
1255 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1256 |
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
|
1257 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
1259 |
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
|
1260 |
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
|
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 (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
|
1265 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1266 |
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
|
1267 |
IConsoleGetPatchSetting(argv[1]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1268 |
} else { |
9426
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1269 |
IConsoleSetPatchSetting(argv[1], argv[2]); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1270 |
} |
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
|
1271 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1272 |
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
|
1273 |
} |
623
3c50358d5a1b
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
1274 |
|
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
|
1275 |
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
|
1276 |
{ |
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
|
1277 |
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
|
1278 |
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
|
1279 |
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
|
1280 |
} |
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
|
1281 |
|
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
|
1282 |
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
|
1283 |
|
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
|
1284 |
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
|
1285 |
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
|
1286 |
} |
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
|
1287 |
|
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
|
1288 |
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
|
1289 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
1291 |
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
|
1292 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
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
|
1294 |
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
|
1295 |
return true; |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1296 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1297 |
|
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
|
1298 |
if (argv[1] != NULL) l = strlen(argv[1]); |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1299 |
|
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
|
1300 |
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
|
1301 |
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
|
1302 |
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
|
1303 |
} |
623
3c50358d5a1b
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
1304 |
|
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
|
1305 |
return true; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1306 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1307 |
|
9457
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
1308 |
DEF_CONSOLE_CMD(ConGamelogPrint) |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
1309 |
{ |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
1310 |
GamelogPrintConsole(); |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
1311 |
return true; |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
1312 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1313 |
|
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
|
1314 |
#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
|
1315 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1316 |
/* 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
|
1317 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1318 |
|
6247 | 1319 |
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
|
1320 |
{ |
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1321 |
/* debugging variables and functions */ |
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1322 |
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
|
1323 |
|
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
|
1324 |
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
|
1325 |
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
|
1326 |
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
|
1327 |
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
|
1328 |
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
|
1329 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1330 |
#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
|
1331 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1332 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1333 |
/* 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
|
1334 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1335 |
|
6247 | 1336 |
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
|
1337 |
{ |
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1338 |
/* stdlib */ |
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1339 |
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
|
1340 |
|
6123
04eb770ec17e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5624
diff
changeset
|
1341 |
/* 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
|
1342 |
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
|
1343 |
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
|
1344 |
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
|
1345 |
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
|
1346 |
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
|
1347 |
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
|
1348 |
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
|
1349 |
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
|
1350 |
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
|
1351 |
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
|
1352 |
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
|
1353 |
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
|
1354 |
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
|
1355 |
IConsoleCmdRegister("newgame", ConNewGame); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
1356 |
IConsoleCmdRegister("restart", ConRestart); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
1357 |
IConsoleCmdRegister("getseed", ConGetSeed); |
6890
bebf22f6c449
(svn r10137) -Add: console command to get the current game date.
rubidium
parents:
6573
diff
changeset
|
1358 |
IConsoleCmdRegister("getdate", ConGetDate); |
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
|
1359 |
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
|
1360 |
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
|
1361 |
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
|
1362 |
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
|
1363 |
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
|
1364 |
IConsoleCmdRegister("scrollto", ConScrollToTile); |
2026 | 1365 |
IConsoleCmdRegister("alias", ConAlias); |
1366 |
IConsoleCmdRegister("load", ConLoad); |
|
2415
3093e6277340
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
1367 |
IConsoleCmdRegister("rm", ConRemove); |
2026 | 1368 |
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
|
1369 |
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
|
1370 |
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
|
1371 |
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
|
1372 |
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory); |
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
1373 |
IConsoleCmdRegister("clear", ConClearBuffer); |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1374 |
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
|
1375 |
IConsoleCmdRegister("list_patches", ConListPatches); |
9457
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9451
diff
changeset
|
1376 |
IConsoleCmdRegister("gamelog", ConGamelogPrint); |
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
|
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 |
IConsoleAliasRegister("dir", "ls"); |
2419
076f0b1403dd
(svn r2945) Add 'del' alias to rm console command
Darkvater
parents:
2415
diff
changeset
|
1379 |
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
|
1380 |
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
|
1381 |
IConsoleAliasRegister("new_map", "newgame"); |
932
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1382 |
IConsoleAliasRegister("new_game", "newgame"); |
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1383 |
|
a274119d6ec7
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1384 |
|
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
|
1385 |
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 | 1386 |
|
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
|
1387 |
/* 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
|
1388 |
#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
|
1389 |
/* 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
|
1390 |
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
|
1391 |
|
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
|
1392 |
/*** 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
|
1393 |
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
|
1394 |
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
|
1395 |
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
|
1396 |
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
|
1397 |
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
|
1398 |
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
|
1399 |
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
|
1400 |
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
|
1401 |
|
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
|
1402 |
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
|
1403 |
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
|
1404 |
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
|
1405 |
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
|
1406 |
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
|
1407 |
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
|
1408 |
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
|
1409 |
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
|
1410 |
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
|
1411 |
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
|
1412 |
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
|
1413 |
IConsoleCmdHookAdd("rcon", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
1414 |
|
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
|
1415 |
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
|
1416 |
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
|
1417 |
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
|
1418 |
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
|
1419 |
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
|
1420 |
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
|
1421 |
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
|
1422 |
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
|
1423 |
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
|
1424 |
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
|
1425 |
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
|
1426 |
|
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
|
1427 |
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
|
1428 |
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
|
1429 |
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
|
1430 |
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
|
1431 |
|
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
|
1432 |
/*** 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
|
1433 |
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
|
1434 |
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
|
1435 |
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
|
1436 |
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
|
1437 |
|
9426
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1438 |
IConsoleAliasRegister("net_frame_freq", "patch frame_freq %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1439 |
IConsoleAliasRegister("net_sync_freq", "patch sync_freq %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1440 |
IConsoleAliasRegister("server_pw", "patch server_password %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1441 |
IConsoleAliasRegister("server_password", "patch server_password %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1442 |
IConsoleAliasRegister("rcon_pw", "patch rcon_password %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1443 |
IConsoleAliasRegister("rcon_password", "patch rcon_password %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1444 |
IConsoleAliasRegister("name", "patch player_name %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1445 |
IConsoleAliasRegister("server_name", "patch server_name %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1446 |
IConsoleAliasRegister("server_port", "patch server_port %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1447 |
IConsoleAliasRegister("server_ip", "patch server_bind_ip %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1448 |
IConsoleAliasRegister("server_bind_ip", "patch server_bind_ip %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1449 |
IConsoleAliasRegister("server_ip_bind", "patch server_bind_ip %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1450 |
IConsoleAliasRegister("server_bind", "patch server_bind_ip %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1451 |
IConsoleAliasRegister("server_advertise", "patch server_advertise %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1452 |
IConsoleAliasRegister("max_clients", "patch max_clients %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1453 |
IConsoleAliasRegister("max_companies", "patch max_companies %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1454 |
IConsoleAliasRegister("max_spectators", "patch max_spectators %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1455 |
IConsoleAliasRegister("max_join_time", "patch max_join_time %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1456 |
IConsoleAliasRegister("pause_on_join", "patch pause_on_join %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1457 |
IConsoleAliasRegister("autoclean_companies", "patch autoclean_companies %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1458 |
IConsoleAliasRegister("autoclean_protected", "patch autoclean_protected %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1459 |
IConsoleAliasRegister("autoclean_unprotected", "patch autoclean_unprotected %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1460 |
IConsoleAliasRegister("restart_game_year", "patch restart_game_year %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1461 |
IConsoleAliasRegister("min_players", "patch min_players %+"); |
a77c8a4abcf5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
9420
diff
changeset
|
1462 |
IConsoleAliasRegister("reload_cfg", "patch reload_cfg %+"); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1463 |
#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
|
1464 |
|
554 | 1465 |
// debugging stuff |
1466 |
#ifdef _DEBUG |
|
1467 |
IConsoleDebugLibRegister(); |
|
1468 |
#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
|
1469 |
} |