| 59 g_GlobalVariables[u] = NULL; |
59 g_GlobalVariables[u] = NULL; |
| 60 } |
60 } |
| 61 |
61 |
| 62 // Tries to declare a new global-scope variable. Returns pointer |
62 // Tries to declare a new global-scope variable. Returns pointer |
| 63 // to new global variable, NULL if declaration failed. |
63 // to new global variable, NULL if declaration failed. |
| 64 ScriptVar* DeclareGlobalVariable (ScriptReader* r, str name, int type) { |
64 ScriptVar* DeclareGlobalVariable (ScriptReader* r, str name) { |
| 65 // Apparently the Zandronum engine does not support string variables.. |
|
| 66 if (type == RETURNVAL_VOID || type == RETURNVAL_STRING) |
|
| 67 return NULL; |
|
| 68 |
|
| 69 // Find a NULL pointer to a global variable |
65 // Find a NULL pointer to a global variable |
| 70 ScriptVar* g; |
66 ScriptVar* g; |
| 71 unsigned int u = 0; |
67 unsigned int u = 0; |
| 72 ITERATE_GLOBAL_VARS (u) { |
68 ITERATE_GLOBAL_VARS (u) { |
| 73 // Check that it doesn't exist already |
69 // Check that it doesn't exist already |
| 99 if (!g) |
93 if (!g) |
| 100 r->ParserError ("global variable %s not declared", name.chars()); |
94 r->ParserError ("global variable %s not declared", name.chars()); |
| 101 }*/ |
95 }*/ |
| 102 |
96 |
| 103 // Find a global variable by name |
97 // Find a global variable by name |
| 104 /* ScriptVar* FindScriptVariable (str name) { |
98 ScriptVar* FindGlobalVariable (str name) { |
| 105 ScriptVar* g; |
99 unsigned int u = 0; |
| 106 ITERATE_SCRIPT_VARS (g) |
100 ITERATE_GLOBAL_VARS (u) { |
| |
101 ScriptVar* g = g_GlobalVariables[u]; |
| |
102 if (!g) |
| |
103 return NULL; |
| |
104 |
| 107 if (!g->name.compare (name)) |
105 if (!g->name.compare (name)) |
| 108 return g; |
106 return g; |
| |
107 } |
| 109 |
108 |
| 110 return NULL; |
109 return NULL; |
| 111 }*/ |
110 } |
| 112 |
111 |
| 113 unsigned int CountGlobalVars () { |
112 unsigned int CountGlobalVars () { |
| 114 ScriptVar* var; |
|
| 115 unsigned int count = 0; |
113 unsigned int count = 0; |
| 116 unsigned int u = 0; |
114 unsigned int u = 0; |
| 117 ITERATE_GLOBAL_VARS (u) { |
115 ITERATE_GLOBAL_VARS (u) { |
| 118 if (g_GlobalVariables[u] != NULL) |
116 if (g_GlobalVariables[u] != NULL) |
| 119 count++; |
117 count++; |