author | Darkvater |
Sun, 24 Apr 2005 21:44:45 +0000 | |
changeset 1725 | 97841c222b55 |
parent 1588 | 5cb399cb05e5 |
child 1726 | 0982af56de6d |
permissions | -rw-r--r-- |
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
|
1 |
#include "stdafx.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
|
2 |
#include "ttd.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
301
diff
changeset
|
3 |
#include "table/strings.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
|
4 |
#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
|
5 |
#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
|
6 |
#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
|
7 |
#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
|
8 |
#include "variables.h" |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
9 |
#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
|
10 |
#include "hal.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 <stdarg.h> |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
12 |
#include <string.h> |
274 | 13 |
#include "console.h" |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
14 |
#include "network.h" |
1026
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
15 |
#include "network_data.h" |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
16 |
#include "network_server.h" |
274 | 17 |
|
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
18 |
#define ICON_BUFFER 79 |
1725
97841c222b55
(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
|
19 |
#define ICON_HISTORY_SIZE 20 |
301
f30c8c628dc6
(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_CMDLN_SIZE 255 |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
21 |
#define ICON_LINE_HEIGHT 12 |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
22 |
#define ICON_RIGHT_BORDERWIDTH 10 |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
23 |
#define ICON_BOTTOM_BORDERWIDTH 12 |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
24 |
#define ICON_MAX_ALIAS_LINES 40 |
1725
97841c222b55
(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
|
25 |
#define ICON_TOKEN_COUNT 20 |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
26 |
|
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
|
27 |
// ** main console ** // |
1397
b04402b901cd
(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
|
28 |
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
|
29 |
static bool _iconsole_inited; |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
30 |
static char* _iconsole_buffer[ICON_BUFFER + 1]; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
31 |
static uint16 _iconsole_cbuffer[ICON_BUFFER + 1]; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
32 |
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
|
33 |
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
|
34 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
35 |
// ** stdlib ** // |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
36 |
byte _stdlib_developer = 1; |
1e1102dd2a62
(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 |
bool _stdlib_con_developer = false; |
1e1102dd2a62
(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 |
FILE* _iconsole_output_file; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
39 |
|
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
40 |
// ** main console cmd buffer |
1725
97841c222b55
(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
|
41 |
static char *_iconsole_history[ICON_HISTORY_SIZE]; |
97841c222b55
(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
|
42 |
static byte _iconsole_historypos; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
43 |
|
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
|
44 |
/* *************** */ |
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 |
/* end of header */ |
274 | 46 |
/* *************** */ |
47 |
||
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
48 |
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
|
49 |
{ |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
50 |
memset(_iconsole_cmdline.buf, 0, ICON_CMDLN_SIZE); |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
51 |
_iconsole_cmdline.length = 0; |
53a5713cf3f9
(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.width = 0; |
53a5713cf3f9
(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.caretpos = 0; |
53a5713cf3f9
(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.caretxoffs = 0; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
55 |
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
|
56 |
} |
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 |
|
1725
97841c222b55
(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
|
58 |
static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} |
97841c222b55
(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
|
59 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
60 |
// ** console window ** // |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
61 |
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
|
62 |
{ |
1725
97841c222b55
(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
|
63 |
switch (e->event) { |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
64 |
case WE_PAINT: { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
65 |
int i = _iconsole_scroll; |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
66 |
int max = (w->height / ICON_LINE_HEIGHT) - 1; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
67 |
int delta = 0; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
68 |
GfxFillRect(w->left, w->top, w->width, w->height - 1, 0); |
986
239603c9dd34
(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
|
69 |
while ((i > 0) && (i > _iconsole_scroll - max) && (_iconsole_buffer[i] != NULL)) { |
289
1e1102dd2a62
(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 |
DoDrawString(_iconsole_buffer[i], 5, |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
71 |
w->height - (_iconsole_scroll + 2 - i) * ICON_LINE_HEIGHT, _iconsole_cbuffer[i]); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
72 |
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
|
73 |
} |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
74 |
/* If the text is longer than the window, don't show the starting ']' */ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
75 |
delta = w->width - 10 - _iconsole_cmdline.width - ICON_RIGHT_BORDERWIDTH; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
76 |
if (delta > 0) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
77 |
DoDrawString("]", 5, w->height - ICON_LINE_HEIGHT, _iconsole_color_commands); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
78 |
delta = 0; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
79 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
80 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
81 |
DoDrawString(_iconsole_cmdline.buf, 10 + delta, w->height - ICON_LINE_HEIGHT, _iconsole_color_commands); |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
82 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
83 |
if (_iconsole_cmdline.caret) |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
84 |
DoDrawString("_", 10 + delta + _iconsole_cmdline.caretxoffs, w->height - ICON_LINE_HEIGHT, 12); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
85 |
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
|
86 |
} |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
87 |
case WE_MOUSELOOP: |
53a5713cf3f9
(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 (HandleCaret(&_iconsole_cmdline)) |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
89 |
SetWindowDirty(w); |
289
1e1102dd2a62
(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; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
91 |
case WE_DESTROY: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
92 |
_iconsole_win = NULL; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
93 |
_iconsole_mode = ICONSOLE_CLOSED; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
94 |
break; |
1e1102dd2a62
(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 |
case WE_KEYPRESS: |
1e1102dd2a62
(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 |
e->keypress.cont = false; |
1e1102dd2a62
(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 |
switch (e->keypress.keycode) { |
1e1102dd2a62
(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 |
case WKC_UP: |
1725
97841c222b55
(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
|
99 |
IConsoleHistoryNavigate(+1); |
289
1e1102dd2a62
(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 |
SetWindowDirty(w); |
1e1102dd2a62
(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 |
break; |
1e1102dd2a62
(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 |
case WKC_DOWN: |
1725
97841c222b55
(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
|
103 |
IConsoleHistoryNavigate(-1); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
104 |
SetWindowDirty(w); |
1e1102dd2a62
(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 |
break; |
1e1102dd2a62
(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 |
case WKC_SHIFT | WKC_PAGEUP: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
107 |
if (_iconsole_scroll - (w->height / ICON_LINE_HEIGHT) - 1 < 0) |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
108 |
_iconsole_scroll = 0; |
1e1102dd2a62
(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 |
else |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
110 |
_iconsole_scroll -= (w->height / ICON_LINE_HEIGHT) - 1; |
289
1e1102dd2a62
(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 |
SetWindowDirty(w); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
112 |
break; |
1e1102dd2a62
(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 |
case WKC_SHIFT | WKC_PAGEDOWN: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
114 |
if (_iconsole_scroll + (w->height / ICON_LINE_HEIGHT) - 1 > ICON_BUFFER) |
f30c8c628dc6
(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 = ICON_BUFFER; |
289
1e1102dd2a62
(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 |
else |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
117 |
_iconsole_scroll += (w->height / ICON_LINE_HEIGHT) - 1; |
289
1e1102dd2a62
(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 |
SetWindowDirty(w); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
119 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
120 |
case WKC_SHIFT | WKC_UP: |
1e1102dd2a62
(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 |
if (_iconsole_scroll <= 0) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
122 |
_iconsole_scroll = 0; |
1e1102dd2a62
(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 |
else |
1e1102dd2a62
(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 |
--_iconsole_scroll; |
1e1102dd2a62
(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 |
SetWindowDirty(w); |
1e1102dd2a62
(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 |
break; |
1e1102dd2a62
(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 |
case WKC_SHIFT | WKC_DOWN: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
128 |
if (_iconsole_scroll >= ICON_BUFFER) |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
129 |
_iconsole_scroll = ICON_BUFFER; |
289
1e1102dd2a62
(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 |
else |
1e1102dd2a62
(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 |
++_iconsole_scroll; |
1e1102dd2a62
(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 |
SetWindowDirty(w); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
133 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
134 |
case WKC_BACKQUOTE: |
1e1102dd2a62
(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 |
IConsoleSwitch(); |
1e1102dd2a62
(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 |
break; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
137 |
case WKC_RETURN: case WKC_NUM_ENTER: |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
138 |
IConsolePrintF(_iconsole_color_commands, "] %s", _iconsole_cmdline.buf); |
1725
97841c222b55
(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
|
139 |
IConsoleHistoryAdd(_iconsole_cmdline.buf); |
672
d06d46264039
(svn r1110) -Fix: Empty console commands were executed and returned error message (sign_de for GeniusDex)
darkvater
parents:
659
diff
changeset
|
140 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
141 |
IConsoleCmdExec(_iconsole_cmdline.buf); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
142 |
IConsoleClearCommand(); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
143 |
break; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
144 |
case WKC_CTRL | WKC_RETURN: |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
145 |
_iconsole_mode = (_iconsole_mode == ICONSOLE_FULL) ? ICONSOLE_OPENED : ICONSOLE_FULL; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
146 |
IConsoleResize(); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
147 |
MarkWholeScreenDirty(); |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
148 |
break; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
149 |
case (WKC_CTRL | 'V'): |
1725
97841c222b55
(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
|
150 |
if (InsertTextBufferClipboard(&_iconsole_cmdline)) { |
97841c222b55
(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
|
151 |
IConsoleResetHistoryPos(); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
152 |
SetWindowDirty(w); |
1725
97841c222b55
(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
|
153 |
} |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
154 |
break; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
155 |
case WKC_BACKSPACE: case WKC_DELETE: |
1725
97841c222b55
(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
|
156 |
if (DeleteTextBufferChar(&_iconsole_cmdline, e->keypress.keycode)) { |
97841c222b55
(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
|
157 |
IConsoleResetHistoryPos(); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
158 |
SetWindowDirty(w); |
1725
97841c222b55
(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
|
159 |
} |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
160 |
break; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
161 |
case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: |
1725
97841c222b55
(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
|
162 |
if (MoveTextBufferPos(&_iconsole_cmdline, e->keypress.keycode)) { |
97841c222b55
(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
|
163 |
IConsoleResetHistoryPos(); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
164 |
SetWindowDirty(w); |
1725
97841c222b55
(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
|
165 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
166 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
167 |
default: |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
168 |
if (IsValidAsciiChar(e->keypress.ascii)) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
169 |
_iconsole_scroll = ICON_BUFFER; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
170 |
InsertTextBufferChar(&_iconsole_cmdline, e->keypress.ascii); |
1725
97841c222b55
(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
|
171 |
IConsoleResetHistoryPos(); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
172 |
SetWindowDirty(w); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
173 |
} else |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
174 |
e->keypress.cont = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
175 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
176 |
} |
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
|
177 |
} |
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
|
178 |
} |
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
|
179 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
180 |
static const Widget _iconsole_window_widgets[] = { |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
181 |
{WIDGETS_END} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
182 |
}; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
183 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
184 |
static const WindowDesc _iconsole_window_desc = { |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
185 |
0, 0, 2, 2, |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
186 |
WC_CONSOLE, 0, |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
187 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
188 |
_iconsole_window_widgets, |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
189 |
IConsoleWndProc, |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
190 |
}; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
191 |
|
659
a98c731921b4
(svn r1093) -Fix: Hopefully fixed windows revision issues once and for all. Removed globalness of _openttd_revision and put all such ifdefs into one place. If server has a revision only the same revisions can join; if the server has no revision everyone can join. I reckon this should be a server-side option to allow people to join or not to join.
darkvater
parents:
656
diff
changeset
|
192 |
extern const char _openttd_revision[]; |
a98c731921b4
(svn r1093) -Fix: Hopefully fixed windows revision issues once and for all. Removed globalness of _openttd_revision and put all such ifdefs into one place. If server has a revision only the same revisions can join; if the server has no revision everyone can join. I reckon this should be a server-side option to allow people to join or not to join.
darkvater
parents:
656
diff
changeset
|
193 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
194 |
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
|
195 |
{ |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
196 |
_iconsole_output_file = NULL; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
197 |
_iconsole_color_default = 1; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
198 |
_iconsole_color_error = 3; |
229
b94bfdf02bae
(svn r230) -Feature: IConsoleWarning for warning messages
signde
parents:
228
diff
changeset
|
199 |
_iconsole_color_warning = 13; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
200 |
_iconsole_color_debug = 5; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
201 |
_iconsole_color_commands = 2; |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
202 |
_iconsole_scroll = ICON_BUFFER; |
1725
97841c222b55
(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
|
203 |
_iconsole_historypos = ICON_HISTORY_SIZE - 1; |
289
1e1102dd2a62
(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 |
_iconsole_inited = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
205 |
_iconsole_mode = ICONSOLE_CLOSED; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
206 |
_iconsole_win = NULL; |
1243
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
207 |
|
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
208 |
#ifdef ENABLE_NETWORK /* Initialize network only variables */ |
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
209 |
_redirect_console_to_client = 0; |
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
210 |
#endif |
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
211 |
|
1725
97841c222b55
(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
|
212 |
memset(_iconsole_history, 0, sizeof(_iconsole_history)); |
1243
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
213 |
memset(_iconsole_buffer, 0, sizeof(_iconsole_buffer)); |
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
214 |
memset(_iconsole_cbuffer, 0, sizeof(_iconsole_cbuffer)); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
215 |
_iconsole_cmdline.buf = calloc(ICON_CMDLN_SIZE, sizeof(*_iconsole_cmdline.buf)); // create buffer and zero it |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
216 |
_iconsole_cmdline.maxlength = ICON_CMDLN_SIZE - 1; |
1243
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
217 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
218 |
IConsoleStdLibRegister(); |
1725
97841c222b55
(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
|
219 |
IConsolePrintF(13, "OpenTTD Game Console Revision 7 - %s", _openttd_revision); |
97841c222b55
(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
|
220 |
IConsolePrint(12, "------------------------------------"); |
97841c222b55
(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
|
221 |
IConsolePrint(12, "use \"help\" for more info"); |
97841c222b55
(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
|
222 |
IConsolePrint(12, ""); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
223 |
IConsoleClearCommand(); |
1725
97841c222b55
(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
|
224 |
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
|
225 |
} |
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
|
226 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
227 |
void IConsoleClear(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
|
228 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
229 |
uint i; |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
230 |
for (i = 0; i <= ICON_BUFFER; i++) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
231 |
free(_iconsole_buffer[i]); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
232 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
233 |
free(_iconsole_cmdline.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
|
234 |
} |
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
|
235 |
|
1046
d46ccd96c40f
(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
|
236 |
static void IConsoleWriteToLogFile(const char* string) |
d46ccd96c40f
(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
|
237 |
{ |
d46ccd96c40f
(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
|
238 |
if (_iconsole_output_file != NULL) { |
d46ccd96c40f
(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
|
239 |
// if there is an console output file ... also print it there |
d46ccd96c40f
(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
|
240 |
fwrite(string, strlen(string), 1, _iconsole_output_file); |
d46ccd96c40f
(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
|
241 |
fwrite("\n", 1, 1, _iconsole_output_file); |
d46ccd96c40f
(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
|
242 |
} |
d46ccd96c40f
(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
|
243 |
} |
d46ccd96c40f
(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
|
244 |
|
d46ccd96c40f
(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
|
245 |
bool CloseConsoleLogIfActive(void) |
d46ccd96c40f
(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
|
246 |
{ |
d46ccd96c40f
(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
|
247 |
if (_iconsole_output_file != NULL) { |
d46ccd96c40f
(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
|
248 |
IConsolePrintF(_iconsole_color_default, "file output complete"); |
d46ccd96c40f
(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
|
249 |
fclose(_iconsole_output_file); |
1127
b7eaa0592b30
(svn r1628) -Fix: [1107893] script command; log file pointer was not reset to NULL after logging was closed
darkvater
parents:
1109
diff
changeset
|
250 |
_iconsole_output_file = NULL; |
1046
d46ccd96c40f
(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
|
251 |
return true; |
d46ccd96c40f
(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
|
252 |
} |
d46ccd96c40f
(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 |
|
d46ccd96c40f
(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 |
return false; |
d46ccd96c40f
(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 |
} |
d46ccd96c40f
(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 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
257 |
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
|
258 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
259 |
_iconsole_inited = false; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
260 |
IConsoleClear(); |
1046
d46ccd96c40f
(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 |
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
|
262 |
} |
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
|
263 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
264 |
void IConsoleResize(void) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
265 |
{ |
986
239603c9dd34
(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
|
266 |
_iconsole_win = FindWindowById(WC_CONSOLE, 0); |
239603c9dd34
(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
|
267 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
268 |
switch (_iconsole_mode) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
269 |
case ICONSOLE_OPENED: |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
270 |
_iconsole_win->height = _screen.height / 3; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
271 |
_iconsole_win->width = _screen.width; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
272 |
break; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
273 |
case ICONSOLE_FULL: |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
274 |
_iconsole_win->height = _screen.height - ICON_BOTTOM_BORDERWIDTH; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
275 |
_iconsole_win->width = _screen.width; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
276 |
break; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
277 |
default: |
1725
97841c222b55
(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
|
278 |
NOT_REACHED(); |
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 |
} |
986
239603c9dd34
(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
|
280 |
|
239603c9dd34
(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
|
281 |
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
|
282 |
} |
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
|
283 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
284 |
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
|
285 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
286 |
switch (_iconsole_mode) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
287 |
case ICONSOLE_CLOSED: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
288 |
_iconsole_win = AllocateWindowDesc(&_iconsole_window_desc); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
289 |
_iconsole_win->height = _screen.height / 3; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
290 |
_iconsole_win->width = _screen.width; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
291 |
_iconsole_mode = ICONSOLE_OPENED; |
1725
97841c222b55
(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
|
292 |
SETBIT(_no_scroll, SCROLL_CON); // override cursor arrows; the gamefield will not scroll |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
293 |
break; |
1397
b04402b901cd
(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
|
294 |
case ICONSOLE_OPENED: case ICONSOLE_FULL: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
295 |
DeleteWindowById(WC_CONSOLE, 0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
296 |
_iconsole_win = NULL; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
297 |
_iconsole_mode = ICONSOLE_CLOSED; |
1397
b04402b901cd
(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
|
298 |
CLRBIT(_no_scroll, SCROLL_CON); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
299 |
break; |
289
1e1102dd2a62
(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 |
} |
986
239603c9dd34
(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
|
301 |
|
239603c9dd34
(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
|
302 |
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
|
303 |
} |
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
|
304 |
|
289
1e1102dd2a62
(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 |
void IConsoleClose(void) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
306 |
{ |
289
1e1102dd2a62
(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 |
if (_iconsole_mode == ICONSOLE_OPENED) 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
|
308 |
} |
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
|
309 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
310 |
void IConsoleOpen(void) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
311 |
{ |
289
1e1102dd2a62
(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 |
if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch(); |
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
|
313 |
} |
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
|
314 |
|
1725
97841c222b55
(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
|
315 |
/** |
97841c222b55
(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
|
316 |
* Add the entered line into the history so you can look it back |
97841c222b55
(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
|
317 |
* scroll, etc. Put it to the beginning as it is the latest text |
97841c222b55
(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
|
318 |
* @param cmd Text to be entered into the 'history' |
97841c222b55
(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
|
319 |
*/ |
97841c222b55
(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
|
320 |
void IConsoleHistoryAdd(const char *cmd) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
321 |
{ |
1725
97841c222b55
(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
|
322 |
free(_iconsole_history[ICON_HISTORY_SIZE - 1]); |
97841c222b55
(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
|
323 |
|
97841c222b55
(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
|
324 |
memmove(&_iconsole_history[1], &_iconsole_history[0], sizeof(_iconsole_history[0]) * (ICON_HISTORY_SIZE - 1)); |
97841c222b55
(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
|
325 |
_iconsole_history[0] = strdup(cmd); |
97841c222b55
(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
|
326 |
IConsoleResetHistoryPos(); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
327 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
328 |
|
1725
97841c222b55
(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
|
329 |
/** |
97841c222b55
(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
|
330 |
* Navigate Up/Down in the history of typed commands |
97841c222b55
(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
|
331 |
* @param direction Go further back in history (+1), go to recently typed commands (-1) |
97841c222b55
(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
|
332 |
*/ |
97841c222b55
(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
|
333 |
void IConsoleHistoryNavigate(signed char direction) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
334 |
{ |
1725
97841c222b55
(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
|
335 |
int i = _iconsole_historypos + direction; |
97841c222b55
(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
|
336 |
|
97841c222b55
(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
|
337 |
// watch out for overflows, just wrap around |
97841c222b55
(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
|
338 |
if (i < 0) i = ICON_HISTORY_SIZE - 1; |
97841c222b55
(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
|
339 |
if (i >= ICON_HISTORY_SIZE) i = 0; |
97841c222b55
(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
|
340 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
341 |
if (direction > 0) |
1725
97841c222b55
(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
|
342 |
if (_iconsole_history[i] == NULL) i = 0; |
97841c222b55
(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
|
343 |
|
97841c222b55
(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
|
344 |
if (direction < 0) { |
97841c222b55
(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
|
345 |
while (i > 0 && _iconsole_history[i] == NULL) i--; |
97841c222b55
(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
|
346 |
} |
97841c222b55
(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
|
347 |
|
97841c222b55
(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
|
348 |
_iconsole_historypos = i; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
349 |
IConsoleClearCommand(); |
1725
97841c222b55
(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
|
350 |
// copy history to 'command prompt / bash' |
97841c222b55
(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
|
351 |
assert(_iconsole_history[i] != NULL && IS_INT_INSIDE(i, 0, ICON_HISTORY_SIZE)); |
97841c222b55
(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
|
352 |
ttd_strlcpy(_iconsole_cmdline.buf, _iconsole_history[i], _iconsole_cmdline.maxlength); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1379
diff
changeset
|
353 |
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
|
354 |
} |
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
|
355 |
|
1588
5cb399cb05e5
(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
|
356 |
/** |
5cb399cb05e5
(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
|
357 |
* Handle the printing of text entered into the console or redirected there |
5cb399cb05e5
(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
|
358 |
* by any other means. Text can be redirected to other players in a network game |
5cb399cb05e5
(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
|
359 |
* as well as to a logfile. If the network server is a dedicated server, all activities |
5cb399cb05e5
(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
|
360 |
* are also logged. All lines to print are added to a temporary buffer which can be |
5cb399cb05e5
(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
|
361 |
* used as a history to print them onscreen |
5cb399cb05e5
(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
|
362 |
* @param color_code the colour of the command. Red in case of errors, etc. |
5cb399cb05e5
(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
|
363 |
* @param string the message entered or output on the console (notice, error, etc.) |
5cb399cb05e5
(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
|
364 |
*/ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
365 |
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
|
366 |
{ |
1588
5cb399cb05e5
(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 |
char *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
|
368 |
|
1243
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
369 |
#ifdef ENABLE_NETWORK |
1026
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
370 |
if (_redirect_console_to_client != 0) { |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
371 |
/* Redirect the string to the client */ |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
372 |
SEND_COMMAND(PACKET_SERVER_RCON)(NetworkFindClientStateFromIndex(_redirect_console_to_client), color_code, string); |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
373 |
return; |
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
374 |
} |
1243
dda9f676e081
(svn r1747) - Fix: [network] ottd should compile when networking is disabled.
darkvater
parents:
1230
diff
changeset
|
375 |
#endif |
1026
5b2681cad645
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1008
diff
changeset
|
376 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
377 |
if (_network_dedicated) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
378 |
printf("%s\n", string); |
1046
d46ccd96c40f
(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
|
379 |
IConsoleWriteToLogFile(string); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
380 |
return; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
381 |
} |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
382 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
383 |
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
|
384 |
|
1588
5cb399cb05e5
(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
|
385 |
/* move up all the strings in the buffer one place and do the same for colour |
5cb399cb05e5
(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
|
386 |
* to accomodate for the new command/message */ |
5cb399cb05e5
(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
|
387 |
free(_iconsole_buffer[0]); |
5cb399cb05e5
(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
|
388 |
memmove(&_iconsole_buffer[0], &_iconsole_buffer[1], sizeof(_iconsole_buffer[0]) * ICON_BUFFER); |
5cb399cb05e5
(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
|
389 |
_iconsole_buffer[ICON_BUFFER] = strdup(string); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
390 |
|
1588
5cb399cb05e5
(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
|
391 |
// filter out unprintable characters |
5cb399cb05e5
(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 |
for (i = _iconsole_buffer[ICON_BUFFER]; *i != '\0'; i++) |
5cb399cb05e5
(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 |
if (!IsValidAsciiChar((byte)*i)) *i = ' '; |
5cb399cb05e5
(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 |
|
5cb399cb05e5
(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_cbuffer[0], &_iconsole_cbuffer[1], sizeof(_iconsole_cbuffer[0]) * ICON_BUFFER); |
5cb399cb05e5
(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_cbuffer[ICON_BUFFER] = color_code; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
397 |
|
1046
d46ccd96c40f
(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
|
398 |
IConsoleWriteToLogFile(string); |
650
e29098665100
(svn r1083) Fix: the console "script" command saves all output to the textfile, not only printf stuff (sign_de)
dominik
parents:
644
diff
changeset
|
399 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
400 |
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
|
401 |
} |
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
|
402 |
|
1725
97841c222b55
(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
|
403 |
/** |
97841c222b55
(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
|
404 |
* Handle the printing of text entered into the console or redirected there |
97841c222b55
(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
|
405 |
* by any other means. Uses printf() style format, for more information look |
97841c222b55
(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
|
406 |
* at @IConsolePrint() |
97841c222b55
(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
|
407 |
*/ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
408 |
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
|
409 |
{ |
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
|
410 |
va_list va; |
1725
97841c222b55
(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
|
411 |
char buf[ICON_MAX_STREAMSIZE]; |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
412 |
|
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
|
413 |
va_start(va, s); |
1725
97841c222b55
(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
|
414 |
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
|
415 |
va_end(va); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
416 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
417 |
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
|
418 |
} |
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
|
419 |
|
1725
97841c222b55
(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
|
420 |
/** |
97841c222b55
(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
|
421 |
* It is possible to print debugging information to the console, |
97841c222b55
(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
|
422 |
* which is achieved by using this function. Can only be used by |
97841c222b55
(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
|
423 |
* @debug() in debug.c. You need at least a level 2 (developer) for debugging |
97841c222b55
(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
|
424 |
* messages to show up |
97841c222b55
(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
|
425 |
*/ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
426 |
void IConsoleDebug(const char* string) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
427 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
428 |
if (_stdlib_developer > 1) |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
429 |
IConsolePrintF(_iconsole_color_debug, "dbg: %s", string); |
247
1cbc32ff06eb
(svn r248) -Feature: console script files "exec myscript.file"
darkvater
parents:
229
diff
changeset
|
430 |
} |
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
|
431 |
|
1725
97841c222b55
(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
|
432 |
/** |
97841c222b55
(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
|
433 |
* It is possible to print warnings to the console. These are mostly |
97841c222b55
(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
|
434 |
* errors or mishaps, but non-fatal. You need at least a level 1 (developer) for |
97841c222b55
(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
|
435 |
* debugging messages to show up |
97841c222b55
(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
|
436 |
*/ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
437 |
void IConsoleWarning(const char* string) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
438 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
439 |
if (_stdlib_developer > 0) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
440 |
IConsolePrintF(_iconsole_color_warning, "WARNING: %s", string); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
441 |
} |
1e1102dd2a62
(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 |
|
1725
97841c222b55
(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
|
443 |
/** |
97841c222b55
(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
|
444 |
* It is possible to print error information to the console. This can include |
97841c222b55
(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
|
445 |
* game errors, or errors in general you would want the user to notice |
97841c222b55
(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
|
446 |
*/ |
97841c222b55
(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
|
447 |
void IConsoleError(const char* string) |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
448 |
{ |
1725
97841c222b55
(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
|
449 |
IConsolePrintF(_iconsole_color_error, "ERROR: %s", string); |
97841c222b55
(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
|
450 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
451 |
|
1725
97841c222b55
(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
|
452 |
/** |
97841c222b55
(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
|
453 |
* Register a new command to be used in the console |
97841c222b55
(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
|
454 |
* @param name name of the command that will be used |
97841c222b55
(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
|
455 |
* @param addr function that will be called upon execution of command |
97841c222b55
(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
|
456 |
*/ |
97841c222b55
(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
|
457 |
void IConsoleCmdRegister(const char *name, IConsoleCmdAddr addr) |
97841c222b55
(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
|
458 |
{ |
97841c222b55
(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
|
459 |
IConsoleCmd *item, *item_before; |
97841c222b55
(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
|
460 |
char *new_cmd = strdup(name); |
97841c222b55
(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
|
461 |
IConsoleCmd *item_new = malloc(sizeof(IConsoleCmd)); |
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
|
462 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
463 |
item_new->_next = NULL; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
464 |
item_new->addr = addr; |
1725
97841c222b55
(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
|
465 |
item_new->name = new_cmd; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
466 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
467 |
item_new->hook_access = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
468 |
item_new->hook_after_exec = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
469 |
item_new->hook_before_exec = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
470 |
|
1725
97841c222b55
(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
|
471 |
// first command |
97841c222b55
(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
|
472 |
if (_iconsole_cmds == NULL) { |
97841c222b55
(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
|
473 |
_iconsole_cmds = item_new; |
97841c222b55
(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
|
474 |
return; |
97841c222b55
(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
|
475 |
} |
97841c222b55
(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
|
476 |
|
554 | 477 |
item_before = NULL; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
478 |
item = _iconsole_cmds; |
554 | 479 |
|
1725
97841c222b55
(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
|
480 |
/* BEGIN - Alphabetically insert the commands into the linked list */ |
97841c222b55
(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
|
481 |
while (item != NULL) { |
97841c222b55
(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
|
482 |
int i = strcmp(item->name, item_new->name); |
97841c222b55
(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
|
483 |
if (i == 0) { |
97841c222b55
(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
|
484 |
IConsoleError("a command with this name already exists; insertion aborted"); |
97841c222b55
(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
|
485 |
free(item_new); |
97841c222b55
(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
|
486 |
return; |
554 | 487 |
} |
1725
97841c222b55
(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
|
488 |
|
97841c222b55
(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
|
489 |
if (i > 0) break; // insert at this position |
97841c222b55
(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
|
490 |
|
97841c222b55
(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
|
491 |
item_before = item; |
97841c222b55
(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
|
492 |
item = item->_next; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
493 |
} |
554 | 494 |
|
1725
97841c222b55
(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
|
495 |
if (item_before == NULL) { |
97841c222b55
(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
|
496 |
_iconsole_cmds = item_new; |
97841c222b55
(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
|
497 |
} else |
97841c222b55
(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
|
498 |
item_before->_next = item_new; |
97841c222b55
(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
|
499 |
|
97841c222b55
(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
|
500 |
item_new->_next = item; |
97841c222b55
(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
|
501 |
/* END - Alphabetical insert */ |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
502 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
503 |
|
1725
97841c222b55
(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
|
504 |
/** |
97841c222b55
(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
|
505 |
* Find the command pointed to by its string |
97841c222b55
(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
|
506 |
* @param name command to be found |
97841c222b55
(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
|
507 |
* @return return Cmdstruct of the found command, or NULL on failure |
97841c222b55
(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
|
508 |
*/ |
97841c222b55
(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
|
509 |
IConsoleCmd *IConsoleCmdGet(const char *name) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
510 |
{ |
1725
97841c222b55
(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
|
511 |
IConsoleCmd *item; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
512 |
|
1725
97841c222b55
(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
|
513 |
for (item = _iconsole_cmds; item != NULL; item = item->_next) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
514 |
if (strcmp(item->name, name) == 0) return item; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
515 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
516 |
return NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
517 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
518 |
|
1725
97841c222b55
(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
|
519 |
/** |
97841c222b55
(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
|
520 |
* Register a an alias for an already existing command in the console |
97841c222b55
(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
|
521 |
* @param name name of the alias that will be used |
97841c222b55
(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
|
522 |
* @param cmd name of the command that 'name' will be alias of |
97841c222b55
(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
|
523 |
*/ |
97841c222b55
(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
|
524 |
void IConsoleAliasRegister(const char *name, const char *cmd) |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
525 |
{ |
1725
97841c222b55
(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
|
526 |
IConsoleAlias *item, *item_before; |
97841c222b55
(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
|
527 |
char *new_alias = strdup(name); |
97841c222b55
(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
|
528 |
char *cmd_aliased = strdup(cmd); |
97841c222b55
(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
|
529 |
IConsoleAlias *item_new = malloc(sizeof(IConsoleAlias)); |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
530 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
531 |
item_new->_next = NULL; |
1725
97841c222b55
(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
|
532 |
item_new->cmdline = cmd_aliased; |
97841c222b55
(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
|
533 |
item_new->name = new_alias; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
534 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
535 |
item_before = NULL; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
536 |
item = _iconsole_aliases; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
537 |
|
1725
97841c222b55
(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
|
538 |
// first command |
97841c222b55
(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
|
539 |
if (_iconsole_aliases == NULL) { |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
540 |
_iconsole_aliases = item_new; |
1725
97841c222b55
(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
|
541 |
return; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
542 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
543 |
|
1725
97841c222b55
(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
|
544 |
item_before = NULL; |
97841c222b55
(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
|
545 |
item = _iconsole_aliases; |
97841c222b55
(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
|
546 |
|
97841c222b55
(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
|
547 |
/* BEGIN - Alphabetically insert the commands into the linked list */ |
97841c222b55
(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
|
548 |
while (item != NULL) { |
97841c222b55
(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
|
549 |
int i = strcmp(item->name, item_new->name); |
97841c222b55
(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
|
550 |
if (i == 0) { |
97841c222b55
(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
|
551 |
IConsoleError("an alias with this name already exists; insertion aborted"); |
97841c222b55
(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
|
552 |
free(item_new); |
97841c222b55
(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
|
553 |
return; |
97841c222b55
(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
|
554 |
} |
97841c222b55
(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
|
555 |
|
97841c222b55
(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
|
556 |
if (i > 0) break; // insert at this position |
97841c222b55
(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
|
557 |
|
97841c222b55
(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
|
558 |
item_before = item; |
97841c222b55
(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
|
559 |
item = item->_next; |
97841c222b55
(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
|
560 |
} |
97841c222b55
(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
|
561 |
|
97841c222b55
(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
|
562 |
if (item_before == NULL) { |
97841c222b55
(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
|
563 |
_iconsole_aliases = item_new; |
97841c222b55
(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
|
564 |
} else |
97841c222b55
(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
|
565 |
item_before->_next = item_new; |
97841c222b55
(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
|
566 |
|
97841c222b55
(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
|
567 |
item_new->_next = item; |
97841c222b55
(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
|
568 |
/* END - Alphabetical insert */ |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
569 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
570 |
|
1725
97841c222b55
(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
|
571 |
/** |
97841c222b55
(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
|
572 |
* Find the alias pointed to by its string |
97841c222b55
(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
|
573 |
* @param name alias to be found |
97841c222b55
(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
|
574 |
* @return return Aliasstruct of the found alias, or NULL on failure |
97841c222b55
(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
|
575 |
*/ |
97841c222b55
(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
|
576 |
IConsoleAlias *IConsoleAliasGet(const char *name) |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
577 |
{ |
1725
97841c222b55
(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
|
578 |
IConsoleAlias* item; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
579 |
|
1725
97841c222b55
(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
|
580 |
for (item = _iconsole_aliases; item != NULL; item = item->_next) { |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
581 |
if (strcmp(item->name, name) == 0) return item; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
582 |
} |
1725
97841c222b55
(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
|
583 |
|
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
584 |
return NULL; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
585 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
586 |
|
1725
97841c222b55
(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
|
587 |
static inline int IConsoleCopyInParams(char *dst, const char *src, uint bufpos) |
1095 | 588 |
{ |
1725
97841c222b55
(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
|
589 |
int len = min(ICON_MAX_STREAMSIZE - bufpos, strlen(src)); |
97841c222b55
(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
|
590 |
strncpy(dst, src, len); |
97841c222b55
(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
|
591 |
|
97841c222b55
(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
|
592 |
return len; |
97841c222b55
(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
|
593 |
} |
97841c222b55
(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
|
594 |
|
97841c222b55
(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
|
595 |
/** |
97841c222b55
(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
|
596 |
* An alias is just another name for a command, or for more commands |
97841c222b55
(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
|
597 |
* Execute it as well. |
97841c222b55
(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
|
598 |
* @param cmdstr is the alias of the command |
97841c222b55
(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
|
599 |
* @param tokens are the parameters given to the original command (0 is the first param) |
97841c222b55
(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
|
600 |
* @param tokencount the number of parameters passed |
97841c222b55
(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
|
601 |
*/ |
97841c222b55
(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
|
602 |
static void IConsoleAliasExec(const char *cmdstr, char *tokens[ICON_TOKEN_COUNT], int tokencount) |
97841c222b55
(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
|
603 |
{ |
97841c222b55
(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
|
604 |
const char *cmdptr; |
97841c222b55
(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
|
605 |
char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE]; |
97841c222b55
(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
|
606 |
int i; |
97841c222b55
(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
|
607 |
uint a_index, astream_i; |
97841c222b55
(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
|
608 |
|
97841c222b55
(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
|
609 |
memset(&aliases, 0, sizeof(aliases)); |
97841c222b55
(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
|
610 |
memset(&aliasstream, 0, sizeof(aliasstream)); |
97841c222b55
(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
|
611 |
|
97841c222b55
(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
|
612 |
aliases[0] = aliasstream; |
97841c222b55
(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
|
613 |
for (cmdptr = cmdstr, a_index = 0, astream_i = 0; *cmdptr != '\0'; *cmdptr++) { |
97841c222b55
(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
|
614 |
if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break; |
97841c222b55
(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
|
615 |
|
97841c222b55
(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
|
616 |
switch (*cmdptr) { |
97841c222b55
(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
|
617 |
case '\'': /* ' will double for : */ |
97841c222b55
(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
|
618 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
619 |
break; |
97841c222b55
(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
|
620 |
case ';': /* Cmd seperator, start new line */ |
97841c222b55
(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
|
621 |
aliasstream[astream_i] = '\0'; |
97841c222b55
(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
|
622 |
aliases[++a_index] = &aliasstream[++astream_i]; |
97841c222b55
(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
|
623 |
*cmdptr++; |
97841c222b55
(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
|
624 |
break; |
97841c222b55
(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
|
625 |
case '%': /* One specific parameter: %A = [param 1] %B = [param 2] ... */ |
97841c222b55
(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
|
626 |
*cmdptr++; |
97841c222b55
(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
|
627 |
switch (*cmdptr) { |
97841c222b55
(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
|
628 |
case '+': { /* All parameters seperated: "[param 1]" "[param 2]" */ |
97841c222b55
(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
|
629 |
for (i = 0; i != tokencount; i++) { |
97841c222b55
(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
|
630 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
631 |
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i); |
97841c222b55
(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
|
632 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
633 |
aliasstream[astream_i++] = ' '; |
97841c222b55
(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
|
634 |
} |
97841c222b55
(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
|
635 |
} break; |
97841c222b55
(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
|
636 |
case '!': { /* Merge the parameters to one: "[param 1] [param 2] [param 3...]" */ |
97841c222b55
(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
|
637 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
638 |
for (i = 0; i != tokencount; i++) { |
97841c222b55
(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
|
639 |
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i); |
97841c222b55
(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
|
640 |
aliasstream[astream_i++] = ' '; |
97841c222b55
(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
|
641 |
} |
97841c222b55
(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
|
642 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
643 |
|
97841c222b55
(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
|
644 |
} break; |
97841c222b55
(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
|
645 |
default: { |
97841c222b55
(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 |
int param = *cmdptr - 'A'; |
97841c222b55
(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
|
647 |
|
97841c222b55
(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
|
648 |
if (param < 0 || param >= tokencount) { |
97841c222b55
(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
|
649 |
IConsoleError("too many or wrong amount of parameters passed to alias, aborting"); |
97841c222b55
(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
|
650 |
return; |
97841c222b55
(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
|
651 |
} |
97841c222b55
(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
|
652 |
|
97841c222b55
(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
|
653 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
654 |
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[param], astream_i); |
97841c222b55
(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
|
655 |
aliasstream[astream_i++] = '"'; |
97841c222b55
(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
|
656 |
} break; |
97841c222b55
(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
|
657 |
} break; |
97841c222b55
(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
|
658 |
|
97841c222b55
(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
|
659 |
default: |
97841c222b55
(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
|
660 |
aliasstream[astream_i++] = *cmdptr; |
97841c222b55
(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
|
661 |
break; |
97841c222b55
(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
|
662 |
} |
97841c222b55
(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
|
663 |
} |
97841c222b55
(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
|
664 |
|
97841c222b55
(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
|
665 |
for (i = 0; i <= (int)a_index; i++) IConsoleCmdExec(aliases[i]); |
97841c222b55
(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
|
666 |
} |
97841c222b55
(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
|
667 |
|
97841c222b55
(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
|
668 |
#if 0 |
97841c222b55
(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
|
669 |
static void IConsoleAliasExec(const char* cmdline, char* tokens[TOKEN_COUNT], byte tokentypes[TOKEN_COUNT]) |
97841c222b55
(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
|
670 |
{ |
97841c222b55
(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
|
671 |
char *lines[ICON_MAX_ALIAS_LINES]; |
97841c222b55
(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
|
672 |
char *linestream, *linestream_s; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
673 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
674 |
int c; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
675 |
int i; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
676 |
int l; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
677 |
int x; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
678 |
byte t; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
679 |
|
1725
97841c222b55
(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
|
680 |
memset(lines, 0, ICON_MAX_ALIAS_LINES); // clear buffer |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
681 |
|
1725
97841c222b55
(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
|
682 |
linestream_s = linestream = malloc(1024 * ICON_MAX_ALIAS_LINES); |
97841c222b55
(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
|
683 |
memset(linestream, 0, 1024 * ICON_MAX_ALIAS_LINES); |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
684 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
685 |
//** parsing **// |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
686 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
687 |
l = strlen(cmdline); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
688 |
i = 0; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
689 |
c = 0; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
690 |
x = 0; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
691 |
t = 0; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
692 |
lines[c] = linestream; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
693 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
694 |
while (i < l && c < ICON_MAX_ALIAS_LINES - 1) { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
695 |
if (cmdline[i] == '%') { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
696 |
i++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
697 |
if (cmdline[i] == '+') { |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
698 |
// all params seperated: "[param 1]" "[param 2]" |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
699 |
t=1; |
656
01540e6c0fed
(svn r1090) -Fix: Made the _openttd_revision variable global, and with that
truelight
parents:
650
diff
changeset
|
700 |
while ((tokens[t]!=NULL) && (t<20) && |
640
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
701 |
((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
702 |
int l2 = strlen(tokens[t]); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
703 |
*linestream = '"'; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
704 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
705 |
memcpy(linestream,tokens[t],l2); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
706 |
linestream += l2; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
707 |
*linestream = '"'; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
708 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
709 |
*linestream = ' '; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
710 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
711 |
x += l2+3; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
712 |
t++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
713 |
} |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
714 |
} else if (cmdline[i] == '!') { |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
715 |
// merge the params to one: "[param 1] [param 2] [param 3...]" |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
716 |
t=1; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
717 |
*linestream = '"'; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
718 |
linestream++; |
656
01540e6c0fed
(svn r1090) -Fix: Made the _openttd_revision variable global, and with that
truelight
parents:
650
diff
changeset
|
719 |
while ((tokens[t]!=NULL) && (t<20) && |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
720 |
((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
721 |
int l2 = strlen(tokens[t]); |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
722 |
memcpy(linestream,tokens[t],l2); |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
723 |
linestream += l2; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
724 |
*linestream = ' '; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
725 |
linestream++; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
726 |
x += l2+1; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
727 |
t++; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
728 |
} |
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
672
diff
changeset
|
729 |
linestream--; |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
730 |
*linestream = '"'; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
731 |
linestream++; |
932
5fcff6cdc612
(svn r1420) -Fix: Console alias, load_game functionality and load fix (sign_de)
darkvater
parents:
672
diff
changeset
|
732 |
x += 1; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
733 |
} else { |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
734 |
// one specific parameter: %A = [param 1] %B = [param 2] ... |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
735 |
int l2; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
736 |
t = ((byte)cmdline[i]) - 64; |
656
01540e6c0fed
(svn r1090) -Fix: Made the _openttd_revision variable global, and with that
truelight
parents:
650
diff
changeset
|
737 |
if ((t<20) && (tokens[t]!=NULL) && |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
738 |
((tokentypes[t] == ICONSOLE_VAR_STRING) || (tokentypes[t] == ICONSOLE_VAR_UNKNOWN))) { |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
739 |
l2 = strlen(tokens[t]); |
640
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
740 |
*linestream = '"'; |
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
741 |
linestream++; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
742 |
memcpy(linestream,tokens[t],l2); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
743 |
linestream += l2; |
640
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
744 |
*linestream = '"'; |
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
745 |
linestream++; |
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
746 |
x += l2+2; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
747 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
748 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
749 |
} else if (cmdline[i] == '\\') { |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
750 |
// \\ = \ \' = ' \% = % |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
751 |
i++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
752 |
if (cmdline[i] == '\\') { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
753 |
*linestream = '\\'; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
754 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
755 |
} else if (cmdline[i] == '\'') { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
756 |
*linestream = '\''; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
757 |
linestream++; |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
758 |
} else if (cmdline[i] == '%') { |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
759 |
*linestream = '%'; |
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
760 |
linestream++; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
761 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
762 |
} else if (cmdline[i] == '\'') { |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
763 |
// ' = " |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
764 |
*linestream = '"'; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
765 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
766 |
} else if (cmdline[i] == ';') { |
644
e833509107ad
(svn r1077) Implements scripts/autoexec.scr to get executed on game starting (sign_de)
dominik
parents:
640
diff
changeset
|
767 |
// ; = start a new line |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
768 |
c++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
769 |
*linestream = '\0'; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
770 |
linestream += 1024 - (x % 1024); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
771 |
x += 1024 - (x % 1024); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
772 |
lines[c] = linestream; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
773 |
} else { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
774 |
*linestream = cmdline[i]; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
775 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
776 |
x++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
777 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
778 |
i++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
779 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
780 |
|
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
781 |
linestream--; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
782 |
if (*linestream != '\0') { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
783 |
c++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
784 |
linestream++; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
785 |
*linestream = '\0'; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
786 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
787 |
|
1725
97841c222b55
(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
|
788 |
for (i = 0; i < c; i++) IConsoleCmdExec(lines[i]); |
640
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
789 |
|
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
790 |
free(linestream_s); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
791 |
} |
1725
97841c222b55
(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
|
792 |
#endif |
97841c222b55
(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
|
793 |
|
97841c222b55
(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
|
794 |
static void IConsoleVarExec(char *token[ICON_TOKEN_COUNT]) {} |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
795 |
|
554 | 796 |
void IConsoleVarInsert(_iconsole_var* item_new, const char* name) |
797 |
{ |
|
798 |
_iconsole_var* item; |
|
799 |
_iconsole_var* item_before; |
|
800 |
||
801 |
item_new->_next = NULL; |
|
802 |
||
803 |
item_new->name = malloc(strlen(name) + 2); /* XXX unchecked malloc */ |
|
804 |
sprintf(item_new->name, "%s", name); |
|
805 |
||
806 |
item_before = NULL; |
|
807 |
item = _iconsole_vars; |
|
808 |
||
809 |
if (item == NULL) { |
|
810 |
_iconsole_vars = item_new; |
|
811 |
} else { |
|
812 |
while ((item->_next != NULL) && (strcmp(item->name,item_new->name)<=0)) { |
|
813 |
item_before = item; |
|
814 |
item = item->_next; |
|
815 |
} |
|
816 |
// insertion sort |
|
817 |
if (item_before==NULL) { |
|
818 |
if (strcmp(item->name,item_new->name)<=0) { |
|
819 |
// appending |
|
820 |
item ->_next = item_new; |
|
821 |
} else { |
|
822 |
// inserting as startitem |
|
823 |
_iconsole_vars = item_new; |
|
824 |
item_new ->_next = item; |
|
825 |
} |
|
826 |
} else { |
|
827 |
if (strcmp(item->name,item_new->name)<=0) { |
|
828 |
// appending |
|
829 |
item ->_next = item_new; |
|
830 |
} else { |
|
831 |
// inserting |
|
832 |
item_new ->_next = item_before->_next; |
|
833 |
item_before ->_next = item_new; |
|
834 |
} |
|
835 |
} |
|
836 |
// insertion sort end |
|
837 |
} |
|
838 |
} |
|
839 |
||
289
1e1102dd2a62
(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 |
void IConsoleVarRegister(const char* name, void* addr, _iconsole_var_types type) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
841 |
{ |
289
1e1102dd2a62
(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 |
_iconsole_var* item_new; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
843 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
844 |
item_new = malloc(sizeof(_iconsole_var)); /* XXX unchecked malloc */ |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
845 |
|
554 | 846 |
item_new->_next = NULL; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
847 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
848 |
switch (type) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
849 |
case ICONSOLE_VAR_BOOLEAN: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
850 |
item_new->data.bool_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
851 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
852 |
case ICONSOLE_VAR_BYTE: |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
853 |
case ICONSOLE_VAR_UINT8: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
854 |
item_new->data.byte_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
855 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
856 |
case ICONSOLE_VAR_UINT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
857 |
item_new->data.uint16_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
858 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
859 |
case ICONSOLE_VAR_UINT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
860 |
item_new->data.uint32_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
861 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
862 |
case ICONSOLE_VAR_INT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
863 |
item_new->data.int16_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
864 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
865 |
case ICONSOLE_VAR_INT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
866 |
item_new->data.int32_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
867 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
868 |
case ICONSOLE_VAR_STRING: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
869 |
item_new->data.string_ = addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
870 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
871 |
default: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
872 |
error("unknown console variable type"); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
873 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
874 |
} |
554 | 875 |
|
876 |
IConsoleVarInsert(item_new, name); |
|
877 |
||
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
878 |
item_new->type = type; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
879 |
item_new->_malloc = false; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
880 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
881 |
item_new->hook_access = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
882 |
item_new->hook_after_change = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
883 |
item_new->hook_before_change = NULL; |
618
b14421f6b2ee
(svn r1042) -Fix: [Network] Hopefully enabled revision-check for windows (somehow
truelight
parents:
554
diff
changeset
|
884 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
885 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
886 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
887 |
void IConsoleVarMemRegister(const char* name, _iconsole_var_types type) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
888 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
889 |
_iconsole_var* item; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
890 |
item = IConsoleVarAlloc(type); |
289
1e1102dd2a62
(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 |
IConsoleVarInsert(item, name); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
892 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
893 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
894 |
_iconsole_var* IConsoleVarGet(const char* name) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
895 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
896 |
_iconsole_var* item; |
1725
97841c222b55
(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
|
897 |
for (item = _iconsole_vars; item != NULL; item = item->_next) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
898 |
if (strcmp(item->name, name) == 0) return item; |
1725
97841c222b55
(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
|
899 |
} |
97841c222b55
(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
|
900 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
901 |
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
|
902 |
} |
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
|
903 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
904 |
_iconsole_var* IConsoleVarAlloc(_iconsole_var_types type) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
905 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
906 |
_iconsole_var* item = malloc(sizeof(_iconsole_var)); /* XXX unchecked malloc */ |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
907 |
item->_next = NULL; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
908 |
item->name = NULL; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
909 |
item->type = type; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
910 |
switch (item->type) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
911 |
case ICONSOLE_VAR_BOOLEAN: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
912 |
item->data.bool_ = malloc(sizeof(*item->data.bool_)); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
913 |
*item->data.bool_ = false; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
914 |
item->_malloc = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
915 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
916 |
case ICONSOLE_VAR_BYTE: |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
917 |
case ICONSOLE_VAR_UINT8: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
918 |
item->data.byte_ = malloc(sizeof(*item->data.byte_)); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
919 |
*item->data.byte_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
920 |
item->_malloc = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
921 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
922 |
case ICONSOLE_VAR_UINT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
923 |
item->data.uint16_ = malloc(sizeof(*item->data.uint16_)); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
924 |
*item->data.uint16_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
925 |
item->_malloc = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
926 |
break; |
1e1102dd2a62
(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 |
case ICONSOLE_VAR_UINT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
928 |
item->data.uint32_ = malloc(sizeof(*item->data.uint32_)); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
929 |
*item->data.uint32_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
930 |
item->_malloc = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
931 |
break; |
1e1102dd2a62
(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 |
case ICONSOLE_VAR_INT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
933 |
item->data.int16_ = malloc(sizeof(*item->data.int16_)); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
934 |
*item->data.int16_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
935 |
item->_malloc = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
936 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
937 |
case ICONSOLE_VAR_INT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
938 |
item->data.int32_ = malloc(sizeof(*item->data.int32_)); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
939 |
*item->data.int32_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
940 |
item->_malloc = true; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
941 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
942 |
case ICONSOLE_VAR_POINTER: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
943 |
case ICONSOLE_VAR_STRING: |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
944 |
// needs no memory ... it gets memory when it is set to an value |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
945 |
item->data.addr = NULL; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
946 |
item->_malloc = false; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
947 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
948 |
default: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
949 |
error("unknown console variable type"); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
950 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
951 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
952 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
953 |
item->hook_access = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
954 |
item->hook_after_change = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
955 |
item->hook_before_change = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
956 |
return item; |
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
|
957 |
} |
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
|
958 |
|
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
|
959 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
960 |
void IConsoleVarFree(_iconsole_var* var) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
961 |
{ |
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
|
962 |
if (var->_malloc) |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
963 |
free(var->data.addr); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
964 |
free(var->name); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
965 |
free(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
|
966 |
} |
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
|
967 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
968 |
void IConsoleVarSetString(_iconsole_var* var, const char* string) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
969 |
{ |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
970 |
if (string == NULL) return; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
971 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
972 |
if (var->_malloc) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
973 |
free(var->data.string_); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
974 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
975 |
var->data.string_ = strdup(string); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
976 |
var->_malloc = true; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
977 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
978 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
979 |
void IConsoleVarSetValue(_iconsole_var* var, int value) { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
980 |
switch (var->type) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
981 |
case ICONSOLE_VAR_BOOLEAN: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
982 |
*var->data.bool_ = (value != 0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
983 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
984 |
case ICONSOLE_VAR_BYTE: |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
985 |
case ICONSOLE_VAR_UINT8: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
986 |
*var->data.byte_ = value; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
987 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
988 |
case ICONSOLE_VAR_UINT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
989 |
*var->data.uint16_ = value; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
990 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
991 |
case ICONSOLE_VAR_UINT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
992 |
*var->data.uint32_ = value; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
993 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
994 |
case ICONSOLE_VAR_INT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
995 |
*var->data.int16_ = value; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
996 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
997 |
case ICONSOLE_VAR_INT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
998 |
*var->data.int32_ = value; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
999 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1000 |
default: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1001 |
assert(0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1002 |
break; |
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
|
1003 |
} |
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
|
1004 |
} |
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
|
1005 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1006 |
void IConsoleVarDump(const _iconsole_var* var, const char* dump_desc) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1007 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1008 |
if (var == NULL) return; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1009 |
if (dump_desc == NULL) dump_desc = var->name; |
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
|
1010 |
|
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
|
1011 |
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
|
1012 |
case ICONSOLE_VAR_BOOLEAN: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1013 |
IConsolePrintF(_iconsole_color_default, "%s = %s", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1014 |
dump_desc, *var->data.bool_ ? "true" : "false"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1015 |
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
|
1016 |
case ICONSOLE_VAR_BYTE: |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1017 |
case ICONSOLE_VAR_UINT8: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1018 |
IConsolePrintF(_iconsole_color_default, "%s = %u", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1019 |
dump_desc, *var->data.byte_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1020 |
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
|
1021 |
case ICONSOLE_VAR_UINT16: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1022 |
IConsolePrintF(_iconsole_color_default, "%s = %u", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1023 |
dump_desc, *var->data.uint16_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1024 |
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
|
1025 |
case ICONSOLE_VAR_UINT32: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1026 |
IConsolePrintF(_iconsole_color_default, "%s = %u", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1027 |
dump_desc, *var->data.uint32_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1028 |
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
|
1029 |
case ICONSOLE_VAR_INT16: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1030 |
IConsolePrintF(_iconsole_color_default, "%s = %i", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1031 |
dump_desc, *var->data.int16_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1032 |
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
|
1033 |
case ICONSOLE_VAR_INT32: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1034 |
IConsolePrintF(_iconsole_color_default, "%s = %i", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1035 |
dump_desc, *var->data.int32_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1036 |
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
|
1037 |
case ICONSOLE_VAR_STRING: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1038 |
IConsolePrintF(_iconsole_color_default, "%s = %s", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1039 |
dump_desc, var->data.string_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1040 |
break; |
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
|
1041 |
case ICONSOLE_VAR_REFERENCE: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1042 |
IConsolePrintF(_iconsole_color_default, "%s = @%s", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1043 |
dump_desc, var->data.reference_); |
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
|
1044 |
case ICONSOLE_VAR_UNKNOWN: |
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
|
1045 |
case ICONSOLE_VAR_POINTER: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1046 |
IConsolePrintF(_iconsole_color_default, "%s = @%p", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1047 |
dump_desc, var->data.addr); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1048 |
break; |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1049 |
case ICONSOLE_VAR_NONE: |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1050 |
IConsolePrintF(_iconsole_color_default, "%s = [nothing]", |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1051 |
dump_desc); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1052 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1053 |
} |
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
|
1054 |
} |
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
|
1055 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1056 |
// * ************************* * // |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1057 |
// * hooking code * // |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1058 |
// * ************************* * // |
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
|
1059 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1060 |
void IConsoleVarHook(const char* name, _iconsole_hook_types type, iconsole_var_hook proc) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1061 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1062 |
_iconsole_var* hook_var = IConsoleVarGet(name); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1063 |
if (hook_var == NULL) return; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1064 |
switch (type) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1065 |
case ICONSOLE_HOOK_BEFORE_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1066 |
hook_var->hook_before_change = proc; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1067 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1068 |
case ICONSOLE_HOOK_AFTER_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1069 |
hook_var->hook_after_change = proc; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1070 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1071 |
case ICONSOLE_HOOK_ACCESS: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1072 |
hook_var->hook_access = proc; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1073 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1074 |
case ICONSOLE_HOOK_BEFORE_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1075 |
case ICONSOLE_HOOK_AFTER_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1076 |
assert(0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1077 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1078 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1079 |
} |
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
|
1080 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1081 |
bool IConsoleVarHookHandle(_iconsole_var* hook_var, _iconsole_hook_types type) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1082 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1083 |
iconsole_var_hook proc; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1084 |
if (hook_var == NULL) return false; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1085 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1086 |
proc = NULL; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1087 |
switch (type) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1088 |
case ICONSOLE_HOOK_BEFORE_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1089 |
proc = hook_var->hook_before_change; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1090 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1091 |
case ICONSOLE_HOOK_AFTER_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1092 |
proc = hook_var->hook_after_change; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1093 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1094 |
case ICONSOLE_HOOK_ACCESS: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1095 |
proc = hook_var->hook_access; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1096 |
break; |
1e1102dd2a62
(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 |
case ICONSOLE_HOOK_BEFORE_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1098 |
case ICONSOLE_HOOK_AFTER_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1099 |
assert(0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1100 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1101 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1102 |
return proc == NULL ? true : proc(hook_var); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1103 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1104 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1105 |
void IConsoleCmdHook(const char* name, _iconsole_hook_types type, iconsole_cmd_hook proc) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1106 |
{ |
1725
97841c222b55
(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
|
1107 |
IConsoleCmd* hook_cmd = IConsoleCmdGet(name); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1108 |
if (hook_cmd == NULL) return; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1109 |
switch (type) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1110 |
case ICONSOLE_HOOK_AFTER_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1111 |
hook_cmd->hook_after_exec = proc; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1112 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1113 |
case ICONSOLE_HOOK_BEFORE_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1114 |
hook_cmd->hook_before_exec = proc; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1115 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1116 |
case ICONSOLE_HOOK_ACCESS: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1117 |
hook_cmd->hook_access = proc; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1118 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1119 |
case ICONSOLE_HOOK_BEFORE_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1120 |
case ICONSOLE_HOOK_AFTER_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1121 |
assert(0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1122 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1123 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1124 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1125 |
|
1725
97841c222b55
(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
|
1126 |
bool IConsoleCmdHookHandle(IConsoleCmd* hook_cmd, _iconsole_hook_types type) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1127 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1128 |
iconsole_cmd_hook proc = NULL; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1129 |
switch (type) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1130 |
case ICONSOLE_HOOK_AFTER_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1131 |
proc = hook_cmd->hook_after_exec; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1132 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1133 |
case ICONSOLE_HOOK_BEFORE_EXEC: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1134 |
proc = hook_cmd->hook_before_exec; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1135 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1136 |
case ICONSOLE_HOOK_ACCESS: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1137 |
proc = hook_cmd->hook_access; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1138 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1139 |
case ICONSOLE_HOOK_BEFORE_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1140 |
case ICONSOLE_HOOK_AFTER_CHANGE: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1141 |
assert(0); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1142 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1143 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1144 |
return proc == NULL ? true : proc(hook_cmd); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1145 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1146 |
|
1725
97841c222b55
(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
|
1147 |
/** |
97841c222b55
(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
|
1148 |
* Execute a given command passed to us. First chop it up into |
97841c222b55
(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
|
1149 |
* individual tokens, then execute it if possible |
97841c222b55
(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
|
1150 |
* @param cmdstr string to be parsed and executed |
97841c222b55
(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
|
1151 |
*/ |
97841c222b55
(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
|
1152 |
void IConsoleCmdExec(const char *cmdstr) |
97841c222b55
(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
|
1153 |
{ |
97841c222b55
(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
|
1154 |
IConsoleCmd *cmd = NULL; |
97841c222b55
(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
|
1155 |
IConsoleAlias *alias = NULL; |
97841c222b55
(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
|
1156 |
_iconsole_var *var = NULL; |
97841c222b55
(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
|
1157 |
|
97841c222b55
(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
|
1158 |
const char *cmdptr; |
97841c222b55
(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
|
1159 |
char *tokens[ICON_TOKEN_COUNT], tokenstream[ICON_MAX_STREAMSIZE]; |
97841c222b55
(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
|
1160 |
uint t_index, tstream_i; |
97841c222b55
(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
|
1161 |
|
97841c222b55
(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
|
1162 |
bool longtoken = false; |
97841c222b55
(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
|
1163 |
|
97841c222b55
(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
|
1164 |
for (cmdptr = cmdstr; *cmdptr != '\0'; *cmdptr++) { |
97841c222b55
(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
|
1165 |
if (!IsValidAsciiChar(*cmdptr)) { |
97841c222b55
(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
|
1166 |
IConsoleError("command contains malformed characters, aborting"); |
97841c222b55
(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
|
1167 |
return; |
97841c222b55
(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
|
1168 |
} |
97841c222b55
(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
|
1169 |
} |
97841c222b55
(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
|
1170 |
|
97841c222b55
(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
|
1171 |
if (_stdlib_con_developer) |
97841c222b55
(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
|
1172 |
IConsolePrintF(_iconsole_color_debug, "condbg: executing cmdline: %s", cmdstr); |
97841c222b55
(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
|
1173 |
|
97841c222b55
(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
|
1174 |
memset(&tokens, 0, sizeof(tokens)); |
97841c222b55
(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
|
1175 |
memset(&tokenstream, 0, sizeof(tokenstream)); |
97841c222b55
(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
|
1176 |
|
97841c222b55
(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
|
1177 |
/* 1. Split up commandline into tokens, seperated by spaces, commands |
97841c222b55
(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
|
1178 |
* enclosed in "" are taken as one token. We can only go as far as the amount |
97841c222b55
(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
|
1179 |
* of characters in our stream or the max amount of tokens we can handle */ |
97841c222b55
(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
|
1180 |
tokens[0] = tokenstream; |
97841c222b55
(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
|
1181 |
for (cmdptr = cmdstr, t_index = 0, tstream_i = 0; *cmdptr != '\0'; *cmdptr++) { |
97841c222b55
(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
|
1182 |
if (t_index >= lengthof(tokens) || tstream_i >= lengthof(tokenstream)) break; |
97841c222b55
(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
|
1183 |
|
97841c222b55
(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
|
1184 |
switch (*cmdptr) { |
97841c222b55
(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
|
1185 |
case ' ': /* Token seperator */ |
97841c222b55
(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
|
1186 |
if (!longtoken) { |
97841c222b55
(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
|
1187 |
tokenstream[tstream_i] = '\0'; |
97841c222b55
(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
|
1188 |
tokens[++t_index] = &tokenstream[tstream_i + 1]; |
97841c222b55
(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
|
1189 |
} else |
97841c222b55
(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
|
1190 |
tokenstream[tstream_i] = *cmdptr; |
97841c222b55
(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
|
1191 |
|
97841c222b55
(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
|
1192 |
tstream_i++; |
97841c222b55
(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
|
1193 |
break; |
97841c222b55
(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
|
1194 |
case '"': /* Tokens enclosed in "" are one token */ |
97841c222b55
(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
|
1195 |
longtoken = !longtoken; |
97841c222b55
(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
|
1196 |
break; |
97841c222b55
(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
|
1197 |
default: /* Normal character */ |
97841c222b55
(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
|
1198 |
tokenstream[tstream_i++] = *cmdptr; |
97841c222b55
(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
|
1199 |
break; |
97841c222b55
(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
|
1200 |
} |
97841c222b55
(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
|
1201 |
} |
97841c222b55
(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
|
1202 |
|
97841c222b55
(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
|
1203 |
t_index++; // index was 0 |
97841c222b55
(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
|
1204 |
|
97841c222b55
(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
|
1205 |
/* 2. Determine type of command (cmd, alias or variable) and execute |
97841c222b55
(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
|
1206 |
* First try commands, then aliases, and finally variables |
97841c222b55
(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
|
1207 |
*/ |
97841c222b55
(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
|
1208 |
cmd = IConsoleCmdGet(tokens[0]); |
97841c222b55
(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
|
1209 |
if (cmd != NULL) { |
97841c222b55
(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
|
1210 |
if (IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_ACCESS)) { |
97841c222b55
(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
|
1211 |
IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_BEFORE_EXEC); |
97841c222b55
(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
|
1212 |
cmd->addr(t_index, tokens, NULL); |
97841c222b55
(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
|
1213 |
IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_AFTER_EXEC); |
97841c222b55
(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
|
1214 |
} |
97841c222b55
(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
|
1215 |
return; |
97841c222b55
(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
|
1216 |
} |
97841c222b55
(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
|
1217 |
|
97841c222b55
(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
|
1218 |
alias = IConsoleAliasGet(tokens[0]); |
97841c222b55
(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
|
1219 |
if (alias != NULL) { |
97841c222b55
(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
|
1220 |
IConsoleAliasExec(alias->cmdline, &tokens[1], t_index - 1); |
97841c222b55
(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
|
1221 |
return; |
97841c222b55
(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
|
1222 |
} |
97841c222b55
(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
|
1223 |
|
97841c222b55
(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
|
1224 |
var = IConsoleVarGet(tokens[0]); |
97841c222b55
(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
|
1225 |
if (var != NULL) { |
97841c222b55
(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
|
1226 |
IConsoleVarExec(tokens); |
97841c222b55
(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
|
1227 |
return; |
97841c222b55
(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
|
1228 |
} |
97841c222b55
(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
|
1229 |
|
97841c222b55
(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
|
1230 |
IConsoleError("command or variable not found"); |
97841c222b55
(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
|
1231 |
} |
97841c222b55
(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
|
1232 |
|
97841c222b55
(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
|
1233 |
#if 0 |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1234 |
void IConsoleCmdExec(const char* cmdstr) |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1235 |
{ |
1725
97841c222b55
(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
|
1236 |
IConsoleCmdAddr function; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1237 |
char* tokens[20]; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1238 |
byte tokentypes[20]; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1239 |
char* tokenstream; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1240 |
char* tokenstream_s; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1241 |
byte execution_mode; |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1242 |
_iconsole_var* var = NULL; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1243 |
_iconsole_var* result = NULL; |
1725
97841c222b55
(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
|
1244 |
IConsoleCmd* cmd = NULL; |
97841c222b55
(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
|
1245 |
IConsoleAlias* alias = NULL; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1246 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1247 |
bool longtoken; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1248 |
bool valid_token; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1249 |
bool skip_lt_change; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1250 |
|
959
b031d88c76f3
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
932
diff
changeset
|
1251 |
uint c; |
b031d88c76f3
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
932
diff
changeset
|
1252 |
uint i; |
b031d88c76f3
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
932
diff
changeset
|
1253 |
uint l; |
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1095
diff
changeset
|
1254 |
|
1725
97841c222b55
(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
|
1255 |
for (; strchr("\n\r \t", *cmdstr) != NULL; cmdstr++) { |
1379
02eb430be95e
(svn r1883) -Fix: [1109400] Better test if a string actually contains any console command
tron
parents:
1243
diff
changeset
|
1256 |
switch (*cmdstr) { |
1725
97841c222b55
(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
|
1257 |
case '\0': case '#': return; |
97841c222b55
(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
|
1258 |
default: break; |
1379
02eb430be95e
(svn r1883) -Fix: [1109400] Better test if a string actually contains any console command
tron
parents:
1243
diff
changeset
|
1259 |
} |
02eb430be95e
(svn r1883) -Fix: [1109400] Better test if a string actually contains any console command
tron
parents:
1243
diff
changeset
|
1260 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1261 |
|
640
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
1262 |
if (_stdlib_con_developer) |
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
1263 |
IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_cmdline: %s", cmdstr); |
b1f21d1ac4d3
(svn r1073) - condebugger extended a bit [shows the commandline] (sign_de)
dominik
parents:
634
diff
changeset
|
1264 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1265 |
//** clearing buffer **// |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1266 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1267 |
for (i = 0; i < 20; i++) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1268 |
tokens[i] = NULL; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1269 |
tokentypes[i] = ICONSOLE_VAR_NONE; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1270 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1271 |
tokenstream_s = tokenstream = malloc(1024); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1272 |
memset(tokenstream, 0, 1024); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1273 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1274 |
//** parsing **// |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1275 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1276 |
longtoken = false; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1277 |
valid_token = false; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1278 |
skip_lt_change = false; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1279 |
l = strlen(cmdstr); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1280 |
i = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1281 |
c = 0; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1282 |
tokens[c] = tokenstream; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1283 |
tokentypes[c] = ICONSOLE_VAR_UNKNOWN; |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1284 |
while (i < l && c < lengthof(tokens) - 1) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1285 |
if (cmdstr[i] == '"') { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1286 |
if (longtoken) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1287 |
if (cmdstr[i + 1] == '"') { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1288 |
i++; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1289 |
*tokenstream = '"'; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1290 |
tokenstream++; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1291 |
skip_lt_change = 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
|
1292 |
} else { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1293 |
longtoken = !longtoken; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1294 |
tokentypes[c] = ICONSOLE_VAR_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
|
1295 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1296 |
} else { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1297 |
longtoken = !longtoken; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1298 |
tokentypes[c] = ICONSOLE_VAR_STRING; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1299 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1300 |
if (!skip_lt_change) { |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1301 |
if (!longtoken) { |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1302 |
if (valid_token) { |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1303 |
c++; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1304 |
*tokenstream = '\0'; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1305 |
tokenstream++; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1306 |
tokens[c] = tokenstream; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1307 |
tokentypes[c] = ICONSOLE_VAR_UNKNOWN; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1308 |
valid_token = false; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1309 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1310 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1311 |
skip_lt_change=false; |
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
|
1312 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1313 |
} else if (!longtoken && cmdstr[i] == ' ') { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1314 |
if (valid_token) { |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1315 |
c++; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1316 |
*tokenstream = '\0'; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1317 |
tokenstream++; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1318 |
tokens[c] = tokenstream; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1319 |
tokentypes[c] = ICONSOLE_VAR_UNKNOWN; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1320 |
valid_token = false; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1321 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1322 |
} else { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1323 |
valid_token = true; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1324 |
*tokenstream = cmdstr[i]; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1325 |
tokenstream++; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1326 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1327 |
i++; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1328 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1329 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1330 |
tokenstream--; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1331 |
if (*tokenstream != '\0') { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1332 |
c++; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1333 |
tokenstream++; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1334 |
*tokenstream = '\0'; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1335 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1336 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1337 |
//** interpreting **// |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1338 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1339 |
for (i = 0; i < c; i++) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1340 |
if (tokens[i] != NULL && i > 0 && strlen(tokens[i]) > 0) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1341 |
if (IConsoleVarGet((char *)tokens[i]) != NULL) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1342 |
// change the variable to an pointer if execution_mode != 4 is |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1343 |
// being prepared. execution_mode 4 is used to assign |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1344 |
// one variables data to another one |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1345 |
// [token 0 and 2] |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1346 |
if (!((i == 2) && (tokentypes[1] == ICONSOLE_VAR_UNKNOWN) && |
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1347 |
(strcmp(tokens[1], "<<") == 0))) { |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1348 |
// only look for another variable if it isnt an longtoken == string with "" |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1349 |
var = NULL; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1350 |
if (tokentypes[i]!=ICONSOLE_VAR_STRING) var = IConsoleVarGet(tokens[i]); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1351 |
if (var != NULL) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1352 |
// pointer to the data --> token |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1353 |
tokens[i] = (char *) var->data.addr; /* XXX: maybe someone finds an cleaner way to do this */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1354 |
tokentypes[i] = var->type; |
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
|
1355 |
} |
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
|
1356 |
} |
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
|
1357 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1358 |
if (tokens[i] != NULL && tokens[i][0] == '@' && (IConsoleVarGet(tokens[i]+1) != NULL)) { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1359 |
var = IConsoleVarGet(tokens[i]+1); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1360 |
if (var != NULL) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1361 |
// pointer to the _iconsole_var struct --> token |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1362 |
tokens[i] = (char *) var; /* XXX: maybe someone finds an cleaner way to do this */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1363 |
tokentypes[i] = ICONSOLE_VAR_REFERENCE; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1364 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1365 |
} |
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
|
1366 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1367 |
} |
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
|
1368 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1369 |
execution_mode=0; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1370 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1371 |
function = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1372 |
cmd = IConsoleCmdGet(tokens[0]); |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1373 |
if (cmd != NULL) { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1374 |
function = cmd->addr; |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1375 |
} else { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1376 |
alias = IConsoleAliasGet(tokens[0]); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1377 |
if (alias != NULL) execution_mode = 5; // alias handling |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1378 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1379 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1380 |
if (function != NULL) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1381 |
execution_mode = 1; // this is a command |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1382 |
} else { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1383 |
var = IConsoleVarGet(tokens[0]); |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1384 |
if (var != NULL) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1385 |
execution_mode = 2; // this is a variable |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1386 |
if (c > 2 && strcmp(tokens[1], "<<") == 0) { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1387 |
// this is command to variable mode [normal] |
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
|
1388 |
|
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1389 |
function = NULL; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1390 |
cmd = IConsoleCmdGet(tokens[2]); |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1391 |
if (cmd != NULL) function = cmd->addr; |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1392 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1393 |
if (function != NULL) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1394 |
execution_mode = 3; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1395 |
} else { |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1396 |
result = IConsoleVarGet(tokens[2]); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1397 |
if (result != NULL) |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1398 |
execution_mode = 4; |
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
|
1399 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1400 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1401 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1402 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1403 |
|
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1404 |
//** executing **// |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1405 |
if (_stdlib_con_developer) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1406 |
IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_mode: %i", |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1407 |
execution_mode); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1408 |
switch (execution_mode) { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1409 |
case 0: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1410 |
// not found |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1411 |
IConsoleError("command or variable not found"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1412 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1413 |
case 1: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1414 |
if (IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_ACCESS)) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1415 |
// execution with command syntax |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1416 |
IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_BEFORE_EXEC); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1417 |
result = function(c, tokens, tokentypes); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1418 |
if (result != NULL) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1419 |
IConsoleVarDump(result, "result"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1420 |
IConsoleVarFree(result); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1421 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1422 |
IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_AFTER_EXEC); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1423 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1424 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1425 |
case 2: |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1426 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1427 |
// execution with variable syntax |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1428 |
if (IConsoleVarHookHandle(var, ICONSOLE_HOOK_ACCESS) && (c == 2 || c == 3)) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1429 |
// ** variable modifications ** // |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1430 |
IConsoleVarHookHandle(var, ICONSOLE_HOOK_BEFORE_CHANGE); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1431 |
switch (var->type) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1432 |
case ICONSOLE_VAR_BOOLEAN: |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1433 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1434 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1435 |
if (c == 3) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1436 |
*var->data.bool_ = (atoi(tokens[2]) != 0); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1437 |
} else { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1438 |
*var->data.bool_ = false; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1439 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1440 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1441 |
} else if (strcmp(tokens[1], "++") == 0) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1442 |
*var->data.bool_ = true; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1443 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1444 |
} else if (strcmp(tokens[1], "--") == 0) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1445 |
*var->data.bool_ = false; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1446 |
IConsoleVarDump(var, NULL); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1447 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1448 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1449 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1450 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1451 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1452 |
case ICONSOLE_VAR_BYTE: |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1453 |
case ICONSOLE_VAR_UINT8: |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1454 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1455 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1456 |
if (c == 3) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1457 |
*var->data.byte_ = atoi(tokens[2]); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1458 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1459 |
*var->data.byte_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1460 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1461 |
} else if (strcmp(tokens[1], "++") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1462 |
++*var->data.byte_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1463 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1464 |
} else if (strcmp(tokens[1], "--")==0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1465 |
--*var->data.byte_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1466 |
IConsoleVarDump(var, NULL); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1467 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1468 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1469 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1470 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1471 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1472 |
case ICONSOLE_VAR_UINT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1473 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1474 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1475 |
if (c == 3) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1476 |
*var->data.uint16_ = atoi(tokens[2]); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1477 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1478 |
*var->data.uint16_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1479 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1480 |
} else if (strcmp(tokens[1], "++") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1481 |
++*var->data.uint16_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1482 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1483 |
} else if (strcmp(tokens[1], "--") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1484 |
--*var->data.uint16_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1485 |
IConsoleVarDump(var, NULL); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1486 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1487 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1488 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1489 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1490 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1491 |
case ICONSOLE_VAR_UINT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1492 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1493 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1494 |
if (c == 3) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1495 |
*var->data.uint32_ = atoi(tokens[2]); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1496 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1497 |
*var->data.uint32_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1498 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1499 |
} else if (strcmp(tokens[1], "++") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1500 |
++*var->data.uint32_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1501 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1502 |
} else if (strcmp(tokens[1], "--") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1503 |
--*var->data.uint32_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1504 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1505 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1506 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1507 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1508 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1509 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1510 |
case ICONSOLE_VAR_INT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1511 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1512 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1513 |
if (c == 3) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1514 |
*var->data.int16_ = atoi(tokens[2]); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1515 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1516 |
*var->data.int16_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1517 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1518 |
} else if (strcmp(tokens[1], "++") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1519 |
++*var->data.int16_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1520 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1521 |
} else if (strcmp(tokens[1], "--") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1522 |
--*var->data.int16_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1523 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1524 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1525 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1526 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1527 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1528 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1529 |
case ICONSOLE_VAR_INT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1530 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1531 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1532 |
if (c == 3) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1533 |
*var->data.int32_ = atoi(tokens[2]); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1534 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1535 |
*var->data.int32_ = 0; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1536 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1537 |
} else if (strcmp(tokens[1], "++") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1538 |
++*var->data.int32_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1539 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1540 |
} else if (strcmp(tokens[1], "--") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1541 |
--*var->data.int32_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1542 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1543 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1544 |
else { IConsoleError("operation not supported"); } |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1545 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1546 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1547 |
case ICONSOLE_VAR_STRING: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1548 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1549 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1550 |
if (c == 3) |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1551 |
IConsoleVarSetString(var, tokens[2]); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1552 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1553 |
IConsoleVarSetString(var, ""); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1554 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1555 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1556 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1557 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1558 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1559 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1560 |
case ICONSOLE_VAR_POINTER: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1561 |
{ |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1562 |
if (strcmp(tokens[1], "=") == 0) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1563 |
if (c == 3) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1564 |
if (tokentypes[2] == ICONSOLE_VAR_UNKNOWN) |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1565 |
var->data.addr = (void*)atoi(tokens[2]); /* direct access on memory [by address] */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1566 |
else |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1567 |
var->data.addr = (void*)tokens[2]; /* direct acces on memory [by variable] */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1568 |
} else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1569 |
var->data.addr = NULL; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1570 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1571 |
} else if (strcmp(tokens[1], "++") == 0) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1572 |
++*(char*)&var->data.addr; /* change the address + 1 */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1573 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1574 |
} else if (strcmp(tokens[1], "--") == 0) { |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1575 |
--*(char*)&var->data.addr; /* change the address - 1 */ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1576 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1577 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1578 |
else |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1579 |
IConsoleError("operation not supported"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1580 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1581 |
} |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1582 |
case ICONSOLE_VAR_NONE: |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1583 |
case ICONSOLE_VAR_REFERENCE: |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1584 |
case ICONSOLE_VAR_UNKNOWN: |
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1585 |
IConsoleError("operation not supported"); |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1586 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1587 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1588 |
IConsoleVarHookHandle(var, ICONSOLE_HOOK_AFTER_CHANGE); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1589 |
} |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1590 |
if (c == 1) // ** variable output ** // |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1591 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1592 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1593 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1594 |
case 3: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1595 |
case 4: |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1596 |
{ |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1597 |
// execute command with result or assign a variable |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1598 |
if (execution_mode == 3) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1599 |
if (IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_ACCESS)) { |
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
|
1600 |
int i; |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1601 |
int diff; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1602 |
void* temp; |
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
|
1603 |
byte temp2; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1604 |
|
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
|
1605 |
// tokenshifting |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1606 |
for (diff = 0; diff < 2; diff++) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1607 |
temp = tokens[0]; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1608 |
temp2 = tokentypes[0]; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1609 |
for (i = 0; i < 19; i++) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1610 |
tokens[i] = tokens[i + 1]; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1611 |
tokentypes[i] = tokentypes[i + 1]; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
220
diff
changeset
|
1612 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1613 |
tokens[19] = temp; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1614 |
tokentypes[19] = temp2; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1615 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1616 |
IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_BEFORE_EXEC); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1617 |
result = function(c, tokens, tokentypes); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1618 |
IConsoleCmdHookHandle(cmd, ICONSOLE_HOOK_AFTER_EXEC); |
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
|
1619 |
} else |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1620 |
execution_mode = 255; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1621 |
} |
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1622 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1623 |
if (IConsoleVarHookHandle(var, ICONSOLE_HOOK_ACCESS) && result != NULL) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1624 |
if (result->type != var->type) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1625 |
IConsoleError("variable type missmatch"); |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1626 |
} else { |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1627 |
IConsoleVarHookHandle(var, ICONSOLE_HOOK_BEFORE_CHANGE); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1628 |
switch (result->type) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1629 |
case ICONSOLE_VAR_BOOLEAN: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1630 |
*var->data.bool_ = *result->data.bool_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1631 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1632 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1633 |
case ICONSOLE_VAR_BYTE: |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
518
diff
changeset
|
1634 |
case ICONSOLE_VAR_UINT8: |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1635 |
*var->data.byte_ = *result->data.byte_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1636 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1637 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1638 |
case ICONSOLE_VAR_UINT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1639 |
*var->data.uint16_ = *result->data.uint16_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1640 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1641 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1642 |
case ICONSOLE_VAR_UINT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1643 |
*var->data.uint32_ = *result->data.uint32_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1644 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1645 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1646 |
case ICONSOLE_VAR_INT16: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1647 |
*var->data.int16_ = *result->data.int16_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1648 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1649 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1650 |
case ICONSOLE_VAR_INT32: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1651 |
*var->data.int32_ = *result->data.int32_; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1652 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1653 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1654 |
case ICONSOLE_VAR_POINTER: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1655 |
var->data.addr = result->data.addr; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1656 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1657 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1658 |
case ICONSOLE_VAR_STRING: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1659 |
IConsoleVarSetString(var, result->data.string_); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1660 |
IConsoleVarDump(var, NULL); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1661 |
break; |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1662 |
default: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1663 |
IConsoleError("variable type missmatch"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1664 |
break; |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1665 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1666 |
IConsoleVarHookHandle(var, ICONSOLE_HOOK_AFTER_CHANGE); |
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
|
1667 |
} |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1668 |
|
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1669 |
if (execution_mode == 3) { |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1670 |
IConsoleVarFree(result); |
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
|
1671 |
} |
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
|
1672 |
} |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1673 |
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
|
1674 |
} |
634
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1675 |
case 5: { |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1676 |
// execute an alias |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1677 |
IConsoleAliasExec(alias->cmdline, tokens,tokentypes); |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1678 |
} |
88d9420048db
(svn r1065) -Add: [Console] Alias support. Type 'list_aliases' to show them all (sign_de)
truelight
parents:
618
diff
changeset
|
1679 |
break; |
289
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1680 |
default: |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1681 |
// execution mode invalid |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1682 |
IConsoleError("invalid execution mode"); |
1e1102dd2a62
(svn r295) -Fix: Rewrite and fix of console stuff, including marking (XXX) of areas that require further investigation (Tron)
darkvater
parents:
274
diff
changeset
|
1683 |
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
|
1684 |
} |
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
|
1685 |
|
301
f30c8c628dc6
(svn r307) -Fix: Several potential buffer-overflow fixes, and removal of 'magic-numbers' in favour of constants. (Tron)
darkvater
parents:
289
diff
changeset
|
1686 |
//** freeing the tokenstream **// |
220
dc1710f96b39
(svn r221) -Feature: console command and variable hooking
signde
parents:
209
diff
changeset
|
1687 |
free(tokenstream_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
|
1688 |
} |
1725
97841c222b55
(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
|
1689 |
#endif |