MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Script_Error

Function Script_Error

src/script/script.c:156–172  ·  view source on GitHub ↗

* Show a script error with additional information (Type, Index, ..). * @param error The error to show. */

Source from the content-addressed store, hash-verified

154 * @param error The error to show.
155 */
156static 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.

Callers 4

Script_Stack_PushFunction · 0.85
Script_Stack_PopFunction · 0.85
Script_Stack_PeekFunction · 0.85
Script_RunFunction · 0.85

Calls 2

vsnprintfFunction · 0.85
ErrorFunction · 0.50

Tested by

no test coverage detected