author | truebrain |
Fri, 13 Jun 2008 19:12:55 +0000 | |
branch | noai |
changeset 10956 | 82aa600a9922 |
parent 10891 | 5ebb6f9068d0 |
child 11026 | 5882d3402d7d |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
9837
diff
changeset
|
3 |
/** @file console_cmds.cpp Implementation of the console hooks. */ |
6449
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5875
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
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1869
diff
changeset
|
6 |
#include "openttd.h" |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
7 |
#include "console_internal.h" |
1299
0a6510cc889b
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1147
diff
changeset
|
8 |
#include "debug.h" |
9837
c9ec4f82e0d0
(svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
9763
diff
changeset
|
9 |
#include "engine_func.h" |
9599 | 10 |
#include "landscape.h" |
2162
c1ded3bd3d0c
(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" |
10829 | 13 |
#include "network/network.h" |
14 |
#include "network/network_func.h" |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
15 |
#include "command_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
16 |
#include "settings_func.h" |
4223
0f9535dda7ed
(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" |
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
18 |
#include "fileio.h" |
4184
f38abcb8b18d
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
19 |
#include "screenshot.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
20 |
#include "genworld.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
21 |
#include "strings_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
22 |
#include "viewport_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
23 |
#include "window_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
24 |
#include "functions.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
25 |
#include "map_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
26 |
#include "date_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
27 |
#include "vehicle_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
28 |
#include "string_func.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
29 |
#include "player_func.h" |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
30 |
#include "player_base.h" |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
31 |
#include "settings_type.h" |
10829 | 32 |
#include "gamelog.h" |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
33 |
#include "ai/ai.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
34 |
|
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
35 |
#ifdef ENABLE_NETWORK |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
36 |
#include "table/strings.h" |
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
37 |
#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
|
38 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
39 |
// ** scriptfile handling ** // |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
40 |
static FILE *_script_file; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
41 |
static bool _script_running; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
42 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
43 |
// ** console command / variable defines ** // |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
44 |
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[]) |
6573 | 45 |
#define DEF_CONSOLE_HOOK(function) static bool function() |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
46 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
47 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
48 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
49 |
/* 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
|
50 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
51 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
52 |
#ifdef ENABLE_NETWORK |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
53 |
|
6573 | 54 |
static inline bool NetworkAvailable() |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
55 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
56 |
if (!_network_available) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
57 |
IConsoleError("You cannot use this command because there is no network available."); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
58 |
return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
59 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
60 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
61 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
DEF_CONSOLE_HOOK(ConHookServerOnly) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
64 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (!NetworkAvailable()) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
66 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
67 |
if (!_network_server) { |
1788
c49040d856dd
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
68 |
IConsoleError("This command/variable is only available to a network server."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
69 |
return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
70 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
71 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
72 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
DEF_CONSOLE_HOOK(ConHookClientOnly) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
75 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (!NetworkAvailable()) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
77 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
78 |
if (_network_server) { |
1788
c49040d856dd
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
79 |
IConsoleError("This command/variable is not available to a network server."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
80 |
return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
81 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
82 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
83 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
DEF_CONSOLE_HOOK(ConHookNeedNetwork) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
86 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (!NetworkAvailable()) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
88 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
89 |
if (!_networking) { |
1788
c49040d856dd
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
90 |
IConsoleError("Not connected. This command/variable is only available in multiplayer."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
91 |
return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
92 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
94 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
96 |
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
|
97 |
{ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
98 |
if (_networking) { |
1788
c49040d856dd
(svn r2292) - Fix (regression): make error message more general for console errors. Dedicated servers are properly filtered out when requesting player-password.
Darkvater
parents:
1762
diff
changeset
|
99 |
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
|
100 |
return false; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
101 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
102 |
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
|
103 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
104 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
105 |
#endif /* ENABLE_NETWORK */ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
106 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
107 |
static void IConsoleHelp(const char *str) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
108 |
{ |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
109 |
IConsolePrintF(CC_WARNING, "- %s", str); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
110 |
} |
222
b88456001397
(svn r223) -Fix: 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 |
|
b88456001397
(svn r223) -Fix: 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 |
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
|
113 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
114 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
115 |
IConsoleHelp("Reset status data of all engines. This might solve some issues with 'lost' engines. Usage: 'resetengines'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
116 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
117 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
118 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
119 |
StartupEngines(); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
120 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
121 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
122 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
123 |
#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
|
124 |
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
|
125 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
126 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
127 |
IConsoleHelp("Reset a tile to bare land. Usage: 'resettile <tile>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
128 |
IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
129 |
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
|
130 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
131 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
132 |
if (argc == 2) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
133 |
uint32 result; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
134 |
if (GetArgumentInteger(&result, argv[1])) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
135 |
DoClearSquare((TileIndex)result); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
136 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
137 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
140 |
return 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
|
141 |
} |
3647
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
142 |
|
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
143 |
DEF_CONSOLE_CMD(ConStopAllVehicles) |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
144 |
{ |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
145 |
if (argc == 0) { |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
146 |
IConsoleHelp("Stops all vehicles in the game. For debugging only! Use at your own risk... Usage: 'stopall'"); |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
147 |
return true; |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
148 |
} |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
149 |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
150 |
StopAllVehicles(); |
3647
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
151 |
return true; |
0a73001c9aa5
(svn r4558) - Fix: 'stopall' was moved to debug, so move the function there as well.
Darkvater
parents:
3621
diff
changeset
|
152 |
} |
1740
29e13b639a78
(svn r2244) - Fix: 'scrollto' is not debug only..sorry :)
Darkvater
parents:
1739
diff
changeset
|
153 |
#endif /* _DEBUG */ |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
154 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
155 |
DEF_CONSOLE_CMD(ConScrollToTile) |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
156 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
157 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
158 |
IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto <tile>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
159 |
IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
160 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
161 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
162 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
163 |
if (argc == 2) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
164 |
uint32 result; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
165 |
if (GetArgumentInteger(&result, argv[1])) { |
4585
16d114f6e35d
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
166 |
if (result >= MapSize()) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
167 |
IConsolePrint(CC_ERROR, "Tile does not exist"); |
4585
16d114f6e35d
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
168 |
return true; |
16d114f6e35d
(svn r6435) -Fix (FS#340): show an error message when executing 'scrollto x' with x < 0 or >= MapSize() instead of asserting later on.
rubidium
parents:
4346
diff
changeset
|
169 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
170 |
ScrollMainWindowToTile((TileIndex)result); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
171 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
175 |
return false; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
176 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
177 |
|
6573 | 178 |
extern void BuildFileList(); |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
179 |
extern void SetFiosType(const byte fiostype); |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
180 |
|
1565
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
181 |
/* Save the map to a file */ |
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
182 |
DEF_CONSOLE_CMD(ConSave) |
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
183 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
184 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
185 |
IConsoleHelp("Save the current game. Usage: 'save <filename>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
186 |
return true; |
1565
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
187 |
} |
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
188 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
189 |
if (argc == 2) { |
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
190 |
char *filename = str_fmt("%s.sav", argv[1]); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
191 |
IConsolePrint(CC_DEFAULT, "Saving map..."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
192 |
|
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
193 |
if (SaveOrLoad(filename, SL_SAVE, SAVE_DIR) != SL_OK) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
194 |
IConsolePrint(CC_ERROR, "Saving map failed"); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
195 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
196 |
IConsolePrintF(CC_DEFAULT, "Map sucessfully saved to %s", filename); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
197 |
} |
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
198 |
free(filename); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
199 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
200 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
201 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
202 |
return false; |
1565
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
203 |
} |
925f94da4077
(svn r2069) - Feature: [ 1168743 ] save command for console (pkirchhofer)
Darkvater
parents:
1395
diff
changeset
|
204 |
|
5758
c508f77aedd7
(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:
5726
diff
changeset
|
205 |
/* Explicitly save the configuration */ |
c508f77aedd7
(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:
5726
diff
changeset
|
206 |
DEF_CONSOLE_CMD(ConSaveConfig) |
c508f77aedd7
(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:
5726
diff
changeset
|
207 |
{ |
c508f77aedd7
(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:
5726
diff
changeset
|
208 |
if (argc == 0) { |
c508f77aedd7
(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:
5726
diff
changeset
|
209 |
IConsoleHelp("Saves the current config, typically to 'openttd.cfg'."); |
c508f77aedd7
(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:
5726
diff
changeset
|
210 |
return true; |
c508f77aedd7
(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:
5726
diff
changeset
|
211 |
} |
c508f77aedd7
(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:
5726
diff
changeset
|
212 |
|
c508f77aedd7
(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:
5726
diff
changeset
|
213 |
SaveToConfig(); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
214 |
IConsolePrint(CC_DEFAULT, "Saved config."); |
5758
c508f77aedd7
(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:
5726
diff
changeset
|
215 |
return true; |
c508f77aedd7
(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:
5726
diff
changeset
|
216 |
} |
c508f77aedd7
(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:
5726
diff
changeset
|
217 |
|
1581 | 218 |
static const FiosItem* GetFiosItem(const char* file) |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
219 |
{ |
1798
406c46c6354f
(svn r2302) - Fix: when you started a server 'load <file>' did not work prior to doing 'ls'. Fixed by moving the changing of saveload_mode into BuildFileList()
Darkvater
parents:
1794
diff
changeset
|
220 |
_saveload_mode = SLD_LOAD_GAME; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
221 |
BuildFileList(); |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
222 |
|
10829 | 223 |
for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) { |
224 |
if (strcmp(file, item->name) == 0) return item; |
|
225 |
if (strcmp(file, item->title) == 0) return item; |
|
1581 | 226 |
} |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
227 |
|
10829 | 228 |
/* If no name matches, try to parse it as number */ |
229 |
char *endptr; |
|
230 |
int i = strtol(file, &endptr, 10); |
|
231 |
if (file == endptr || *endptr != '\0') i = -1; |
|
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
232 |
|
10829 | 233 |
return IsInsideMM(i, 0, _fios_items.Length()) ? _fios_items.Get(i) : NULL; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
234 |
} |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
235 |
|
1581 | 236 |
|
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
237 |
DEF_CONSOLE_CMD(ConLoad) |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
238 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
239 |
if (argc == 0) { |
2540
dbaba9ff9b94
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
240 |
IConsoleHelp("Load a game by name or index. Usage: 'load <file | number>'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
241 |
return true; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
242 |
} |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
243 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
244 |
if (argc != 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
245 |
|
10829 | 246 |
const char *file = argv[1]; |
247 |
const FiosItem *item = GetFiosItem(file); |
|
1581 | 248 |
if (item != NULL) { |
249 |
switch (item->type) { |
|
2099
22f535ad9eea
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
250 |
case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: { |
1581 | 251 |
_switch_mode = SM_LOAD; |
252 |
SetFiosType(item->type); |
|
2099
22f535ad9eea
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
253 |
|
22f535ad9eea
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
254 |
ttd_strlcpy(_file_to_saveload.name, FiosBrowseTo(item), sizeof(_file_to_saveload.name)); |
22f535ad9eea
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
255 |
ttd_strlcpy(_file_to_saveload.title, item->title, sizeof(_file_to_saveload.title)); |
22f535ad9eea
(svn r2609) - Feature: remove extension from savegames/scenarios when browsing the folders.
Darkvater
parents:
2026
diff
changeset
|
256 |
} break; |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
257 |
default: IConsolePrintF(CC_ERROR, "%s: Not a savegame.", file); |
1581 | 258 |
} |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
259 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
260 |
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
261 |
} |
1581 | 262 |
|
263 |
FiosFreeSavegameList(); |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
264 |
return true; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
265 |
} |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
266 |
|
2415
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
267 |
|
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
268 |
DEF_CONSOLE_CMD(ConRemove) |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
269 |
{ |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
270 |
if (argc == 0) { |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
271 |
IConsoleHelp("Remove a savegame by name or index. Usage: 'rm <file | number>'"); |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
272 |
return true; |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
273 |
} |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
274 |
|
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
275 |
if (argc != 2) return false; |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
276 |
|
10829 | 277 |
const char *file = argv[1]; |
278 |
const FiosItem *item = GetFiosItem(file); |
|
2415
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
279 |
if (item != NULL) { |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
280 |
if (!FiosDelete(item->name)) |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
281 |
IConsolePrintF(CC_ERROR, "%s: Failed to delete file", file); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
282 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
283 |
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
284 |
} |
2415
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
285 |
|
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
286 |
FiosFreeSavegameList(); |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
287 |
return true; |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
288 |
} |
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
289 |
|
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
290 |
|
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
291 |
/* List all the files in the current dir via console */ |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
292 |
DEF_CONSOLE_CMD(ConListFiles) |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
293 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
294 |
if (argc == 0) { |
2540
dbaba9ff9b94
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
295 |
IConsoleHelp("List all loadable savegames and directories in the current dir via console. Usage: 'ls | dir'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
296 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
297 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
298 |
|
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
299 |
BuildFileList(); |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
300 |
|
10829 | 301 |
for (uint i = 0; i < _fios_items.Length(); i++) { |
302 |
IConsolePrintF(CC_DEFAULT, "%d) %s", i, _fios_items[i].title); |
|
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
303 |
} |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
304 |
|
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
305 |
FiosFreeSavegameList(); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
306 |
return true; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
307 |
} |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
308 |
|
1581 | 309 |
/* Change the dir via console */ |
310 |
DEF_CONSOLE_CMD(ConChangeDirectory) |
|
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
311 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
312 |
if (argc == 0) { |
2540
dbaba9ff9b94
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
313 |
IConsoleHelp("Change the dir via console. Usage: 'cd <directory | number>'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
314 |
return true; |
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
315 |
} |
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
316 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
317 |
if (argc != 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
318 |
|
10829 | 319 |
const char *file = argv[1]; |
320 |
const FiosItem *item = GetFiosItem(file); |
|
1581 | 321 |
if (item != NULL) { |
322 |
switch (item->type) { |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
323 |
case FIOS_TYPE_DIR: case FIOS_TYPE_DRIVE: case FIOS_TYPE_PARENT: |
1581 | 324 |
FiosBrowseTo(item); |
325 |
break; |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
326 |
default: IConsolePrintF(CC_ERROR, "%s: Not a directory.", file); |
1581 | 327 |
} |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
328 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
329 |
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
330 |
} |
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
331 |
|
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
332 |
FiosFreeSavegameList(); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
333 |
return true; |
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
334 |
} |
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
335 |
|
1581 | 336 |
DEF_CONSOLE_CMD(ConPrintWorkingDirectory) |
337 |
{ |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
338 |
const char *path; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
339 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
340 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
341 |
IConsoleHelp("Print out the current working directory. Usage: 'pwd'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
342 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
343 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
345 |
// XXX - Workaround for broken file handling |
4223
0f9535dda7ed
(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
|
346 |
FiosGetSavegameList(SLD_LOAD_GAME); |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
347 |
FiosFreeSavegameList(); |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
348 |
|
1596
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1581
diff
changeset
|
349 |
FiosGetDescText(&path, NULL); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
350 |
IConsolePrint(CC_DEFAULT, path); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
351 |
return true; |
885
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
352 |
} |
c9509db963ac
(svn r1370) -Add: added console support for loading maps. Use 'load', 'list_files'
truelight
parents:
841
diff
changeset
|
353 |
|
1827
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
354 |
DEF_CONSOLE_CMD(ConClearBuffer) |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
355 |
{ |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
356 |
if (argc == 0) { |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
357 |
IConsoleHelp("Clear the console buffer. Usage: 'clear'"); |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
358 |
return true; |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
359 |
} |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
360 |
|
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
361 |
IConsoleClearBuffer(); |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
362 |
InvalidateWindow(WC_CONSOLE, 0); |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
363 |
return true; |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
364 |
} |
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
365 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
366 |
|
222
b88456001397
(svn r223) -Fix: 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 |
// ********************************* // |
b88456001397
(svn r223) -Fix: 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 |
// * 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
|
369 |
// ********************************* // |
b88456001397
(svn r223) -Fix: 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 |
#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
|
371 |
|
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
372 |
DEF_CONSOLE_CMD(ConBan) |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
373 |
{ |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
374 |
NetworkClientInfo *ci; |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
375 |
const char *banip = NULL; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
376 |
uint32 index; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
377 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
378 |
if (argc == 0) { |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
379 |
IConsoleHelp("Ban a player from a network game. Usage: 'ban <ip | client-id>'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
380 |
IConsoleHelp("For client-id's, see the command 'clients'"); |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
381 |
IConsoleHelp("If the client is no longer online, you can still ban his/her IP"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
382 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
383 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (argc != 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
386 |
|
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
387 |
if (strchr(argv[1], '.') == NULL) { // banning with ID |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
388 |
index = atoi(argv[1]); |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
389 |
ci = NetworkFindClientInfoFromIndex(index); |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
390 |
} else { // banning IP |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
391 |
ci = NetworkFindClientInfoFromIP(argv[1]); |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
392 |
if (ci == NULL) { |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
393 |
banip = argv[1]; |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
394 |
index = (uint32)-1; |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
395 |
} else { |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
396 |
index = ci->client_index; |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
397 |
} |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
398 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
399 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
400 |
if (index == NETWORK_SERVER_INDEX) { |
2879
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
401 |
IConsoleError("Silly boy, you can not ban yourself!"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
402 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
403 |
} |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
404 |
|
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
405 |
if (index == 0 || (ci == NULL && index != (uint32)-1)) { |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
406 |
IConsoleError("Invalid client"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
407 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
408 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
410 |
if (ci != NULL) { |
10829 | 411 |
banip = GetPlayerIP(ci); |
412 |
NetworkServerSendError(index, NETWORK_ERROR_KICKED); |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
413 |
IConsolePrint(CC_DEFAULT, "Client banned"); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
414 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
415 |
IConsolePrint(CC_DEFAULT, "Client not online, banned IP"); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
416 |
} |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
417 |
|
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
418 |
/* Add user to ban-list */ |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
419 |
for (index = 0; index < lengthof(_network_ban_list); index++) { |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
420 |
if (_network_ban_list[index] == NULL) { |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
421 |
_network_ban_list[index] = strdup(banip); |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
422 |
break; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
423 |
} |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
424 |
} |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
425 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
426 |
return true; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
427 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
428 |
|
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
429 |
DEF_CONSOLE_CMD(ConUnBan) |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
430 |
{ |
2538
81e192bfcf10
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
431 |
uint i, index; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
432 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
433 |
if (argc == 0) { |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
434 |
IConsoleHelp("Unban a player from a network game. Usage: 'unban <ip | client-id>'"); |
2538
81e192bfcf10
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
435 |
IConsoleHelp("For a list of banned IP's, see the command 'banlist'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
436 |
return true; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
437 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
438 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
439 |
if (argc != 2) return false; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
440 |
|
2541
99c04a35ebc5
(svn r3070) - it doesn't matter where the '.' is found for the IP, if it is found, it is not a normal index when unbanning clients ('\0' should of course be NULL); thx Tron
Darkvater
parents:
2540
diff
changeset
|
441 |
index = (strchr(argv[1], '.') == NULL) ? atoi(argv[1]) : 0; |
2538
81e192bfcf10
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
442 |
index--; |
81e192bfcf10
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
443 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
444 |
for (i = 0; i < lengthof(_network_ban_list); i++) { |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
445 |
if (_network_ban_list[i] == NULL) continue; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
446 |
|
4025
489430d5cdec
(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
|
447 |
if (strcmp(_network_ban_list[i], argv[1]) == 0 || index == i) { |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
448 |
free(_network_ban_list[i]); |
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
449 |
_network_ban_list[i] = NULL; |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
450 |
IConsolePrint(CC_DEFAULT, "IP unbanned."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
451 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
452 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
454 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
455 |
IConsolePrint(CC_DEFAULT, "IP not in ban-list."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
456 |
return true; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
457 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
458 |
|
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
459 |
DEF_CONSOLE_CMD(ConBanList) |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
460 |
{ |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
461 |
uint i; |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
462 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
463 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
464 |
IConsoleHelp("List the IP's of banned clients: Usage 'banlist'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
465 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
466 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
467 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
468 |
IConsolePrint(CC_DEFAULT, "Banlist: "); |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
469 |
|
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
470 |
for (i = 0; i < lengthof(_network_ban_list); i++) { |
2914
04ce2485f05f
(svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents:
2880
diff
changeset
|
471 |
if (_network_ban_list[i] != NULL) |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
472 |
IConsolePrintF(CC_DEFAULT, " %d) %s", i + 1, _network_ban_list[i]); |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
473 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
474 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
475 |
return true; |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
476 |
} |
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
477 |
|
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
478 |
DEF_CONSOLE_CMD(ConPauseGame) |
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
479 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
480 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
481 |
IConsoleHelp("Pause a network game. Usage: 'pause'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
482 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
483 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
484 |
|
6557
8381016f71f3
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6449
diff
changeset
|
485 |
if (_pause_game == 0) { |
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
486 |
DoCommandP(0, 1, 0, NULL, CMD_PAUSE); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
487 |
IConsolePrint(CC_DEFAULT, "Game paused."); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
488 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
489 |
IConsolePrint(CC_DEFAULT, "Game is already paused."); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
490 |
} |
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
491 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
492 |
return true; |
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
493 |
} |
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
494 |
|
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
495 |
DEF_CONSOLE_CMD(ConUnPauseGame) |
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
496 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
497 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
498 |
IConsoleHelp("Unpause a network game. Usage: 'unpause'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
499 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
500 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
501 |
|
6557
8381016f71f3
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6449
diff
changeset
|
502 |
if (_pause_game != 0) { |
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
503 |
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
504 |
IConsolePrint(CC_DEFAULT, "Game unpaused."); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
505 |
} else { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
506 |
IConsolePrint(CC_DEFAULT, "Game is already unpaused."); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
507 |
} |
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
508 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
509 |
return true; |
1147
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
510 |
} |
3fae4b3e16a0
(svn r1648) -Fix: server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
darkvater
parents:
1138
diff
changeset
|
511 |
|
1026
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
512 |
DEF_CONSOLE_CMD(ConRcon) |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
513 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
514 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
515 |
IConsoleHelp("Remote control the server from another client. Usage: 'rcon <password> <command>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
516 |
IConsoleHelp("Remember to enclose the command in quotes, otherwise only the first parameter is sent"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
517 |
return true; |
1026
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
518 |
} |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
519 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
520 |
if (argc < 3) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
521 |
|
10645 | 522 |
if (_network_server) { |
523 |
IConsoleCmdExec(argv[2]); |
|
524 |
} else { |
|
10829 | 525 |
NetworkClientSendRcon(argv[1], argv[2]); |
10645 | 526 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
527 |
return true; |
1026
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
528 |
} |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1023
diff
changeset
|
529 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
530 |
DEF_CONSOLE_CMD(ConStatus) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
531 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
532 |
if (argc == 0) { |
2879
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
533 |
IConsoleHelp("List the status of all clients connected to the server. Usage 'status'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
534 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
535 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
536 |
|
10829 | 537 |
NetworkServerShowStatusToConsole(); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
538 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
539 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
540 |
|
2879
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
541 |
DEF_CONSOLE_CMD(ConServerInfo) |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
542 |
{ |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
543 |
if (argc == 0) { |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
544 |
IConsoleHelp("List current and maximum client/player limits. Usage 'server_info'"); |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
545 |
IConsoleHelp("You can change these values by setting the variables 'max_clients', 'max_companies' and 'max_spectators'"); |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
546 |
return true; |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
547 |
} |
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
548 |
|
10829 | 549 |
IConsolePrintF(CC_DEFAULT, "Current/maximum clients: %2d/%2d", _network_game_info.clients_on, _settings_client.network.max_clients); |
550 |
IConsolePrintF(CC_DEFAULT, "Current/maximum companies: %2d/%2d", ActivePlayerCount(), _settings_client.network.max_companies); |
|
551 |
IConsolePrintF(CC_DEFAULT, "Current/maximum spectators: %2d/%2d", NetworkSpectatorCount(), _settings_client.network.max_spectators); |
|
3011
6f2e59779240
(svn r3591) - Fix: validate the setting of max_companies/spectators through the console.
Darkvater
parents:
2944
diff
changeset
|
552 |
|
4716
d9ca1be9d04b
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
553 |
return true; |
d9ca1be9d04b
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
554 |
} |
d9ca1be9d04b
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4614
diff
changeset
|
555 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
556 |
DEF_CONSOLE_CMD(ConKick) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
557 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
558 |
NetworkClientInfo *ci; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
559 |
uint32 index; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
560 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
561 |
if (argc == 0) { |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
562 |
IConsoleHelp("Kick a player from a network game. Usage: 'kick <ip | client-id>'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
563 |
IConsoleHelp("For client-id's, see the command 'clients'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
564 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
565 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
566 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
567 |
if (argc != 2) return false; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
568 |
|
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
569 |
if (strchr(argv[1], '.') == NULL) { |
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
570 |
index = atoi(argv[1]); |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
571 |
ci = NetworkFindClientInfoFromIndex(index); |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
572 |
} else { |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
573 |
ci = NetworkFindClientInfoFromIP(argv[1]); |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
574 |
index = (ci == NULL) ? 0 : ci->client_index; |
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
575 |
} |
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
576 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
577 |
if (index == NETWORK_SERVER_INDEX) { |
2879
d270cb37c0ec
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2863
diff
changeset
|
578 |
IConsoleError("Silly boy, you can not kick yourself!"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
579 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
580 |
} |
2859
d45695cd3e98
(svn r3407) - Feature: Kick and ban now with IP numbers.
Darkvater
parents:
2541
diff
changeset
|
581 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
582 |
if (index == 0) { |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
583 |
IConsoleError("Invalid client"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
584 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
585 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
587 |
if (ci != NULL) { |
10829 | 588 |
NetworkServerSendError(index, NETWORK_ERROR_KICKED); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
589 |
} else { |
2860
3166189ae39f
(svn r3408) - Ok, compile before you commit; sorry (fix previous commit)
Darkvater
parents:
2859
diff
changeset
|
590 |
IConsoleError("Client not found"); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
591 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
592 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
593 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
594 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
595 |
|
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
596 |
DEF_CONSOLE_CMD(ConResetCompany) |
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
597 |
{ |
4883
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
598 |
const Player *p; |
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
599 |
PlayerID index; |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
600 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
601 |
if (argc == 0) { |
1761
00d296fcdc76
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
602 |
IConsoleHelp("Remove an idle company from the game. Usage: 'reset_company <company-id>'"); |
00d296fcdc76
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
603 |
IConsoleHelp("For company-id's, see the list of companies from the dropdown menu. Player 1 is 1, etc."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
604 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
605 |
} |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
606 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
607 |
if (argc != 2) return false; |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
608 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
609 |
index = (PlayerID)(atoi(argv[1]) - 1); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
610 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
611 |
/* Check valid range */ |
4878
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
612 |
if (!IsValidPlayer(index)) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
613 |
IConsolePrintF(CC_ERROR, "Company does not exist. Company-id must be between 1 and %d.", MAX_PLAYERS); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
614 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
615 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
617 |
/* Check if company does exist */ |
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1943
diff
changeset
|
618 |
p = GetPlayer(index); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
619 |
if (!p->is_active) { |
1761
00d296fcdc76
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
620 |
IConsoleError("Company does not exist."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
621 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
622 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
624 |
if (p->is_ai) { |
1761
00d296fcdc76
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
625 |
IConsoleError("Company is owned by an AI."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
626 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
627 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
628 |
|
10829 | 629 |
if (NetworkCompanyHasPlayers(index)) { |
630 |
IConsoleError("Cannot remove company: a client is connected to that company."); |
|
631 |
return false; |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
632 |
} |
10829 | 633 |
const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); |
4878
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
634 |
if (ci->client_playas == index) { |
1761
00d296fcdc76
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
635 |
IConsoleError("Cannot remove company: the server is connected to that company."); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
636 |
return true; |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
637 |
} |
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
638 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
639 |
/* It is safe to remove this company */ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
640 |
DoCommandP(0, 2, index, NULL, CMD_PLAYER_CTRL); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
641 |
IConsolePrint(CC_DEFAULT, "Company deleted."); |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
642 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
643 |
return true; |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
644 |
} |
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
645 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
646 |
DEF_CONSOLE_CMD(ConNetworkClients) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
647 |
{ |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
648 |
NetworkClientInfo *ci; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
649 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
650 |
if (argc == 0) { |
2538
81e192bfcf10
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
Darkvater
parents:
2461
diff
changeset
|
651 |
IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
652 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
653 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
654 |
|
4883
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
655 |
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
656 |
IConsolePrintF(CC_INFO, "Client #%1d name: '%s' company: %1d IP: %s", |
4883
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
657 |
ci->client_index, ci->client_name, |
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
658 |
ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0), |
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
659 |
GetPlayerIP(ci)); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
660 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
661 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
662 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
663 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
664 |
|
222
b88456001397
(svn r223) -Fix: 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 |
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
|
666 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
667 |
char *ip; |
1329 | 668 |
const char *port = NULL; |
669 |
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
|
670 |
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
|
671 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
672 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
673 |
IConsoleHelp("Connect to a remote OTTD server and join the game. Usage: 'connect <ip>'"); |
4861
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
674 |
IConsoleHelp("IP can contain port and player: 'IP[[#Player]:Port]', eg: 'server.ottd.org#2:443'"); |
4878
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
675 |
IConsoleHelp("Player #255 is spectator all others are a certain company with Company 1 being #1"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
676 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
677 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
678 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
679 |
if (argc < 2) return false; |
4883
801b93ae218c
(svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents:
4878
diff
changeset
|
680 |
if (_networking) NetworkDisconnect(); // we are in network-mode, first close it! |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
681 |
|
228
f65dec6727d9
(svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents:
222
diff
changeset
|
682 |
ip = argv[1]; |
4861
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
683 |
/* Default settings: default port and new company */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
684 |
rport = NETWORK_DEFAULT_PORT; |
4861
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
685 |
_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
|
686 |
|
228
f65dec6727d9
(svn r229) -Fix: Some more const stuff fixed .(Tron)
darkvater
parents:
222
diff
changeset
|
687 |
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
|
688 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
689 |
IConsolePrintF(CC_DEFAULT, "Connecting to %s...", ip); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
690 |
if (player != NULL) { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
691 |
_network_playas = (PlayerID)atoi(player); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
692 |
IConsolePrintF(CC_DEFAULT, " player-no: %d", _network_playas); |
4861
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
693 |
|
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
694 |
/* From a user pov 0 is a new player, internally it's different and all |
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
695 |
* players are offset by one to ease up on users (eg players 1-8 not 0-7) */ |
4878
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
696 |
if (_network_playas != PLAYER_SPECTATOR) { |
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
697 |
_network_playas--; |
744717de172e
(svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents:
4861
diff
changeset
|
698 |
if (!IsValidPlayer(_network_playas)) return false; |
4861
f28bfa84f9ad
(svn r6787) -Codechange: Use PLAYER_NEW_COMPANY as a player identifier wishing to become a
Darkvater
parents:
4850
diff
changeset
|
699 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
700 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
701 |
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
|
702 |
rport = atoi(port); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
703 |
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
|
704 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
705 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
706 |
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
|
707 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
708 |
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
|
709 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
710 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
711 |
#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
|
712 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
713 |
/* ******************************** */ |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
714 |
/* script file console commands */ |
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 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
717 |
DEF_CONSOLE_CMD(ConExec) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
718 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
719 |
char cmdline[ICON_CMDLN_SIZE]; |
1743
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
720 |
char *cmdptr; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
721 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
722 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
723 |
IConsoleHelp("Execute a local script file. Usage: 'exec <script> <?>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
724 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
725 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
727 |
if (argc < 2) return false; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
728 |
|
9732 | 729 |
_script_file = FioFOpenFile(argv[1], "r", BASE_DIR); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
730 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
731 |
if (_script_file == NULL) { |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
732 |
if (argc == 2 || atoi(argv[2]) != 0) IConsoleError("script file not found"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
733 |
return true; |
1383 | 734 |
} |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
735 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
736 |
_script_running = true; |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
737 |
|
1743
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
738 |
while (_script_running && fgets(cmdline, sizeof(cmdline), _script_file) != NULL) { |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
739 |
/* Remove newline characters from the executing script */ |
1819 | 740 |
for (cmdptr = cmdline; *cmdptr != '\0'; cmdptr++) { |
1743
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
741 |
if (*cmdptr == '\n' || *cmdptr == '\r') { |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
742 |
*cmdptr = '\0'; |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
743 |
break; |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
744 |
} |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
745 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
746 |
IConsoleCmdExec(cmdline); |
1743
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
747 |
} |
1382
2a2ac927a256
(svn r1886) Correctly process the last line of a script, even if it's not newline terminated. Also print an error message if something goes wrong while reading from the script file
tron
parents:
1379
diff
changeset
|
748 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
749 |
if (ferror(_script_file)) |
1382
2a2ac927a256
(svn r1886) Correctly process the last line of a script, even if it's not newline terminated. Also print an error message if something goes wrong while reading from the script file
tron
parents:
1379
diff
changeset
|
750 |
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
|
751 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
752 |
_script_running = false; |
9732 | 753 |
FioFCloseFile(_script_file); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
754 |
return true; |
247
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 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
757 |
DEF_CONSOLE_CMD(ConReturn) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
758 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
759 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
760 |
IConsoleHelp("Stop executing a running script. Usage: 'return'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
761 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
762 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
763 |
|
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
764 |
_script_running = false; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
765 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
766 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
767 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
768 |
/* **************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
769 |
/* 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
|
770 |
/* **************************** */ |
6573 | 771 |
extern bool CloseConsoleLogIfActive(); |
1023
8df956881058
(svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents:
1019
diff
changeset
|
772 |
|
8df956881058
(svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents:
1019
diff
changeset
|
773 |
DEF_CONSOLE_CMD(ConScript) |
8df956881058
(svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents:
1019
diff
changeset
|
774 |
{ |
8df956881058
(svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents:
1019
diff
changeset
|
775 |
extern FILE* _iconsole_output_file; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
776 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
778 |
IConsoleHelp("Start or stop logging console output to a file. Usage: 'script <filename>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
779 |
IConsoleHelp("If filename is omitted, a running log is stopped if it is active"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
780 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
781 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
782 |
|
1023
8df956881058
(svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents:
1019
diff
changeset
|
783 |
if (!CloseConsoleLogIfActive()) { |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
784 |
if (argc < 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
785 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
786 |
IConsolePrintF(CC_DEFAULT, "file output started to: %s", argv[1]); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
787 |
_iconsole_output_file = fopen(argv[1], "ab"); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
788 |
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
|
789 |
} |
1023
8df956881058
(svn r1524) -"Feature": when windows exception tracker is enabled (release builds) and the game crashes for any reason any active log file is closed first. This ensures the log file and ingame debug messages can be used to debug a problem. Any *nix versions are welcome
darkvater
parents:
1019
diff
changeset
|
790 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
791 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
792 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
793 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
794 |
|
222
b88456001397
(svn r223) -Fix: 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 |
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
|
796 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
797 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
798 |
IConsoleHelp("Print back the first argument to the console. Usage: 'echo <arg>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
799 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
800 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
802 |
if (argc < 2) return false; |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
803 |
IConsolePrint(CC_DEFAULT, argv[1]); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
804 |
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
|
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 |
|
b88456001397
(svn r223) -Fix: 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 |
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
|
808 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
809 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
810 |
IConsoleHelp("Print back the first argument to the console in a given colour. Usage: 'echoc <colour> <arg2>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
811 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
812 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
814 |
if (argc < 3) return false; |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
815 |
IConsolePrint((ConsoleColour)atoi(argv[1]), argv[2]); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
816 |
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
|
817 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
818 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
819 |
DEF_CONSOLE_CMD(ConNewGame) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
820 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
821 |
if (argc == 0) { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
822 |
IConsoleHelp("Start a new game. Usage: 'newgame [seed]'"); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
823 |
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
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
825 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
826 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
827 |
StartNewGameWithoutGUI((argc == 2) ? (uint)atoi(argv[1]) : GENERATE_NEW_SEED); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
828 |
return true; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
829 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
830 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
831 |
extern void SwitchMode(int new_mode); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
832 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
833 |
DEF_CONSOLE_CMD(ConRestart) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
834 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
835 |
if (argc == 0) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
836 |
IConsoleHelp("Restart game. Usage: 'restart'"); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
837 |
IConsoleHelp("Restarts a game. It tries to reproduce the exact same map as the game started with."); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
838 |
return true; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
839 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
840 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
841 |
/* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */ |
10776 | 842 |
_settings_game.game_creation.map_x = MapLogX(); |
843 |
_settings_game.game_creation.map_y = FindFirstBit(MapSizeY()); |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
844 |
SwitchMode(SM_NEWGAME); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
845 |
return true; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
846 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
847 |
|
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
848 |
DEF_CONSOLE_CMD(ConListAI) |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
849 |
{ |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
850 |
char buf[1024]; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
851 |
char *p = &buf[0]; |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
10455
diff
changeset
|
852 |
p = AI_GetConsoleList(p, lastof(buf)); |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
853 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
854 |
p = &buf[0]; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
855 |
/* Print output line by line */ |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
856 |
for (char *p2 = &buf[0]; *p2 != '\0'; p2++) { |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
857 |
if (*p2 == '\n') { |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
858 |
*p2 = '\0'; |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
859 |
IConsolePrintF(CC_DEFAULT, "%s", p); |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
860 |
p = p2 + 1; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
861 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
862 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
863 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
864 |
return true; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
865 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
866 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
867 |
DEF_CONSOLE_CMD(ConStartAI) |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
868 |
{ |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
869 |
if (argc == 0) { |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
870 |
IConsoleHelp("Start a new AI. Usage: 'startai [<AI>]'"); |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
871 |
IConsoleHelp("Start a new AI. If <AI> is given, it starts that specific AI (if found)."); |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
872 |
return true; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
873 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
874 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
875 |
uint n = 0; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
876 |
Player *p; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
877 |
FOR_ALL_PLAYERS(p) { |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
878 |
if (p->is_active) n++; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
879 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
880 |
if (n == MAX_PLAYERS) { |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
881 |
IConsoleWarning("Can't start a new AI (no more free slots)."); |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
882 |
return true; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
883 |
} |
10880
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
884 |
if (_networking && !_network_server) { |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
885 |
IConsoleWarning("Only the server can start a new AI."); |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
886 |
return true; |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
887 |
} |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
888 |
if (_networking && !_settings_game.ai.ai_in_multiplayer) { |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
889 |
IConsoleWarning("AIs are not allowed in multiplayer by configuration."); |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
890 |
IConsoleWarning("Switch AI -> AI in multiplayer to True."); |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
891 |
return true; |
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
892 |
} |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
893 |
if (!AI_AllowNewAI()) { |
10880
32e681ff8b5d
(svn r13431) [NoAI] -Fix: AIs in multiplayer is no longer an experimental thing
truebrain
parents:
10829
diff
changeset
|
894 |
IConsoleWarning("Can't start a new AI."); |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
895 |
return true; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
896 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
897 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
898 |
AI_ForceAI(argc == 1 ? NULL : argv[1]); |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
899 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
900 |
/* Start a new AI player */ |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
901 |
DoCommandP(0, 1, 0, NULL, CMD_PLAYER_CTRL); |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
902 |
|
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
903 |
return true; |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
904 |
} |
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
905 |
|
10891
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
906 |
DEF_CONSOLE_CMD(ConRescanAI) |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
907 |
{ |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
908 |
if (argc == 0) { |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
909 |
IConsoleHelp("Rescan the AI dir for scripts. Usage: 'rescan_ai'"); |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
910 |
return true; |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
911 |
} |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
912 |
|
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
913 |
if (_networking && !_network_server) { |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
914 |
IConsoleWarning("Only the server can rescan the AI dir for scripts."); |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
915 |
return true; |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
916 |
} |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
917 |
|
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
918 |
AI_Rescan(); |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
919 |
|
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
920 |
return true; |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
921 |
} |
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
922 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
923 |
DEF_CONSOLE_CMD(ConGetSeed) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
924 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
925 |
if (argc == 0) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
926 |
IConsoleHelp("Returns the seed used to create this game. Usage: 'getseed'"); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
927 |
IConsoleHelp("The seed can be used to reproduce the exact same map as the game started with."); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
928 |
return true; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
929 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
930 |
|
10776 | 931 |
IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings_game.game_creation.generation_seed); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
932 |
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
|
933 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
934 |
|
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
935 |
DEF_CONSOLE_CMD(ConGetDate) |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
936 |
{ |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
937 |
if (argc == 0) { |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
938 |
IConsoleHelp("Returns the current date (day-month-year) of the game. Usage: 'getdate'"); |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
939 |
return true; |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
940 |
} |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
941 |
|
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
942 |
YearMonthDay ymd; |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
943 |
ConvertDateToYMD(_date, &ymd); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
944 |
IConsolePrintF(CC_DEFAULT, "Date: %d-%d-%d", ymd.day, ymd.month + 1, ymd.year); |
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
945 |
return true; |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
946 |
} |
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
947 |
|
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
948 |
|
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
949 |
DEF_CONSOLE_CMD(ConAlias) |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
950 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
951 |
IConsoleAlias *alias; |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
952 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
953 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
954 |
IConsoleHelp("Add a new alias, or redefine the behaviour of an existing alias . Usage: 'alias <name> <command>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
955 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
956 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (argc < 3) return false; |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
959 |
|
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
960 |
alias = IConsoleAliasGet(argv[1]); |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
961 |
if (alias == NULL) { |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
962 |
IConsoleAliasRegister(argv[1], argv[2]); |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
963 |
} else { |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
964 |
free(alias->cmdline); |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
965 |
alias->cmdline = strdup(argv[2]); |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
637
diff
changeset
|
966 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
967 |
return true; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
968 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
969 |
|
222
b88456001397
(svn r223) -Fix: 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 |
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
|
971 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
972 |
if (argc == 0) { |
2540
dbaba9ff9b94
(svn r3069) - CodeChange: now that we have the '|' char, use that as a seperator instead of '\' as was originally intention
Darkvater
parents:
2539
diff
changeset
|
973 |
IConsoleHelp("Create a screenshot of the game. Usage: 'screenshot [big | no_con]'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
974 |
IConsoleHelp("'big' makes a screenshot of the whole map, 'no_con' hides the console to create the screenshot"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
975 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
976 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
2539
20b0e2a6b9b0
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
978 |
if (argc > 3) return false; |
20b0e2a6b9b0
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
979 |
|
4184
f38abcb8b18d
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
980 |
SetScreenshotType(SC_VIEWPORT); |
2539
20b0e2a6b9b0
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
981 |
if (argc > 1) { |
20b0e2a6b9b0
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
982 |
if (strcmp(argv[1], "big") == 0 || (argc == 3 && strcmp(argv[2], "big") == 0)) |
4184
f38abcb8b18d
(svn r5626) CodeChange : Remove the global _make_screenshot and implement a more flexible mechanism
belugas
parents:
4085
diff
changeset
|
983 |
SetScreenshotType(SC_WORLD); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
984 |
|
2539
20b0e2a6b9b0
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
985 |
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
|
986 |
IConsoleClose(); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
987 |
} |
2539
20b0e2a6b9b0
(svn r3068) - Feature: make it possible to create a screenshot from the console that is both big and has no console, or any combination of.
Darkvater
parents:
2538
diff
changeset
|
988 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
989 |
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
|
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 |
|
229
b94bfdf02bae
(svn r230) -Feature: IConsoleWarning for warning messages
signde
parents:
228
diff
changeset
|
992 |
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
|
993 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
994 |
static const char *_icon_vartypes[] = {"boolean", "byte", "uint16", "uint32", "int16", "int32", "string"}; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
995 |
const IConsoleVar *var; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
996 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
998 |
IConsoleHelp("Print out debugging information about a variable. Usage: 'info_var <var>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
999 |
return true; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1000 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1001 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1002 |
if (argc < 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1003 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1004 |
var = IConsoleVarGet(argv[1]); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1005 |
if (var == NULL) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1006 |
IConsoleError("the given variable was not found"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1007 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1008 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1009 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1010 |
IConsolePrintF(CC_DEFAULT, "variable name: %s", var->name); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1011 |
IConsolePrintF(CC_DEFAULT, "variable type: %s", _icon_vartypes[var->type]); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1012 |
IConsolePrintF(CC_DEFAULT, "variable addr: 0x%X", var->addr); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1013 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1014 |
if (var->hook.access) IConsoleWarning("variable is access hooked"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1015 |
if (var->hook.pre) IConsoleWarning("variable is pre hooked"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1016 |
if (var->hook.post) IConsoleWarning("variable is post hooked"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1017 |
return true; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1018 |
} |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1019 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1020 |
|
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1021 |
DEF_CONSOLE_CMD(ConInfoCmd) |
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
232
diff
changeset
|
1022 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1023 |
const IConsoleCmd *cmd; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1024 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1025 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1026 |
IConsoleHelp("Print out debugging information about a command. Usage: 'info_cmd <cmd>'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1027 |
return true; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1028 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1029 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1030 |
if (argc < 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1031 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1032 |
cmd = IConsoleCmdGet(argv[1]); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1033 |
if (cmd == NULL) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1034 |
IConsoleError("the given command was not found"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1035 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1036 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1037 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1038 |
IConsolePrintF(CC_DEFAULT, "command name: %s", cmd->name); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1039 |
IConsolePrintF(CC_DEFAULT, "command proc: 0x%X", cmd->proc); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1040 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1041 |
if (cmd->hook.access) IConsoleWarning("command is access hooked"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1042 |
if (cmd->hook.pre) IConsoleWarning("command is pre hooked"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1043 |
if (cmd->hook.post) IConsoleWarning("command is post hooked"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1044 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1045 |
return true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1046 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1047 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1048 |
DEF_CONSOLE_CMD(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
|
1049 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1050 |
if (argc == 0) { |
1847
47703af63895
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1051 |
IConsoleHelp("Get/set the default debugging level for the game. Usage: 'debug_level [<level>]'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1052 |
IConsoleHelp("Level can be any combination of names, levels. Eg 'net=5 ms=4'. Remember to enclose it in \"'s"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1053 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1054 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1055 |
|
1847
47703af63895
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1056 |
if (argc > 2) return false; |
47703af63895
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1057 |
|
47703af63895
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1058 |
if (argc == 1) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1059 |
IConsolePrintF(CC_DEFAULT, "Current debug-level: '%s'", GetDebugString()); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1060 |
} else { |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1061 |
SetDebugString(argv[1]); |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1062 |
} |
1847
47703af63895
(svn r2352) - Feature: add the possibility to print out the current debug-level
Darkvater
parents:
1833
diff
changeset
|
1063 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1064 |
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
|
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 |
|
b88456001397
(svn r223) -Fix: 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 |
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
|
1068 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1069 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1070 |
IConsoleHelp("Exit the game. Usage: 'exit'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1071 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1072 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
10776 | 1074 |
if (_game_mode == GM_NORMAL && _settings_client.gui.autosave_on_exit) DoExitSave(); |
9694
e72987579514
(svn r10775) [NoAI] -Sync: with trunk r10535:r10774.
rubidium
parents:
9629
diff
changeset
|
1075 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1076 |
_exit_game = true; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1077 |
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
|
1078 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1079 |
|
1814
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1080 |
DEF_CONSOLE_CMD(ConPart) |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1081 |
{ |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1082 |
if (argc == 0) { |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1083 |
IConsoleHelp("Leave the currently joined/running game (only ingame). Usage: 'part'"); |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1084 |
return true; |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1085 |
} |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1086 |
|
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1087 |
if (_game_mode != GM_NORMAL) return false; |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1088 |
|
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1089 |
_switch_mode = SM_MENU; |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1090 |
return true; |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1091 |
} |
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1092 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1093 |
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
|
1094 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1095 |
if (argc == 2) { |
1743
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1096 |
const IConsoleCmd *cmd; |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1097 |
const IConsoleVar *var; |
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1098 |
const IConsoleAlias *alias; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1099 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
cmd = IConsoleCmdGet(argv[1]); |
2026 | 1101 |
if (cmd != NULL) { |
1102 |
cmd->proc(0, NULL); |
|
1103 |
return true; |
|
1104 |
} |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1105 |
|
2026 | 1106 |
alias = IConsoleAliasGet(argv[1]); |
1107 |
if (alias != NULL) { |
|
1108 |
cmd = IConsoleCmdGet(alias->cmdline); |
|
1109 |
if (cmd != NULL) { |
|
1110 |
cmd->proc(0, NULL); |
|
1111 |
return true; |
|
1112 |
} |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1113 |
IConsolePrintF(CC_ERROR, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline); |
2026 | 1114 |
return true; |
1115 |
} |
|
1743
b49e71451de5
(svn r2247) - Fix (regression): executing scripts now works (remove newline character(s)).
Darkvater
parents:
1740
diff
changeset
|
1116 |
|
2026 | 1117 |
var = IConsoleVarGet(argv[1]); |
1118 |
if (var != NULL && var->help != NULL) { |
|
1119 |
IConsoleHelp(var->help); |
|
1120 |
return true; |
|
1121 |
} |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1122 |
|
2026 | 1123 |
IConsoleError("command or variable not found"); |
1124 |
return true; |
|
1125 |
} |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1126 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1127 |
IConsolePrint(CC_WARNING, " ---- OpenTTD Console Help ---- "); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1128 |
IConsolePrint(CC_DEFAULT, " - variables: [command to list all variables: list_vars]"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1129 |
IConsolePrint(CC_DEFAULT, " set value with '<var> = <value>', use '++/--' to in-or decrement"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1130 |
IConsolePrint(CC_DEFAULT, " or omit '=' and just '<var> <value>'. get value with typing '<var>'"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1131 |
IConsolePrint(CC_DEFAULT, " - commands: [command to list all commands: list_cmds]"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1132 |
IConsolePrint(CC_DEFAULT, " call commands with '<command> <arg2> <arg3>...'"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1133 |
IConsolePrint(CC_DEFAULT, " - to assign strings, or use them as arguments, enclose it within quotes"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1134 |
IConsolePrint(CC_DEFAULT, " like this: '<command> \"string argument with spaces\"'"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1135 |
IConsolePrint(CC_DEFAULT, " - use 'help <command> | <variable>' to get specific information"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1136 |
IConsolePrint(CC_DEFAULT, " - scroll console output with shift + (up | down) | (pageup | pagedown))"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1137 |
IConsolePrint(CC_DEFAULT, " - scroll console input history with the up | down arrows"); |
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1138 |
IConsolePrint(CC_DEFAULT, ""); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1139 |
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
|
1140 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1141 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1142 |
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
|
1143 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1144 |
const IConsoleCmd *cmd; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1145 |
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
|
1146 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1147 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1148 |
IConsoleHelp("List all registered commands. Usage: 'list_cmds [<pre-filter>]'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1149 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1150 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1151 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1152 |
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
|
1153 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1154 |
for (cmd = _iconsole_cmds; cmd != NULL; cmd = cmd->next) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1155 |
if (argv[1] == NULL || strncmp(cmd->name, argv[1], l) == 0) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1156 |
IConsolePrintF(CC_DEFAULT, "%s", cmd->name); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1157 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1158 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1159 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1160 |
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
|
1161 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1162 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1163 |
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
|
1164 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1165 |
const IConsoleVar *var; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1166 |
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
|
1167 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1168 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1169 |
IConsoleHelp("List all registered variables. Usage: 'list_vars [<pre-filter>]'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1170 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1171 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1172 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1173 |
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
|
1174 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1175 |
for (var = _iconsole_vars; var != NULL; var = var->next) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1176 |
if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0) |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1177 |
IConsolePrintF(CC_DEFAULT, "%s", var->name); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1178 |
} |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1179 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1180 |
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
|
1181 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1182 |
|
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1183 |
DEF_CONSOLE_CMD(ConListAliases) |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1184 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1185 |
const IConsoleAlias *alias; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1186 |
size_t l = 0; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1187 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1188 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1189 |
IConsoleHelp("List all registered aliases. Usage: 'list_aliases [<pre-filter>]'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1190 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1191 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1192 |
|
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1193 |
if (argv[1] != NULL) l = strlen(argv[1]); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1194 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1195 |
for (alias = _iconsole_aliases; alias != NULL; alias = alias->next) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1196 |
if (argv[1] == NULL || strncmp(alias->name, argv[1], l) == 0) |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1197 |
IConsolePrintF(CC_DEFAULT, "%s => %s", alias->name, alias->cmdline); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1198 |
} |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
629
diff
changeset
|
1199 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1200 |
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
|
1201 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1202 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1203 |
#ifdef ENABLE_NETWORK |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1204 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1205 |
DEF_CONSOLE_CMD(ConSay) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1206 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1207 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1208 |
IConsoleHelp("Chat to your fellow players in a multiplayer game. Usage: 'say \"<msg>\"'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1209 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1210 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1211 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 (argc != 2) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1213 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1214 |
if (!_network_server) { |
10829 | 1215 |
NetworkClientSendChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0 /* param does not matter */, argv[1]); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1216 |
} else { |
10829 | 1217 |
NetworkServerSendChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, argv[1], NETWORK_SERVER_INDEX); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1218 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1219 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1220 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1221 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1222 |
|
3818
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1223 |
DEF_CONSOLE_CMD(ConPlayers) |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1224 |
{ |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1225 |
Player *p; |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1226 |
|
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1227 |
if (argc == 0) { |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1228 |
IConsoleHelp("List the in-game details of all clients connected to the server. Usage 'players'"); |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1229 |
return true; |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1230 |
} |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1231 |
NetworkPopulateCompanyInfo(); |
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1232 |
|
df92fcdaf7ac
(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
|
1233 |
FOR_ALL_PLAYERS(p) { |
3847
97c242d81edb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1234 |
char buffer[512]; |
97c242d81edb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1235 |
|
97c242d81edb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1236 |
if (!p->is_active) continue; |
97c242d81edb
(svn r4871) - Fixed off-by-one and added company color displaying in 'players' console command.
glx
parents:
3818
diff
changeset
|
1237 |
|
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1238 |
const NetworkPlayerInfo *npi = &_network_player_info[p->index]; |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1239 |
|
4912
d04b3f2bca70
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4906
diff
changeset
|
1240 |
GetString(buffer, STR_00D1_DARK_BLUE + _player_colors[p->index], lastof(buffer)); |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1241 |
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", |
9722
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9718
diff
changeset
|
1242 |
p->index + 1, buffer, npi->company_name, p->inaugurated_year, (int64)p->player_money, (int64)p->current_loan, (int64)CalculateCompanyValue(p), |
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1243 |
/* trains */ npi->num_vehicle[0], |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1244 |
/* lorry + bus */ npi->num_vehicle[1] + npi->num_vehicle[2], |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1245 |
/* planes */ npi->num_vehicle[3], |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1246 |
/* ships */ npi->num_vehicle[4], |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9599
diff
changeset
|
1247 |
/* protected */ StrEmpty(npi->password) ? "un" : ""); |
3818
df92fcdaf7ac
(svn r4828) -Feature (FS#150) Add a new console command "players" that lists current players along with basic stats (ledow)
celestar
parents:
3647
diff
changeset
|
1248 |
} |
df92fcdaf7ac
(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
|
1249 |
|
df92fcdaf7ac
(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
|
1250 |
return true; |
df92fcdaf7ac
(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
|
1251 |
} |
df92fcdaf7ac
(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
|
1252 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1253 |
DEF_CONSOLE_CMD(ConSayPlayer) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1254 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1255 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1256 |
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_player <player-no> \"<msg>\"'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1257 |
IConsoleHelp("PlayerNo is the player that plays as company <playerno>, 1 through max_players"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1258 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1259 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1260 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1261 |
if (argc != 3) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1262 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1263 |
if (atoi(argv[1]) < 1 || atoi(argv[1]) > MAX_PLAYERS) { |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1264 |
IConsolePrintF(CC_DEFAULT, "Unknown player. Player range is between 1 and %d.", MAX_PLAYERS); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1265 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1266 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1268 |
if (!_network_server) { |
10829 | 1269 |
NetworkClientSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2]); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1270 |
} else { |
10829 | 1271 |
NetworkServerSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1272 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1273 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1274 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1275 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1276 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1277 |
DEF_CONSOLE_CMD(ConSayClient) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1278 |
{ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1279 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1280 |
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_client <client-no> \"<msg>\"'"); |
2026 | 1281 |
IConsoleHelp("For client-id's, see the command 'clients'"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1282 |
return true; |
627
a78f58e07142
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents:
625
diff
changeset
|
1283 |
} |
a78f58e07142
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
truelight
parents:
625
diff
changeset
|
1284 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1285 |
if (argc != 3) return false; |
1602
08783e4287dc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1596
diff
changeset
|
1286 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1287 |
if (!_network_server) { |
10829 | 1288 |
NetworkClientSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2]); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1289 |
} else { |
10829 | 1290 |
NetworkServerSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1291 |
} |
678
9c84b180ecd7
(svn r1116) -Add: [Console] With 'set server_advertise on/off' you can put server
truelight
parents:
666
diff
changeset
|
1292 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1293 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1294 |
} |
1602
08783e4287dc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1596
diff
changeset
|
1295 |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
1296 |
extern void HashCurrentCompanyPassword(); |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
1297 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1298 |
/* Also use from within player_gui to change the password graphically */ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1299 |
bool NetworkChangeCompanyPassword(byte argc, char *argv[]) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1300 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 (argc == 0) { |
4850
b4e9be22945f
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4826
diff
changeset
|
1302 |
if (!IsValidPlayer(_local_player)) return true; // dedicated server |
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1303 |
IConsolePrintF(CC_WARNING, "Current value for 'company_pw': %s", _network_player_info[_local_player].password); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1304 |
return true; |
690
9f449a6b133e
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1305 |
} |
9f449a6b133e
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1306 |
|
4850
b4e9be22945f
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4826
diff
changeset
|
1307 |
if (!IsValidPlayer(_local_player)) { |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1308 |
IConsoleError("You have to own a company to make use of this command."); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1309 |
return false; |
690
9f449a6b133e
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1310 |
} |
9f449a6b133e
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
688
diff
changeset
|
1311 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1312 |
if (argc != 1) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1313 |
|
4026
f6faccd92b1c
(svn r5265) Replace a dozen bogus uses of strncmp() by strcmp()
tron
parents:
4025
diff
changeset
|
1314 |
if (strcmp(argv[0], "*") == 0) argv[0][0] = '\0'; |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1315 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1316 |
ttd_strlcpy(_network_player_info[_local_player].password, argv[0], sizeof(_network_player_info[_local_player].password)); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1317 |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
1318 |
if (!_network_server) { |
10829 | 1319 |
NetworkClientSetPassword(); |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
1320 |
} else { |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
1321 |
HashCurrentCompanyPassword(); |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
1322 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1323 |
|
10715
6bdf79ffb022
(svn r13265) [NoAI] -Sync with trunk r13185:13264.
rubidium
parents:
10645
diff
changeset
|
1324 |
IConsolePrintF(CC_WARNING, "'company_pw' changed to: %s", _network_player_info[_local_player].password); |
1866
200d225a85ff
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1847
diff
changeset
|
1325 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1326 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1327 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, 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 |
|
4614
82d41ead0e22
(svn r6471) -Fix (r6450): ConPatch was moved from network-only, but the function was
Darkvater
parents:
4600
diff
changeset
|
1329 |
#endif /* ENABLE_NETWORK */ |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1330 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1331 |
DEF_CONSOLE_CMD(ConPatch) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1332 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1333 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1334 |
IConsoleHelp("Change patch variables for all players. Usage: 'patch <name> [<value>]'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1335 |
IConsoleHelp("Omitting <value> will print out the current value of the patch-setting."); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1336 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1337 |
} |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1338 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1339 |
if (argc == 1 || argc > 3) return false; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1340 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1341 |
if (argc == 2) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1342 |
IConsoleGetPatchSetting(argv[1]); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1343 |
} else { |
10829 | 1344 |
IConsoleSetPatchSetting(argv[1], argv[2]); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4026
diff
changeset
|
1345 |
} |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1346 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1347 |
return true; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1348 |
} |
623
e0e3e0340097
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
1349 |
|
9574 | 1350 |
DEF_CONSOLE_CMD(ConListPatches) |
1351 |
{ |
|
1352 |
if (argc == 0) { |
|
1353 |
IConsoleHelp("List patch options. Usage: 'list_patches'"); |
|
1354 |
return true; |
|
1355 |
} |
|
1356 |
||
1357 |
if (argc != 1) return false; |
|
1358 |
||
1359 |
IConsoleListPatches(); |
|
1360 |
return true; |
|
1361 |
} |
|
1362 |
||
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1363 |
DEF_CONSOLE_CMD(ConListDumpVariables) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1364 |
{ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1365 |
const IConsoleVar *var; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1366 |
size_t l = 0; |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1367 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1368 |
if (argc == 0) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1369 |
IConsoleHelp("List all variables with their value. Usage: 'dump_vars [<pre-filter>]'"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1370 |
return true; |
625
682ead270492
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1371 |
} |
682ead270492
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1372 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1373 |
if (argv[1] != NULL) l = strlen(argv[1]); |
625
682ead270492
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
623
diff
changeset
|
1374 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1375 |
for (var = _iconsole_vars; var != NULL; var = var->next) { |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1376 |
if (argv[1] == NULL || strncmp(var->name, argv[1], l) == 0) |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1377 |
IConsoleVarPrintGetValue(var); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1378 |
} |
623
e0e3e0340097
(svn r1053) -Change: [Console] Changed 'setservername', 'setpassword', 'protect' and 'name' in:
truelight
parents:
602
diff
changeset
|
1379 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1380 |
return true; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1381 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1382 |
|
10829 | 1383 |
DEF_CONSOLE_CMD(ConGamelogPrint) |
1384 |
{ |
|
1385 |
GamelogPrintConsole(); |
|
1386 |
return true; |
|
1387 |
} |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1388 |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1389 |
#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
|
1390 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1391 |
/* 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
|
1392 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1393 |
|
6573 | 1394 |
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
|
1395 |
{ |
6449
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5875
diff
changeset
|
1396 |
/* debugging variables and functions */ |
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5875
diff
changeset
|
1397 |
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
|
1398 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1399 |
IConsoleVarRegister("con_developer", &_stdlib_con_developer, ICONSOLE_VAR_BOOLEAN, "Enable/disable console debugging information (internal)"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1400 |
IConsoleCmdRegister("resettile", ConResetTile); |
3621
bd0e8b718275
(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
|
1401 |
IConsoleCmdRegister("stopall", ConStopAllVehicles); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1402 |
IConsoleAliasRegister("dbg_echo", "echo %A; echo %B"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1403 |
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
|
1404 |
} |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1405 |
#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
|
1406 |
|
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1407 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1408 |
/* 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
|
1409 |
/* ****************************************** */ |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1410 |
|
6573 | 1411 |
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
|
1412 |
{ |
6449
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5875
diff
changeset
|
1413 |
/* stdlib */ |
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5875
diff
changeset
|
1414 |
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
|
1415 |
|
6449
e520244dc71e
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5875
diff
changeset
|
1416 |
/* default variables and functions */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1417 |
IConsoleCmdRegister("debug_level", ConDebugLevel); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1418 |
IConsoleCmdRegister("dump_vars", ConListDumpVariables); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1419 |
IConsoleCmdRegister("echo", ConEcho); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1420 |
IConsoleCmdRegister("echoc", ConEchoC); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1421 |
IConsoleCmdRegister("exec", ConExec); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1422 |
IConsoleCmdRegister("exit", ConExit); |
1814
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1423 |
IConsoleCmdRegister("part", ConPart); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1424 |
IConsoleCmdRegister("help", ConHelp); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1425 |
IConsoleCmdRegister("info_cmd", ConInfoCmd); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1426 |
IConsoleCmdRegister("info_var", ConInfoVar); |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
1427 |
IConsoleCmdRegister("list_ai", ConListAI); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1428 |
IConsoleCmdRegister("list_cmds", ConListCommands); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1429 |
IConsoleCmdRegister("list_vars", ConListVariables); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1430 |
IConsoleCmdRegister("list_aliases", ConListAliases); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1431 |
IConsoleCmdRegister("newgame", ConNewGame); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
1432 |
IConsoleCmdRegister("restart", ConRestart); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4286
diff
changeset
|
1433 |
IConsoleCmdRegister("getseed", ConGetSeed); |
9628
b5c2449616b5
(svn r10195) [NoAI] -Sync: with trunk r10119:10194.
rubidium
parents:
9620
diff
changeset
|
1434 |
IConsoleCmdRegister("getdate", ConGetDate); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1435 |
IConsoleCmdRegister("quit", ConExit); |
10891
5ebb6f9068d0
(svn r13442) [NoAI] -Add: added 'rescan_ai' console command. Use it to rescan the ai dir when you add AIs or libraries without needing to exit and restart openttd.
glx
parents:
10880
diff
changeset
|
1436 |
IConsoleCmdRegister("rescan_ai", ConRescanAI); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
262
diff
changeset
|
1437 |
IConsoleCmdRegister("resetengines", ConResetEngines); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1438 |
IConsoleCmdRegister("return", ConReturn); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1439 |
IConsoleCmdRegister("screenshot", ConScreenShot); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1440 |
IConsoleCmdRegister("script", ConScript); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1441 |
IConsoleCmdRegister("scrollto", ConScrollToTile); |
2026 | 1442 |
IConsoleCmdRegister("alias", ConAlias); |
1443 |
IConsoleCmdRegister("load", ConLoad); |
|
2415
1cee5796b5ef
(svn r2941) -Feature: Implement the console command rm to remove savegames
tron
parents:
2373
diff
changeset
|
1444 |
IConsoleCmdRegister("rm", ConRemove); |
2026 | 1445 |
IConsoleCmdRegister("save", ConSave); |
5758
c508f77aedd7
(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:
5726
diff
changeset
|
1446 |
IConsoleCmdRegister("saveconfig", ConSaveConfig); |
9763
d6098707195b
(svn r12251) [NoAI] -Add: 2 console commands: 'list_ai' and 'start_ai', listing or starting an AI
truebrain
parents:
9732
diff
changeset
|
1447 |
IConsoleCmdRegister("start_ai", ConStartAI); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1448 |
IConsoleCmdRegister("ls", ConListFiles); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1449 |
IConsoleCmdRegister("cd", ConChangeDirectory); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1450 |
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory); |
1827
b8a0edd6eb89
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
1451 |
IConsoleCmdRegister("clear", ConClearBuffer); |
4600
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4585
diff
changeset
|
1452 |
IConsoleCmdRegister("patch", ConPatch); |
9574 | 1453 |
IConsoleCmdRegister("list_patches", ConListPatches); |
10829 | 1454 |
IConsoleCmdRegister("gamelog", ConGamelogPrint); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1455 |
|
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1456 |
IConsoleAliasRegister("dir", "ls"); |
2419
a2572881fd7c
(svn r2945) Add 'del' alias to rm console command
Darkvater
parents:
2415
diff
changeset
|
1457 |
IConsoleAliasRegister("del", "rm %+"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1458 |
IConsoleAliasRegister("newmap", "newgame"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1459 |
IConsoleAliasRegister("new_map", "newgame"); |
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1460 |
IConsoleAliasRegister("new_game", "newgame"); |
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1461 |
|
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
887
diff
changeset
|
1462 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1463 |
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 | 1464 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1465 |
/* networking variables and functions */ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1466 |
#ifdef ENABLE_NETWORK |
2880
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1467 |
/* Network hooks; only active in network */ |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1468 |
IConsoleCmdHookAdd ("resetengines", ICONSOLE_HOOK_ACCESS, ConHookNoNetwork); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1469 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1470 |
/*** Networking commands ***/ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1471 |
IConsoleCmdRegister("say", ConSay); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1472 |
IConsoleCmdHookAdd("say", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
3818
df92fcdaf7ac
(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
|
1473 |
IConsoleCmdRegister("players", ConPlayers); |
df92fcdaf7ac
(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
|
1474 |
IConsoleCmdHookAdd("players", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1475 |
IConsoleCmdRegister("say_player", ConSayPlayer); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1476 |
IConsoleCmdHookAdd("say_player", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1477 |
IConsoleCmdRegister("say_client", ConSayClient); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1478 |
IConsoleCmdHookAdd("say_client", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
2880
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1479 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1480 |
IConsoleCmdRegister("connect", ConNetworkConnect); |
2880
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1481 |
IConsoleCmdHookAdd("connect", ICONSOLE_HOOK_ACCESS, ConHookClientOnly); |
1814
81a2b0bd33ea
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
Darkvater
parents:
1805
diff
changeset
|
1482 |
IConsoleAliasRegister("join", "connect %A"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1483 |
IConsoleCmdRegister("clients", ConNetworkClients); |
1761
00d296fcdc76
(svn r2265) - Fix: some more useful help messages and consistent errors for failed console-cmds. Make command 'clients' only available in network mode
Darkvater
parents:
1755
diff
changeset
|
1484 |
IConsoleCmdHookAdd("clients", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1485 |
IConsoleCmdRegister("status", ConStatus); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1486 |
IConsoleCmdHookAdd("status", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
2880
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1487 |
IConsoleCmdRegister("server_info", ConServerInfo); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1488 |
IConsoleCmdHookAdd("server_info", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1489 |
IConsoleAliasRegister("info", "server_info"); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1490 |
IConsoleCmdRegister("rcon", ConRcon); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1491 |
IConsoleCmdHookAdd("rcon", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
841
8f0a68c6f43b
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
785
diff
changeset
|
1492 |
|
2880
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1493 |
IConsoleCmdRegister("reset_company", ConResetCompany); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1494 |
IConsoleCmdHookAdd("reset_company", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1495 |
IConsoleAliasRegister("clean_company", "reset_company %A"); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1496 |
IConsoleCmdRegister("kick", ConKick); |
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1497 |
IConsoleCmdHookAdd("kick", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1498 |
IConsoleCmdRegister("ban", ConBan); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1499 |
IConsoleCmdHookAdd("ban", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1500 |
IConsoleCmdRegister("unban", ConUnBan); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1501 |
IConsoleCmdHookAdd("unban", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1502 |
IConsoleCmdRegister("banlist", ConBanList); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1503 |
IConsoleCmdHookAdd("banlist", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
2880
dd0bf065fd07
(svn r3428) - Feature: server_info was left out previous commit. Move some commands about a bit for better logical placement
Darkvater
parents:
2879
diff
changeset
|
1504 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1505 |
IConsoleCmdRegister("pause", ConPauseGame); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1506 |
IConsoleCmdHookAdd("pause", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1507 |
IConsoleCmdRegister("unpause", ConUnPauseGame); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1508 |
IConsoleCmdHookAdd("unpause", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); |
688
bcaa5256253d
(svn r1129) -Add: [Network] Added 'reset_company <company-id>'. If a company is
truelight
parents:
678
diff
changeset
|
1509 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1510 |
/*** Networking variables ***/ |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1511 |
IConsoleVarStringRegister("company_pw", NULL, 0, "Set a password for your company, so no one without the correct password can join. Use '*' to clear the password"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1512 |
IConsoleVarHookAdd("company_pw", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1513 |
IConsoleVarProcAdd("company_pw", NetworkChangeCompanyPassword); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1514 |
IConsoleAliasRegister("company_password", "company_pw %+"); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1602
diff
changeset
|
1515 |
|
10829 | 1516 |
IConsoleAliasRegister("net_frame_freq", "patch frame_freq %+"); |
1517 |
IConsoleAliasRegister("net_sync_freq", "patch sync_freq %+"); |
|
1518 |
IConsoleAliasRegister("server_pw", "patch server_password %+"); |
|
1519 |
IConsoleAliasRegister("server_password", "patch server_password %+"); |
|
1520 |
IConsoleAliasRegister("rcon_pw", "patch rcon_password %+"); |
|
1521 |
IConsoleAliasRegister("rcon_password", "patch rcon_password %+"); |
|
1522 |
IConsoleAliasRegister("name", "patch player_name %+"); |
|
1523 |
IConsoleAliasRegister("server_name", "patch server_name %+"); |
|
1524 |
IConsoleAliasRegister("server_port", "patch server_port %+"); |
|
1525 |
IConsoleAliasRegister("server_ip", "patch server_bind_ip %+"); |
|
1526 |
IConsoleAliasRegister("server_bind_ip", "patch server_bind_ip %+"); |
|
1527 |
IConsoleAliasRegister("server_ip_bind", "patch server_bind_ip %+"); |
|
1528 |
IConsoleAliasRegister("server_bind", "patch server_bind_ip %+"); |
|
1529 |
IConsoleAliasRegister("server_advertise", "patch server_advertise %+"); |
|
1530 |
IConsoleAliasRegister("max_clients", "patch max_clients %+"); |
|
1531 |
IConsoleAliasRegister("max_companies", "patch max_companies %+"); |
|
1532 |
IConsoleAliasRegister("max_spectators", "patch max_spectators %+"); |
|
1533 |
IConsoleAliasRegister("max_join_time", "patch max_join_time %+"); |
|
1534 |
IConsoleAliasRegister("pause_on_join", "patch pause_on_join %+"); |
|
1535 |
IConsoleAliasRegister("autoclean_companies", "patch autoclean_companies %+"); |
|
1536 |
IConsoleAliasRegister("autoclean_protected", "patch autoclean_protected %+"); |
|
1537 |
IConsoleAliasRegister("autoclean_unprotected", "patch autoclean_unprotected %+"); |
|
1538 |
IConsoleAliasRegister("restart_game_year", "patch restart_game_year %+"); |
|
1539 |
IConsoleAliasRegister("min_players", "patch min_players %+"); |
|
1540 |
IConsoleAliasRegister("reload_cfg", "patch reload_cfg %+"); |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
301
diff
changeset
|
1541 |
#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
|
1542 |
|
554 | 1543 |
// debugging stuff |
1544 |
#ifdef _DEBUG |
|
1545 |
IConsoleDebugLibRegister(); |
|
1546 |
#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
|
1547 |
} |