* Show a script error with additional information (Type, Index, ..). * @param error The error to show. */
| 154 | * @param error The error to show. |
| 155 | */ |
| 156 | static void Script_Error(const char *error, ...) |
| 157 | { |
| 158 | static const char *l_types[4] = { "Unit", "Structure", "Team", "Unknown" }; |
| 159 | const char *type = l_types[3]; |
| 160 | char buffer[256]; |
| 161 | va_list va; |
| 162 | |
| 163 | if (g_scriptCurrentUnit != NULL) type = l_types[0]; |
| 164 | if (g_scriptCurrentStructure != NULL) type = l_types[1]; |
| 165 | if (g_scriptCurrentTeam != NULL) type = l_types[2]; |
| 166 | |
| 167 | va_start(va, error); |
| 168 | vsnprintf(buffer, sizeof(buffer), error, va); |
| 169 | va_end(va); |
| 170 | |
| 171 | Error("[SCRIPT] %s; Type: %s; Index: %d; Type: %d;\n", buffer, type, g_scriptCurrentObject->index, g_scriptCurrentObject->type); |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Push a value on the stack. |
no test coverage detected