author | peter1138 |
Tue, 23 May 2006 19:36:50 +0000 | |
changeset 3893 | ced26054ee00 |
parent 3559 | 1b62ecdf13cf |
child 4077 | d4d440dd8925 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1889
diff
changeset
|
4 |
#include "openttd.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
301
diff
changeset
|
5 |
#include "table/strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2145
diff
changeset
|
6 |
#include "functions.h" |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
7 |
#include "window.h" |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
8 |
#include "gui.h" |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
9 |
#include "gfx.h" |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
10 |
#include "player.h" |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
11 |
#include "variables.h" |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
12 |
#include "string.h" |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
13 |
#include <stdarg.h> |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
14 |
#include <string.h> |
274 | 15 |
#include "console.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
16 |
#include "network.h" |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
17 |
#include "network_data.h" |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
18 |
#include "network_server.h" |
274 | 19 |
|
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
20 |
#define ICON_BUFFER 79 |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
21 |
#define ICON_HISTORY_SIZE 20 |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
22 |
#define ICON_LINE_HEIGHT 12 |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
23 |
#define ICON_RIGHT_BORDERWIDTH 10 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
24 |
#define ICON_BOTTOM_BORDERWIDTH 12 |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
25 |
#define ICON_MAX_ALIAS_LINES 40 |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
26 |
#define ICON_TOKEN_COUNT 20 |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
27 |
|
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
28 |
// ** main console ** // |
1397
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1390
diff
changeset
|
29 |
static Window *_iconsole_win; // Pointer to console window |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
30 |
static bool _iconsole_inited; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
31 |
static char *_iconsole_buffer[ICON_BUFFER + 1]; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
32 |
static uint16 _iconsole_cbuffer[ICON_BUFFER + 1]; |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
33 |
static Textbuf _iconsole_cmdline; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
34 |
static byte _iconsole_scroll; |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
35 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
36 |
// ** stdlib ** // |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
37 |
byte _stdlib_developer = 1; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
38 |
bool _stdlib_con_developer = false; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
39 |
FILE *_iconsole_output_file; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
40 |
|
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
41 |
// ** main console cmd buffer |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
42 |
static char *_iconsole_history[ICON_HISTORY_SIZE]; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
43 |
static byte _iconsole_historypos; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
44 |
|
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
45 |
/* *************** */ |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
46 |
/* end of header */ |
274 | 47 |
/* *************** */ |
48 |
||
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
49 |
static void IConsoleClearCommand(void) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
50 |
{ |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
51 |
memset(_iconsole_cmdline.buf, 0, ICON_CMDLN_SIZE); |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
52 |
_iconsole_cmdline.length = 0; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
53 |
_iconsole_cmdline.width = 0; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
54 |
_iconsole_cmdline.caretpos = 0; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
55 |
_iconsole_cmdline.caretxoffs = 0; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
56 |
SetWindowDirty(_iconsole_win); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
57 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
58 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
59 |
static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
60 |
|
2817 | 61 |
|
62 |
static void IConsoleHistoryAdd(const char* cmd); |
|
63 |
static void IConsoleHistoryNavigate(int direction); |
|
64 |
||
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
65 |
// ** console window ** // |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
66 |
static void IConsoleWndProc(Window* w, WindowEvent* e) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
67 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
68 |
switch (e->event) { |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
69 |
case WE_PAINT: { |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
70 |
int i = _iconsole_scroll; |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
71 |
int max = (w->height / ICON_LINE_HEIGHT) - 1; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
72 |
int delta = 0; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
73 |
GfxFillRect(w->left, w->top, w->width, w->height - 1, 0); |
986
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
74 |
while ((i > 0) && (i > _iconsole_scroll - max) && (_iconsole_buffer[i] != NULL)) { |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
75 |
DoDrawString(_iconsole_buffer[i], 5, |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
76 |
w->height - (_iconsole_scroll + 2 - i) * ICON_LINE_HEIGHT, _iconsole_cbuffer[i]); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
77 |
i--; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
78 |
} |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
79 |
/* If the text is longer than the window, don't show the starting ']' */ |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
80 |
delta = w->width - 10 - _iconsole_cmdline.width - ICON_RIGHT_BORDERWIDTH; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
81 |
if (delta > 0) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
82 |
DoDrawString("]", 5, w->height - ICON_LINE_HEIGHT, _icolour_cmd); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
83 |
delta = 0; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
84 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
85 |
|
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
86 |
DoDrawString(_iconsole_cmdline.buf, 10 + delta, w->height - ICON_LINE_HEIGHT, _icolour_cmd); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
87 |
|
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
88 |
if (_iconsole_cmdline.caret) |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
89 |
DoDrawString("_", 10 + delta + _iconsole_cmdline.caretxoffs, w->height - ICON_LINE_HEIGHT, 12); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
90 |
break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
91 |
} |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
92 |
case WE_MOUSELOOP: |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
93 |
if (HandleCaret(&_iconsole_cmdline)) |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
94 |
SetWindowDirty(w); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
95 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
96 |
case WE_DESTROY: |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
97 |
_iconsole_win = NULL; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
98 |
_iconsole_mode = ICONSOLE_CLOSED; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
99 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
100 |
case WE_KEYPRESS: |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
101 |
e->keypress.cont = false; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
102 |
switch (e->keypress.keycode) { |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
103 |
case WKC_UP: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
104 |
IConsoleHistoryNavigate(+1); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
105 |
SetWindowDirty(w); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
106 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
107 |
case WKC_DOWN: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
108 |
IConsoleHistoryNavigate(-1); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
109 |
SetWindowDirty(w); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
110 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
111 |
case WKC_SHIFT | WKC_PAGEUP: |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
112 |
if (_iconsole_scroll - (w->height / ICON_LINE_HEIGHT) - 1 < 0) |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
113 |
_iconsole_scroll = 0; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
114 |
else |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
115 |
_iconsole_scroll -= (w->height / ICON_LINE_HEIGHT) - 1; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
116 |
SetWindowDirty(w); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
117 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
118 |
case WKC_SHIFT | WKC_PAGEDOWN: |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
119 |
if (_iconsole_scroll + (w->height / ICON_LINE_HEIGHT) - 1 > ICON_BUFFER) |
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
120 |
_iconsole_scroll = ICON_BUFFER; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
121 |
else |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
122 |
_iconsole_scroll += (w->height / ICON_LINE_HEIGHT) - 1; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
123 |
SetWindowDirty(w); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
124 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
125 |
case WKC_SHIFT | WKC_UP: |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
126 |
if (_iconsole_scroll <= 0) |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
127 |
_iconsole_scroll = 0; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
128 |
else |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
129 |
--_iconsole_scroll; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
130 |
SetWindowDirty(w); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
131 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
132 |
case WKC_SHIFT | WKC_DOWN: |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
133 |
if (_iconsole_scroll >= ICON_BUFFER) |
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
134 |
_iconsole_scroll = ICON_BUFFER; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
135 |
else |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
136 |
++_iconsole_scroll; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
137 |
SetWindowDirty(w); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
138 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
139 |
case WKC_BACKQUOTE: |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
140 |
IConsoleSwitch(); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
141 |
break; |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
142 |
case WKC_RETURN: case WKC_NUM_ENTER: |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
143 |
IConsolePrintF(_icolour_cmd, "] %s", _iconsole_cmdline.buf); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
144 |
IConsoleHistoryAdd(_iconsole_cmdline.buf); |
672
9089c74ba6c9
(svn r1110) -Fix: Empty console commands were executed and returned error message (sign_de for GeniusDex)
darkvater
parents:
659
diff
changeset
|
145 |
|
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
146 |
IConsoleCmdExec(_iconsole_cmdline.buf); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
147 |
IConsoleClearCommand(); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
148 |
break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
149 |
case WKC_CTRL | WKC_RETURN: |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
150 |
_iconsole_mode = (_iconsole_mode == ICONSOLE_FULL) ? ICONSOLE_OPENED : ICONSOLE_FULL; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
151 |
IConsoleResize(); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
152 |
MarkWholeScreenDirty(); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
153 |
break; |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
154 |
case (WKC_CTRL | 'V'): |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
155 |
if (InsertTextBufferClipboard(&_iconsole_cmdline)) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
156 |
IConsoleResetHistoryPos(); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
157 |
SetWindowDirty(w); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
158 |
} |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
159 |
break; |
1879
b037d07154c6
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1866
diff
changeset
|
160 |
case (WKC_CTRL | 'L'): |
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
161 |
IConsoleCmdExec("clear"); |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
162 |
break; |
1879
b037d07154c6
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1866
diff
changeset
|
163 |
case (WKC_CTRL | 'U'): |
b037d07154c6
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1866
diff
changeset
|
164 |
DeleteTextBufferAll(&_iconsole_cmdline); |
b037d07154c6
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1866
diff
changeset
|
165 |
SetWindowDirty(w); |
b037d07154c6
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1866
diff
changeset
|
166 |
break; |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
167 |
case WKC_BACKSPACE: case WKC_DELETE: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
168 |
if (DeleteTextBufferChar(&_iconsole_cmdline, e->keypress.keycode)) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
169 |
IConsoleResetHistoryPos(); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
170 |
SetWindowDirty(w); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
171 |
} |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
172 |
break; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
173 |
case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
174 |
if (MoveTextBufferPos(&_iconsole_cmdline, e->keypress.keycode)) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
175 |
IConsoleResetHistoryPos(); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
176 |
SetWindowDirty(w); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
177 |
} |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
178 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
179 |
default: |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
180 |
if (IsValidAsciiChar(e->keypress.ascii)) { |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
181 |
_iconsole_scroll = ICON_BUFFER; |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
182 |
InsertTextBufferChar(&_iconsole_cmdline, e->keypress.ascii); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
183 |
IConsoleResetHistoryPos(); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
184 |
SetWindowDirty(w); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
185 |
} else |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
186 |
e->keypress.cont = true; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
187 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
188 |
} |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
189 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
190 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
191 |
|
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
192 |
static const Widget _iconsole_window_widgets[] = { |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
193 |
{WIDGETS_END} |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
194 |
}; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
195 |
|
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
196 |
static const WindowDesc _iconsole_window_desc = { |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
197 |
0, 0, 2, 2, |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
198 |
WC_CONSOLE, 0, |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
199 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
200 |
_iconsole_window_widgets, |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
201 |
IConsoleWndProc, |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
202 |
}; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
203 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
204 |
void IConsoleInit(void) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
205 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
206 |
extern const char _openttd_revision[]; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
207 |
_iconsole_output_file = NULL; |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
208 |
_icolour_def = 1; |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
209 |
_icolour_err = 3; |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
210 |
_icolour_warn = 13; |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
211 |
_icolour_dbg = 5; |
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
212 |
_icolour_cmd = 2; |
301
3b69e7025af9
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
213 |
_iconsole_scroll = ICON_BUFFER; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
214 |
_iconsole_historypos = ICON_HISTORY_SIZE - 1; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
215 |
_iconsole_inited = true; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
216 |
_iconsole_mode = ICONSOLE_CLOSED; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
217 |
_iconsole_win = NULL; |
1243
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
218 |
|
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
219 |
#ifdef ENABLE_NETWORK /* Initialize network only variables */ |
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
220 |
_redirect_console_to_client = 0; |
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
221 |
#endif |
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
222 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
223 |
memset(_iconsole_history, 0, sizeof(_iconsole_history)); |
1243
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
224 |
memset(_iconsole_buffer, 0, sizeof(_iconsole_buffer)); |
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
225 |
memset(_iconsole_cbuffer, 0, sizeof(_iconsole_cbuffer)); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
226 |
_iconsole_cmdline.buf = calloc(ICON_CMDLN_SIZE, sizeof(*_iconsole_cmdline.buf)); // create buffer and zero it |
3458
26360c9a3743
(svn r4301) - Fix: the maxlength parameter of Textbuf is supposed to be the size of the buffer (so length of string + '\0'), but in the code it was a mix of both. It didn't cause any problems though, only an occasionaly one-less character than allowed. (thanks Tron for noticing)
Darkvater
parents:
3017
diff
changeset
|
227 |
_iconsole_cmdline.maxlength = ICON_CMDLN_SIZE; |
1243
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
228 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
229 |
IConsolePrintF(13, "OpenTTD Game Console Revision 7 - %s", _openttd_revision); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
230 |
IConsolePrint(12, "------------------------------------"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
231 |
IConsolePrint(12, "use \"help\" for more information"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
232 |
IConsolePrint(12, ""); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
233 |
IConsoleStdLibRegister(); |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
234 |
IConsoleClearCommand(); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
235 |
IConsoleHistoryAdd(""); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
236 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
237 |
|
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
238 |
void IConsoleClearBuffer(void) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
239 |
{ |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
240 |
uint i; |
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
241 |
for (i = 0; i <= ICON_BUFFER; i++) { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
242 |
free(_iconsole_buffer[i]); |
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
243 |
_iconsole_buffer[i] = NULL; |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
244 |
} |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
245 |
} |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
246 |
|
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
247 |
static void IConsoleClear(void) |
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
248 |
{ |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
249 |
free(_iconsole_cmdline.buf); |
1827
94529cbdec60
(svn r2332) - Feature: Add 'clear' command and CTRL+L to empty the console window
Darkvater
parents:
1819
diff
changeset
|
250 |
IConsoleClearBuffer(); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
251 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
252 |
|
1046
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
253 |
static void IConsoleWriteToLogFile(const char* string) |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
254 |
{ |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
255 |
if (_iconsole_output_file != NULL) { |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
256 |
// if there is an console output file ... also print it there |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
257 |
fwrite(string, strlen(string), 1, _iconsole_output_file); |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
258 |
fwrite("\n", 1, 1, _iconsole_output_file); |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
259 |
} |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
260 |
} |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
261 |
|
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
262 |
bool CloseConsoleLogIfActive(void) |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
263 |
{ |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
264 |
if (_iconsole_output_file != NULL) { |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
265 |
IConsolePrintF(_icolour_def, "file output complete"); |
1046
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
266 |
fclose(_iconsole_output_file); |
1127
be5e8f11e2fd
(svn r1628) -Fix: [1107893] script command; log file pointer was not reset to NULL after logging was closed
darkvater
parents:
1109
diff
changeset
|
267 |
_iconsole_output_file = NULL; |
1046
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
268 |
return true; |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
269 |
} |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
270 |
|
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
271 |
return false; |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
272 |
} |
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
273 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
274 |
void IConsoleFree(void) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
275 |
{ |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
276 |
_iconsole_inited = false; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
277 |
IConsoleClear(); |
1046
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
278 |
CloseConsoleLogIfActive(); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
279 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
280 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
281 |
void IConsoleResize(void) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
282 |
{ |
986
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
283 |
_iconsole_win = FindWindowById(WC_CONSOLE, 0); |
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
284 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
285 |
switch (_iconsole_mode) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
286 |
case ICONSOLE_OPENED: |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
287 |
_iconsole_win->height = _screen.height / 3; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
288 |
_iconsole_win->width = _screen.width; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
289 |
break; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
290 |
case ICONSOLE_FULL: |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
291 |
_iconsole_win->height = _screen.height - ICON_BOTTOM_BORDERWIDTH; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
292 |
_iconsole_win->width = _screen.width; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
293 |
break; |
1755
ff0ff67f708d
(svn r2259) - Fix (regression): remove a warning and make the help for variables behave the same as for commands
Darkvater
parents:
1754
diff
changeset
|
294 |
default: break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
295 |
} |
986
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
296 |
|
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
297 |
MarkWholeScreenDirty(); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
298 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
299 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
300 |
void IConsoleSwitch(void) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
301 |
{ |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
302 |
switch (_iconsole_mode) { |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
303 |
case ICONSOLE_CLOSED: |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
304 |
_iconsole_win = AllocateWindowDesc(&_iconsole_window_desc); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
305 |
_iconsole_win->height = _screen.height / 3; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
306 |
_iconsole_win->width = _screen.width; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
307 |
_iconsole_mode = ICONSOLE_OPENED; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
308 |
SETBIT(_no_scroll, SCROLL_CON); // override cursor arrows; the gamefield will not scroll |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
309 |
break; |
1397
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1390
diff
changeset
|
310 |
case ICONSOLE_OPENED: case ICONSOLE_FULL: |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
311 |
DeleteWindowById(WC_CONSOLE, 0); |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
312 |
_iconsole_win = NULL; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
313 |
_iconsole_mode = ICONSOLE_CLOSED; |
1397
fa8539dcab46
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1390
diff
changeset
|
314 |
CLRBIT(_no_scroll, SCROLL_CON); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
315 |
break; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
316 |
} |
986
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
317 |
|
023cc6cf2bd9
(svn r1484) -Fix: [1099197] scrolling through console sometimes crashed the whole game. Also added MarkWholeScreenDirty() to have redrawing of console resize instant (sign_de)
darkvater
parents:
959
diff
changeset
|
318 |
MarkWholeScreenDirty(); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
319 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
320 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
321 |
void IConsoleClose(void) {if (_iconsole_mode == ICONSOLE_OPENED) IConsoleSwitch();} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
322 |
void IConsoleOpen(void) {if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch();} |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
323 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
324 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
325 |
* Add the entered line into the history so you can look it back |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
326 |
* scroll, etc. Put it to the beginning as it is the latest text |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
327 |
* @param cmd Text to be entered into the 'history' |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
328 |
*/ |
2817 | 329 |
static void IConsoleHistoryAdd(const char* cmd) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
330 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
331 |
free(_iconsole_history[ICON_HISTORY_SIZE - 1]); |
141
29cc31c87ede
(svn r142) -Feature development: [1016299] Console Rev #3 allowes variable references and has a new commandline buffer (sign_de)
darkvater
parents:
136
diff
changeset
|
332 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
333 |
memmove(&_iconsole_history[1], &_iconsole_history[0], sizeof(_iconsole_history[0]) * (ICON_HISTORY_SIZE - 1)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
334 |
_iconsole_history[0] = strdup(cmd); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
335 |
IConsoleResetHistoryPos(); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
336 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
337 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
338 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
339 |
* Navigate Up/Down in the history of typed commands |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
340 |
* @param direction Go further back in history (+1), go to recently typed commands (-1) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
341 |
*/ |
2817 | 342 |
static void IConsoleHistoryNavigate(int direction) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
343 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
344 |
int i = _iconsole_historypos + direction; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
345 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
346 |
// watch out for overflows, just wrap around |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
347 |
if (i < 0) i = ICON_HISTORY_SIZE - 1; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
348 |
if (i >= ICON_HISTORY_SIZE) i = 0; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
349 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
350 |
if (direction > 0) |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
351 |
if (_iconsole_history[i] == NULL) i = 0; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
352 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
353 |
if (direction < 0) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
354 |
while (i > 0 && _iconsole_history[i] == NULL) i--; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
355 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
356 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
357 |
_iconsole_historypos = i; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
358 |
IConsoleClearCommand(); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
359 |
// copy history to 'command prompt / bash' |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
360 |
assert(_iconsole_history[i] != NULL && IS_INT_INSIDE(i, 0, ICON_HISTORY_SIZE)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
361 |
ttd_strlcpy(_iconsole_cmdline.buf, _iconsole_history[i], _iconsole_cmdline.maxlength); |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
362 |
UpdateTextBufferSize(&_iconsole_cmdline); |
141
29cc31c87ede
(svn r142) -Feature development: [1016299] Console Rev #3 allowes variable references and has a new commandline buffer (sign_de)
darkvater
parents:
136
diff
changeset
|
363 |
} |
29cc31c87ede
(svn r142) -Feature development: [1016299] Console Rev #3 allowes variable references and has a new commandline buffer (sign_de)
darkvater
parents:
136
diff
changeset
|
364 |
|
1588
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
365 |
/** |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
366 |
* Handle the printing of text entered into the console or redirected there |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
367 |
* by any other means. Text can be redirected to other players in a network game |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
368 |
* as well as to a logfile. If the network server is a dedicated server, all activities |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
369 |
* are also logged. All lines to print are added to a temporary buffer which can be |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
370 |
* used as a history to print them onscreen |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
371 |
* @param color_code the colour of the command. Red in case of errors, etc. |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
372 |
* @param string the message entered or output on the console (notice, error, etc.) |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
373 |
*/ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
374 |
void IConsolePrint(uint16 color_code, const char* string) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
375 |
{ |
1243
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
376 |
#ifdef ENABLE_NETWORK |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
377 |
if (_redirect_console_to_client != 0) { |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
378 |
/* Redirect the string to the client */ |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
379 |
SEND_COMMAND(PACKET_SERVER_RCON)(NetworkFindClientStateFromIndex(_redirect_console_to_client), color_code, string); |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
380 |
return; |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
381 |
} |
1243
cb9e17e38c00
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
382 |
#endif |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
383 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
384 |
if (_network_dedicated) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
385 |
printf("%s\n", string); |
1046
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
386 |
IConsoleWriteToLogFile(string); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
387 |
return; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
388 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
389 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
390 |
if (!_iconsole_inited) return; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
391 |
|
1588
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
392 |
/* move up all the strings in the buffer one place and do the same for colour |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
393 |
* to accomodate for the new command/message */ |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
394 |
free(_iconsole_buffer[0]); |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
395 |
memmove(&_iconsole_buffer[0], &_iconsole_buffer[1], sizeof(_iconsole_buffer[0]) * ICON_BUFFER); |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
396 |
_iconsole_buffer[ICON_BUFFER] = strdup(string); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
397 |
|
3559
1b62ecdf13cf
(svn r4434) - Codechange: use str_validate for the console as well instead of custom function doing the same.
Darkvater
parents:
3458
diff
changeset
|
398 |
str_validate(_iconsole_buffer[ICON_BUFFER]); |
1588
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
399 |
|
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
400 |
memmove(&_iconsole_cbuffer[0], &_iconsole_cbuffer[1], sizeof(_iconsole_cbuffer[0]) * ICON_BUFFER); |
7f0385ebdcfe
(svn r2092) - Fix: old commands/lines in the console (history) did not show when they used 'special' characters like ??, etc. Diff approved by the code-police.
Darkvater
parents:
1483
diff
changeset
|
401 |
_iconsole_cbuffer[ICON_BUFFER] = color_code; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
402 |
|
1046
f1d46abf7d35
(svn r1547) -Feature: windows dedicated (if anyone would run that, but ok), is now functioning correctly. There is no other way but to create a new thread, but that's only MS braindeadness
darkvater
parents:
1026
diff
changeset
|
403 |
IConsoleWriteToLogFile(string); |
650
d0148e8dd551
(svn r1083) Fix: the console "script" command saves all output to the textfile, not only printf stuff (sign_de)
dominik
parents:
644
diff
changeset
|
404 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
405 |
if (_iconsole_win != NULL) SetWindowDirty(_iconsole_win); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
406 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
407 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
408 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
409 |
* Handle the printing of text entered into the console or redirected there |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
410 |
* by any other means. Uses printf() style format, for more information look |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
411 |
* at @IConsolePrint() |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
412 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
413 |
void CDECL IConsolePrintF(uint16 color_code, const char *s, ...) |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
414 |
{ |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
415 |
va_list va; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
416 |
char buf[ICON_MAX_STREAMSIZE]; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
417 |
|
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
418 |
va_start(va, s); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
419 |
vsnprintf(buf, sizeof(buf), s, va); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
420 |
va_end(va); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
421 |
|
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
422 |
IConsolePrint(color_code, buf); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
423 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
424 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
425 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
426 |
* It is possible to print debugging information to the console, |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
427 |
* which is achieved by using this function. Can only be used by |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
428 |
* @debug() in debug.c. You need at least a level 2 (developer) for debugging |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
429 |
* messages to show up |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
430 |
*/ |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
431 |
void IConsoleDebug(const char* string) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
432 |
{ |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
433 |
if (_stdlib_developer > 1) |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
434 |
IConsolePrintF(_icolour_dbg, "dbg: %s", string); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
435 |
} |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
436 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
437 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
438 |
* It is possible to print warnings to the console. These are mostly |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
439 |
* errors or mishaps, but non-fatal. You need at least a level 1 (developer) for |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
440 |
* debugging messages to show up |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
441 |
*/ |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
442 |
void IConsoleWarning(const char* string) |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
443 |
{ |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
444 |
if (_stdlib_developer > 0) |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
445 |
IConsolePrintF(_icolour_warn, "WARNING: %s", string); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
446 |
} |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
447 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
448 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
449 |
* It is possible to print error information to the console. This can include |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
450 |
* game errors, or errors in general you would want the user to notice |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
451 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
452 |
void IConsoleError(const char* string) |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
453 |
{ |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
454 |
IConsolePrintF(_icolour_err, "ERROR: %s", string); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
455 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
456 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
457 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
458 |
* Change a string into its number representation. Supports |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
459 |
* decimal and hexadecimal numbers as well as 'on'/'off' 'true'/'false' |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
460 |
* @param *value the variable a successfull conversion will be put in |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
461 |
* @param *arg the string to be converted |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
462 |
* @return Return true on success or false on failure |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
463 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
464 |
bool GetArgumentInteger(uint32 *value, const char *arg) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
465 |
{ |
1773
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
466 |
char *endptr; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
467 |
|
1773
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
468 |
if (strcmp(arg, "on") == 0 || strcmp(arg, "true") == 0) { |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
469 |
*value = 1; |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
470 |
return true; |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
471 |
} |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
472 |
if (strcmp(arg, "off") == 0 || strcmp(arg, "false") == 0) { |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
473 |
*value = 0; |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
474 |
return true; |
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
475 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
476 |
|
1773
40297275e218
(svn r2277) - Codechange: change sscanf() into stroul() Which Does The Right Thing tm. Thanks tron
Darkvater
parents:
1771
diff
changeset
|
477 |
*value = strtoul(arg, &endptr, 0); |
1899
81214598ab45
(svn r2405) Simplify a few '? true : false' and '? false : true', especially the latter is confusing
tron
parents:
1891
diff
changeset
|
478 |
return arg != endptr; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
479 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
480 |
|
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
481 |
// * ************************* * // |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
482 |
// * hooking code * // |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
483 |
// * ************************* * // |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
484 |
/** |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
485 |
* General internal hooking code that is the same for both commands and variables |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
486 |
* @param hooks @IConsoleHooks structure that will be set according to |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
487 |
* @param type type access trigger |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
488 |
* @param proc function called when the hook criteria is met |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
489 |
*/ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
490 |
static void IConsoleHookAdd(IConsoleHooks *hooks, IConsoleHookTypes type, IConsoleHook *proc) |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
491 |
{ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
492 |
if (hooks == NULL || proc == NULL) return; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
493 |
|
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
494 |
switch (type) { |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
495 |
case ICONSOLE_HOOK_ACCESS: |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
496 |
hooks->access = proc; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
497 |
break; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
498 |
case ICONSOLE_HOOK_PRE_ACTION: |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
499 |
hooks->pre = proc; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
500 |
break; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
501 |
case ICONSOLE_HOOK_POST_ACTION: |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
502 |
hooks->post = proc; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
503 |
break; |
1889
91c51eadc8d9
(svn r2395) - Fix: oops, forgot a break in a console switch.
Darkvater
parents:
1879
diff
changeset
|
504 |
default: NOT_REACHED(); |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
505 |
} |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
506 |
} |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
507 |
|
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
508 |
/** |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
509 |
* Handle any special hook triggers. If the hook type is met check if |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
510 |
* there is a function associated with that and if so, execute it |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
511 |
* @param hooks @IConsoleHooks structure that will be checked |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
512 |
* @param type type of hook, trigger that needs to be activated |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
513 |
* @return true on a successfull execution of the hook command or if there |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
514 |
* is no hook/trigger present at all. False otherwise |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
515 |
*/ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
516 |
static bool IConsoleHookHandle(const IConsoleHooks *hooks, IConsoleHookTypes type) |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
517 |
{ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
518 |
IConsoleHook *proc = NULL; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
519 |
if (hooks == NULL) return false; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
520 |
|
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
521 |
switch (type) { |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
522 |
case ICONSOLE_HOOK_ACCESS: |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
523 |
proc = hooks->access; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
524 |
break; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
525 |
case ICONSOLE_HOOK_PRE_ACTION: |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
526 |
proc = hooks->pre; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
527 |
break; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
528 |
case ICONSOLE_HOOK_POST_ACTION: |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
529 |
proc = hooks->post; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
530 |
break; |
1889
91c51eadc8d9
(svn r2395) - Fix: oops, forgot a break in a console switch.
Darkvater
parents:
1879
diff
changeset
|
531 |
default: NOT_REACHED(); |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
532 |
} |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
533 |
|
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
534 |
return (proc == NULL) ? true : proc(); |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
535 |
} |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
536 |
|
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
537 |
/** |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
538 |
* Add a hook to a command that will be triggered at certain points |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
539 |
* @param name name of the command that the hook is added to |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
540 |
* @param type type of hook that is added (ACCESS, BEFORE and AFTER change) |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
541 |
* @param proc function called when the hook criteria is met |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
542 |
*/ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
543 |
void IConsoleCmdHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc) |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
544 |
{ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
545 |
IConsoleCmd *cmd = IConsoleCmdGet(name); |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
546 |
if (cmd == NULL) return; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
547 |
IConsoleHookAdd(&cmd->hook, type, proc); |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
548 |
} |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
549 |
|
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
550 |
/** |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
551 |
* Add a hook to a variable that will be triggered at certain points |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
552 |
* @param name name of the variable that the hook is added to |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
553 |
* @param type type of hook that is added (ACCESS, BEFORE and AFTER change) |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
554 |
* @param proc function called when the hook criteria is met |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
555 |
*/ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
556 |
void IConsoleVarHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc) |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
557 |
{ |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
558 |
IConsoleVar *var = IConsoleVarGet(name); |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
559 |
if (var == NULL) return; |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
560 |
IConsoleHookAdd(&var->hook, type, proc); |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
561 |
} |
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
562 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
563 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
564 |
* Perhaps ugly macro, but this saves us the trouble of writing the same function |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
565 |
* three types, just with different variables. Yes, templates would be handy. It was |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
566 |
* either this define or an even more ugly void* magic function |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
567 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
568 |
#define IConsoleAddSorted(_base, item_new, IConsoleType, type) \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
569 |
{ \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
570 |
IConsoleType *item, *item_before; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
571 |
/* first command */ \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
572 |
if (_base == NULL) { \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
573 |
_base = item_new; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
574 |
return; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
575 |
} \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
576 |
\ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
577 |
item_before = NULL; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
578 |
item = _base; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
579 |
\ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
580 |
/* BEGIN - Alphabetically insert the commands into the linked list */ \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
581 |
while (item != NULL) { \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
582 |
int i = strcmp(item->name, item_new->name); \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
583 |
if (i == 0) { \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
584 |
IConsoleError(type " with this name already exists; insertion aborted"); \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
585 |
free(item_new); \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
586 |
return; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
587 |
} \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
588 |
\ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
589 |
if (i > 0) break; /* insert at this position */ \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
590 |
\ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
591 |
item_before = item; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
592 |
item = item->next; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
593 |
} \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
594 |
\ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
595 |
if (item_before == NULL) { \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
596 |
_base = item_new; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
597 |
} else \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
598 |
item_before->next = item_new; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
599 |
\ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
600 |
item_new->next = item; \ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
601 |
/* END - Alphabetical insert */ \ |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
602 |
} |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
603 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
604 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
605 |
* Register a new command to be used in the console |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
606 |
* @param name name of the command that will be used |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
607 |
* @param proc function that will be called upon execution of command |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
608 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
609 |
void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc) |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
610 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
611 |
char *new_cmd = strdup(name); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
612 |
IConsoleCmd *item_new = malloc(sizeof(IConsoleCmd)); |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
613 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
614 |
item_new->next = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
615 |
item_new->proc = proc; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
616 |
item_new->name = new_cmd; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
617 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
618 |
item_new->hook.access = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
619 |
item_new->hook.pre = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
620 |
item_new->hook.post = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
621 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
622 |
IConsoleAddSorted(_iconsole_cmds, item_new, IConsoleCmd, "a command"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
623 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
624 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
625 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
626 |
* Find the command pointed to by its string |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
627 |
* @param name command to be found |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
628 |
* @return return Cmdstruct of the found command, or NULL on failure |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
629 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
630 |
IConsoleCmd *IConsoleCmdGet(const char *name) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
631 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
632 |
IConsoleCmd *item; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
633 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
634 |
for (item = _iconsole_cmds; item != NULL; item = item->next) { |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
635 |
if (strcmp(item->name, name) == 0) return item; |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
636 |
} |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
637 |
return NULL; |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
638 |
} |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
639 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
640 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
641 |
* Register a an alias for an already existing command in the console |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
642 |
* @param name name of the alias that will be used |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
643 |
* @param cmd name of the command that 'name' will be alias of |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
644 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
645 |
void IConsoleAliasRegister(const char *name, const char *cmd) |
1725
e391da994698
(svn r2229) - Fix: [ 1188777 ] Non-existing sprite #5125 (presignal). The DOS grf file trgi.grf has 6 less sprites than the windows one. This results in some segfaults for certain sprites. Fixed it by added a dummy grf file consisting ofr 6 sprites and loaded when using DOS gfx at the appropiate place.
Darkvater
parents:
1588
diff
changeset
|
646 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
647 |
char *new_alias = strdup(name); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
648 |
char *cmd_aliased = strdup(cmd); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
649 |
IConsoleAlias *item_new = malloc(sizeof(IConsoleAlias)); |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
650 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
651 |
item_new->next = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
652 |
item_new->cmdline = cmd_aliased; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
653 |
item_new->name = new_alias; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
654 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
655 |
IConsoleAddSorted(_iconsole_aliases, item_new, IConsoleAlias, "an alias"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
656 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
657 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
658 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
659 |
* Find the alias pointed to by its string |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
660 |
* @param name alias to be found |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
661 |
* @return return Aliasstruct of the found alias, or NULL on failure |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
662 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
663 |
IConsoleAlias *IConsoleAliasGet(const char *name) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
664 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
665 |
IConsoleAlias* item; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
666 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
667 |
for (item = _iconsole_aliases; item != NULL; item = item->next) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
668 |
if (strcmp(item->name, name) == 0) return item; |
634
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
669 |
} |
754b2df37bfa
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
670 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
671 |
return NULL; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
672 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
673 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
674 |
/** copy in an argument into the aliasstream */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
675 |
static inline int IConsoleCopyInParams(char *dst, const char *src, uint bufpos) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
676 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
677 |
int len = min(ICON_MAX_STREAMSIZE - bufpos, strlen(src)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
678 |
strncpy(dst, src, len); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
679 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
680 |
return len; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
681 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
682 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
683 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
684 |
* An alias is just another name for a command, or for more commands |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
685 |
* Execute it as well. |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
686 |
* @param *alias is the alias of the command |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
687 |
* @param tokencount the number of parameters passed |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
688 |
* @param *tokens are the parameters given to the original command (0 is the first param) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
689 |
*/ |
2817 | 690 |
static void IConsoleAliasExec(const IConsoleAlias* alias, byte tokencount, char* tokens[ICON_TOKEN_COUNT]) |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
691 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
692 |
const char *cmdptr; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
693 |
char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE]; |
3017
a75caf4efa2d
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents:
2817
diff
changeset
|
694 |
uint i; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
695 |
uint a_index, astream_i; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
696 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
697 |
memset(&aliases, 0, sizeof(aliases)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
698 |
memset(&aliasstream, 0, sizeof(aliasstream)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
699 |
|
1866
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
700 |
if (_stdlib_con_developer) |
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
701 |
IConsolePrintF(_icolour_dbg, "condbg: requested command is an alias; parsing..."); |
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
702 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
703 |
aliases[0] = aliasstream; |
1819 | 704 |
for (cmdptr = alias->cmdline, a_index = 0, astream_i = 0; *cmdptr != '\0'; cmdptr++) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
705 |
if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
706 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
707 |
switch (*cmdptr) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
708 |
case '\'': /* ' will double for "" */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
709 |
aliasstream[astream_i++] = '"'; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
710 |
break; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
711 |
case ';': /* Cmd seperator, start new command */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
712 |
aliasstream[astream_i] = '\0'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
713 |
aliases[++a_index] = &aliasstream[++astream_i]; |
1819 | 714 |
cmdptr++; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
715 |
break; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
716 |
case '%': /* Some or all parameters */ |
1819 | 717 |
cmdptr++; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
718 |
switch (*cmdptr) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
719 |
case '+': { /* All parameters seperated: "[param 1]" "[param 2]" */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
720 |
for (i = 0; i != tokencount; i++) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
721 |
aliasstream[astream_i++] = '"'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
722 |
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
723 |
aliasstream[astream_i++] = '"'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
724 |
aliasstream[astream_i++] = ' '; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
725 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
726 |
} break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
727 |
case '!': { /* Merge the parameters to one: "[param 1] [param 2] [param 3...]" */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
728 |
aliasstream[astream_i++] = '"'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
729 |
for (i = 0; i != tokencount; i++) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
730 |
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
731 |
aliasstream[astream_i++] = ' '; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
732 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
733 |
aliasstream[astream_i++] = '"'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
734 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
735 |
} break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
736 |
default: { /* One specific parameter: %A = [param 1] %B = [param 2] ... */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
737 |
int param = *cmdptr - 'A'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
738 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
739 |
if (param < 0 || param >= tokencount) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
740 |
IConsoleError("too many or wrong amount of parameters passed to alias, aborting"); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
741 |
IConsolePrintF(_icolour_warn, "Usage of alias '%s': %s", alias->name, alias->cmdline); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
742 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
743 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
744 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
745 |
aliasstream[astream_i++] = '"'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
746 |
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[param], astream_i); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
747 |
aliasstream[astream_i++] = '"'; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
748 |
} break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
749 |
} break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
750 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
751 |
default: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
752 |
aliasstream[astream_i++] = *cmdptr; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
753 |
break; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
754 |
} |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
755 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
756 |
|
3017
a75caf4efa2d
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents:
2817
diff
changeset
|
757 |
for (i = 0; i <= a_index; i++) IConsoleCmdExec(aliases[i]); // execute each alias in turn |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
758 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
759 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
760 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
761 |
* Special function for adding string-type variables. They in addition |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
762 |
* also need a 'size' value saying how long their string buffer is. |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
763 |
* @param size the length of the string buffer |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
764 |
* For more information see @IConsoleVarRegister() |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
765 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
766 |
void IConsoleVarStringRegister(const char *name, void *addr, uint32 size, const char *help) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
767 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
768 |
IConsoleVar *var; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
769 |
IConsoleVarRegister(name, addr, ICONSOLE_VAR_STRING, help); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
770 |
var = IConsoleVarGet(name); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
771 |
var->size = size; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
772 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
773 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
774 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
775 |
* Register a new variable to be used in the console |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
776 |
* @param name name of the variable that will be used |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
777 |
* @param addr memory location the variable will point to |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
778 |
* @param help the help string shown for the variable |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
779 |
* @param type the type of the variable (simple atomic) so we know which values it can get |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
780 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
781 |
void IConsoleVarRegister(const char *name, void *addr, IConsoleVarTypes type, const char *help) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
782 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
783 |
char *new_cmd = strdup(name); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
784 |
IConsoleVar *item_new = malloc(sizeof(IConsoleVar)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
785 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
786 |
item_new->help = (help != NULL) ? strdup(help) : NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
787 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
788 |
item_new->next = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
789 |
item_new->name = new_cmd; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
790 |
item_new->addr = addr; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
791 |
item_new->proc = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
792 |
item_new->type = type; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
793 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
794 |
item_new->hook.access = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
795 |
item_new->hook.pre = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
796 |
item_new->hook.post = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
797 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
798 |
IConsoleAddSorted(_iconsole_vars, item_new, IConsoleVar, "a variable"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
799 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
800 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
801 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
802 |
* Find the variable pointed to by its string |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
803 |
* @param name variable to be found |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
804 |
* @return return Varstruct of the found variable, or NULL on failure |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
805 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
806 |
IConsoleVar *IConsoleVarGet(const char *name) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
807 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
808 |
IConsoleVar *item; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
809 |
for (item = _iconsole_vars; item != NULL; item = item->next) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
810 |
if (strcmp(item->name, name) == 0) return item; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
811 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
812 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
813 |
return NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
814 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
815 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
816 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
817 |
* Set a new value to a console variable |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
818 |
* @param *var the variable being set/changed |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
819 |
* @param value the new value given to the variable, cast properly |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
820 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
821 |
static void IConsoleVarSetValue(const IConsoleVar *var, uint32 value) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
822 |
{ |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
823 |
IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_PRE_ACTION); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
824 |
switch (var->type) { |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
825 |
case ICONSOLE_VAR_BOOLEAN: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
826 |
*(bool*)var->addr = (value != 0); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
827 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
828 |
case ICONSOLE_VAR_BYTE: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
829 |
*(byte*)var->addr = (byte)value; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
830 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
831 |
case ICONSOLE_VAR_UINT16: |
2145
708916e35e63
(svn r2655) An uint16 is an uint16, not a byte - fix wrong cast
tron
parents:
1899
diff
changeset
|
832 |
*(uint16*)var->addr = (uint16)value; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
833 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
834 |
case ICONSOLE_VAR_INT16: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
835 |
*(int16*)var->addr = (int16)value; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
836 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
837 |
case ICONSOLE_VAR_UINT32: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
838 |
*(uint32*)var->addr = (uint32)value; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
839 |
break; |
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
840 |
case ICONSOLE_VAR_INT32: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
841 |
*(int32*)var->addr = (int32)value; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
842 |
break; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
843 |
default: NOT_REACHED(); |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
844 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
845 |
|
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
846 |
IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_POST_ACTION); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
847 |
IConsoleVarPrintSetValue(var); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
848 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
849 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
850 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
851 |
* Set a new value to a string-type variable. Basically this |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
852 |
* means to copy the new value over to the container. |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
853 |
* @param *var the variable in question |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
854 |
* @param *value the new value |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
855 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
856 |
static void IConsoleVarSetStringvalue(const IConsoleVar *var, char *value) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
857 |
{ |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
858 |
if (var->type != ICONSOLE_VAR_STRING || var->addr == NULL) return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
859 |
|
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
860 |
IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_PRE_ACTION); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
861 |
ttd_strlcpy((char*)var->addr, (char*)value, var->size); |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
862 |
IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_POST_ACTION); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
863 |
IConsoleVarPrintSetValue(var); // print out the new value, giving feedback |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
864 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
865 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
866 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
867 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
868 |
* Query the current value of a variable and return it |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
869 |
* @param *var the variable queried |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
870 |
* @return current value of the variable |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
871 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
872 |
static uint32 IConsoleVarGetValue(const IConsoleVar *var) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
873 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
874 |
uint32 result = 0; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
875 |
|
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
876 |
switch (var->type) { |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
877 |
case ICONSOLE_VAR_BOOLEAN: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
878 |
result = *(bool*)var->addr; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
879 |
break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
880 |
case ICONSOLE_VAR_BYTE: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
881 |
result = *(byte*)var->addr; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
882 |
break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
883 |
case ICONSOLE_VAR_UINT16: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
884 |
result = *(uint16*)var->addr; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
885 |
break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
886 |
case ICONSOLE_VAR_INT16: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
887 |
result = *(int16*)var->addr; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
888 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
889 |
case ICONSOLE_VAR_UINT32: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
890 |
result = *(uint32*)var->addr; |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
891 |
break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
892 |
case ICONSOLE_VAR_INT32: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
893 |
result = *(int32*)var->addr; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
894 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
895 |
default: NOT_REACHED(); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
896 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
897 |
return result; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
898 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
899 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
900 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
901 |
* Get the value of the variable and put it into a printable |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
902 |
* string form so we can use it for printing |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
903 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
904 |
static char *IConsoleVarGetStringValue(const IConsoleVar *var) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
905 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
906 |
static char tempres[50]; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
907 |
char *value = tempres; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
908 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
909 |
switch (var->type) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
910 |
case ICONSOLE_VAR_BOOLEAN: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
911 |
snprintf(tempres, sizeof(tempres), "%s", (*(bool*)var->addr) ? "on" : "off"); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
912 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
913 |
case ICONSOLE_VAR_BYTE: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
914 |
snprintf(tempres, sizeof(tempres), "%u", *(byte*)var->addr); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
915 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
916 |
case ICONSOLE_VAR_UINT16: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
917 |
snprintf(tempres, sizeof(tempres), "%u", *(uint16*)var->addr); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
918 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
919 |
case ICONSOLE_VAR_UINT32: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
920 |
snprintf(tempres, sizeof(tempres), "%u", *(uint32*)var->addr); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
921 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
922 |
case ICONSOLE_VAR_INT16: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
923 |
snprintf(tempres, sizeof(tempres), "%i", *(int16*)var->addr); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
924 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
925 |
case ICONSOLE_VAR_INT32: |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
926 |
snprintf(tempres, sizeof(tempres), "%i", *(int32*)var->addr); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
927 |
break; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
928 |
case ICONSOLE_VAR_STRING: |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
929 |
value = (char*)var->addr; |
1889
91c51eadc8d9
(svn r2395) - Fix: oops, forgot a break in a console switch.
Darkvater
parents:
1879
diff
changeset
|
930 |
break; |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
931 |
default: NOT_REACHED(); |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
932 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
933 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
934 |
return value; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
935 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
936 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
937 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
938 |
* Print out the value of the variable when asked |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
939 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
940 |
void IConsoleVarPrintGetValue(const IConsoleVar *var) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
941 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
942 |
char *value; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
943 |
/* Some variables need really specific handling, handle this in its |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
944 |
* callback function */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
945 |
if (var->proc != NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
946 |
var->proc(0, NULL); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
947 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
948 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
949 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
950 |
value = IConsoleVarGetStringValue(var); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
951 |
IConsolePrintF(_icolour_warn, "Current value for '%s' is: %s", var->name, value); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
952 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
953 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
954 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
955 |
* Print out the value of the variable after it has been assigned |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
956 |
* a new value, thus giving us feedback on the action |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
957 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
958 |
void IConsoleVarPrintSetValue(const IConsoleVar *var) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
959 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
960 |
char *value = IConsoleVarGetStringValue(var); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
961 |
IConsolePrintF(_icolour_warn, "'%s' changed to: %s", var->name, value); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
962 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
963 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
964 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
965 |
* Execute a variable command. Without any parameters, print out its value |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
966 |
* with parameters it assigns a new value to the variable |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
967 |
* @param *var the variable that we will be querying/changing |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
968 |
* @param tokencount how many additional parameters have been given to the commandline |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
969 |
* @param *token the actual parameters the variable was called with |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
970 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
971 |
void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_TOKEN_COUNT]) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
972 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
973 |
const char *tokenptr = token[0]; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
974 |
byte t_index = tokencount; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
975 |
uint32 value; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
976 |
|
1866
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
977 |
if (_stdlib_con_developer) |
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
978 |
IConsolePrintF(_icolour_dbg, "condbg: requested command is a variable"); |
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
979 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
980 |
if (tokencount == 0) { /* Just print out value */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
981 |
IConsoleVarPrintGetValue(var); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
982 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
983 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
984 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
985 |
/* Use of assignment sign is not mandatory but supported, so just 'ignore it appropiately' */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
986 |
if (strcmp(tokenptr, "=") == 0) tokencount--; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
987 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
988 |
if (tokencount == 1) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
989 |
/* Some variables need really special handling, handle it in their callback procedure */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
990 |
if (var->proc != NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
991 |
var->proc(tokencount, &token[t_index - tokencount]); // set the new value |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
992 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
993 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
994 |
/* Strings need special processing. No need to convert the argument to |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
995 |
* an integer value, just copy over the argument on a one-by-one basis */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
996 |
if (var->type == ICONSOLE_VAR_STRING) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
997 |
IConsoleVarSetStringvalue(var, token[t_index - tokencount]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
998 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
999 |
} else if (GetArgumentInteger(&value, token[t_index - tokencount])) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1000 |
IConsoleVarSetValue(var, value); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1001 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1002 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1003 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1004 |
/* Increase or decrease the value by one. This of course can only happen to 'number' types */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1005 |
if (strcmp(tokenptr, "++") == 0 && var->type != ICONSOLE_VAR_STRING) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1006 |
IConsoleVarSetValue(var, IConsoleVarGetValue(var) + 1); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1007 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1008 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1009 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1010 |
if (strcmp(tokenptr, "--") == 0 && var->type != ICONSOLE_VAR_STRING) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1011 |
IConsoleVarSetValue(var, IConsoleVarGetValue(var) - 1); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1012 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1013 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1014 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1015 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1016 |
IConsoleError("invalid variable assignment"); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
1017 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
1018 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1019 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1020 |
* Add a callback function to the variable. Some variables need |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1021 |
* very special processing, which can only be done with custom code |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1022 |
* @param name name of the variable the callback function is added to |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1023 |
* @param proc the function called |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1024 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1025 |
void IConsoleVarProcAdd(const char *name, IConsoleCmdProc *proc) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1026 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1027 |
IConsoleVar *var = IConsoleVarGet(name); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1028 |
if (var == NULL) return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1029 |
var->proc = proc; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1030 |
} |
1109
ecb98f43ba2c
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1095
diff
changeset
|
1031 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1032 |
/** |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1033 |
* Execute a given command passed to us. First chop it up into |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1034 |
* individual tokens (seperated by spaces), then execute it if possible |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1035 |
* @param cmdstr string to be parsed and executed |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1036 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1037 |
void IConsoleCmdExec(const char *cmdstr) |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1038 |
{ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1039 |
IConsoleCmd *cmd = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1040 |
IConsoleAlias *alias = NULL; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1041 |
IConsoleVar *var = NULL; |
1726
0f014227480a
(svn r2230) Oops, revert wrongly committed local console.c. Also add the endian_target.h and endian_host.h to the ignore list
Darkvater
parents:
1725
diff
changeset
|
1042 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1043 |
const char *cmdptr; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1044 |
char *tokens[ICON_TOKEN_COUNT], tokenstream[ICON_MAX_STREAMSIZE]; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1045 |
uint t_index, tstream_i; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1046 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1047 |
bool longtoken = false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1048 |
bool foundtoken = false; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1049 |
|
1866
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
1050 |
if (cmdstr[0] == '#') return; // comments |
87ae212e7eda
(svn r2372) - Fix (console): update the example scripts in the scripts/ directory to reflect the new console functionality
Darkvater
parents:
1833
diff
changeset
|
1051 |
|
1819 | 1052 |
for (cmdptr = cmdstr; *cmdptr != '\0'; cmdptr++) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1053 |
if (!IsValidAsciiChar(*cmdptr)) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1054 |
IConsoleError("command contains malformed characters, aborting"); |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
1055 |
IConsolePrintF(_icolour_err, "ERROR: command was: '%s'", cmdstr); |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1056 |
return; |
1379
496ceb83c845
(svn r1883) -Fix: [1109400] Better test if a string actually contains any console command
tron
parents:
1243
diff
changeset
|
1057 |
} |
496ceb83c845
(svn r1883) -Fix: [1109400] Better test if a string actually contains any console command
tron
parents:
1243
diff
changeset
|
1058 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1059 |
|
640
7f08d269c3f4
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
1060 |
if (_stdlib_con_developer) |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
1061 |
IConsolePrintF(_icolour_dbg, "condbg: executing cmdline: '%s'", cmdstr); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1062 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1063 |
memset(&tokens, 0, sizeof(tokens)); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1064 |
memset(&tokenstream, 0, sizeof(tokenstream)); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1065 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1066 |
/* 1. Split up commandline into tokens, seperated by spaces, commands |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1067 |
* enclosed in "" are taken as one token. We can only go as far as the amount |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1068 |
* of characters in our stream or the max amount of tokens we can handle */ |
1819 | 1069 |
for (cmdptr = cmdstr, t_index = 0, tstream_i = 0; *cmdptr != '\0'; cmdptr++) { |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1070 |
if (t_index >= lengthof(tokens) || tstream_i >= lengthof(tokenstream)) break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1071 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1072 |
switch (*cmdptr) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1073 |
case ' ': /* Token seperator */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1074 |
if (!foundtoken) break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1075 |
|
1746
80dc66ca63b5
(svn r2250) - Fix (regression): arguments with spaces in them were incorrectly parsed
Darkvater
parents:
1743
diff
changeset
|
1076 |
if (longtoken) { |
80dc66ca63b5
(svn r2250) - Fix (regression): arguments with spaces in them were incorrectly parsed
Darkvater
parents:
1743
diff
changeset
|
1077 |
tokenstream[tstream_i] = *cmdptr; |
80dc66ca63b5
(svn r2250) - Fix (regression): arguments with spaces in them were incorrectly parsed
Darkvater
parents:
1743
diff
changeset
|
1078 |
} else { |
80dc66ca63b5
(svn r2250) - Fix (regression): arguments with spaces in them were incorrectly parsed
Darkvater
parents:
1743
diff
changeset
|
1079 |
tokenstream[tstream_i] = '\0'; |
80dc66ca63b5
(svn r2250) - Fix (regression): arguments with spaces in them were incorrectly parsed
Darkvater
parents:
1743
diff
changeset
|
1080 |
foundtoken = false; |
80dc66ca63b5
(svn r2250) - Fix (regression): arguments with spaces in them were incorrectly parsed
Darkvater
parents:
1743
diff
changeset
|
1081 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1082 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1083 |
tstream_i++; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1084 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1085 |
case '"': /* Tokens enclosed in "" are one token */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1086 |
longtoken = !longtoken; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1087 |
break; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1088 |
default: /* Normal character */ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1089 |
tokenstream[tstream_i++] = *cmdptr; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1090 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1091 |
if (!foundtoken) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1092 |
tokens[t_index++] = &tokenstream[tstream_i - 1]; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1093 |
foundtoken = true; |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
1094 |
} |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1095 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1096 |
} |
289
6dd77b0ac456
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1097 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1098 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1099 |
if (_stdlib_con_developer) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1100 |
uint i; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1101 |
for (i = 0; tokens[i] != NULL; i++) |
1805
1dba0eb4cb47
(svn r2309) - CodeChange: Change all _iconsole_color_whatever into _icolour_wtv (abbreviated). Besides the changed into proper english, yes this commit is pretty useless ;)
Darkvater
parents:
1773
diff
changeset
|
1102 |
IConsolePrintF(_icolour_dbg, "condbg: token %d is: '%s'", i, tokens[i]); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
1103 |
} |
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
1104 |
|
1828
5775957dc871
(svn r2333) - CodeChange: also don't execute command if user has typed all spaces (eg nothing worthwhile). Suggested and implemented by Tron.
Darkvater
parents:
1827
diff
changeset
|
1105 |
if (tokens[0] == '\0') return; // don't execute empty commands |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1106 |
/* 2. Determine type of command (cmd, alias or variable) and execute |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1107 |
* First try commands, then aliases, and finally variables. Execute |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1108 |
* the found action taking into account its hooking code |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1109 |
*/ |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1110 |
cmd = IConsoleCmdGet(tokens[0]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1111 |
if (cmd != NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1112 |
if (IConsoleHookHandle(&cmd->hook, ICONSOLE_HOOK_ACCESS)) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1113 |
IConsoleHookHandle(&cmd->hook, ICONSOLE_HOOK_PRE_ACTION); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1114 |
if (cmd->proc(t_index, tokens)) { // index started with 0 |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1115 |
IConsoleHookHandle(&cmd->hook, ICONSOLE_HOOK_POST_ACTION); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1116 |
} else cmd->proc(0, NULL); // if command failed, give help |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1117 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1118 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1119 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1120 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1121 |
t_index--; // ignore the variable-name for comfort for both aliases and variaables |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1122 |
alias = IConsoleAliasGet(tokens[0]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1123 |
if (alias != NULL) { |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1124 |
IConsoleAliasExec(alias, t_index, &tokens[1]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1125 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1126 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1127 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1128 |
var = IConsoleVarGet(tokens[0]); |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1129 |
if (var != NULL) { |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
1130 |
if (IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_ACCESS)) |
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1131 |
IConsoleVarExec(var, t_index, &tokens[1]); |
1833
2605fb698bec
(svn r2338) - CodeChange: only call the variable hooks when you set their value not when you query them
Darkvater
parents:
1828
diff
changeset
|
1132 |
|
1739
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1133 |
return; |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1134 |
} |
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1135 |
|
4c8fb3905cbd
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
1726
diff
changeset
|
1136 |
IConsoleError("command or variable not found"); |
135
638fb31434eb
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
darkvater
parents:
129
diff
changeset
|
1137 |
} |