# HG changeset patch # User truelight # Date 1133429680 0 # Node ID 06fc915502805f7b2d26de143a7911330d406514 # Parent fc872b9b17a78e070786eee931d71183cabdce76 (svn r3251) -Fix: report errors from GPMI in a more detailed way (Igor2Code) diff -r fc872b9b17a7 -r 06fc91550280 ai/ai.c --- a/ai/ai.c Wed Nov 30 16:10:19 2005 +0000 +++ b/ai/ai.c Thu Dec 01 09:34:40 2005 +0000 @@ -243,6 +243,15 @@ ottd_SetAIParam(_ai.gpmi_param); } + +/** + * Dump an entry of the GPMI error stack (callback routine). This helps the user to trace errors back to their roots. + */ +void AI_PrintErrorStack(gpmi_err_stack_t *entry, char *string) +{ + DEBUG(ai, 0)(string); +} + #endif /* GPMI */ /** @@ -262,6 +271,7 @@ char *params = NULL; ottd_GetNextAIData(&library, ¶ms); + gpmi_error_stack_enable = 1; if (library != NULL) { _ai_player[player].module = gpmi_mod_load(library, params); @@ -271,9 +281,12 @@ free(params); if (_ai_player[player].module == NULL) { - DEBUG(ai, 0)("[AI] Failed to load AI, aborting.."); + DEBUG(ai, 0)("[AI] Failed to load AI, aborting. GPMI error stack:"); + gpmi_err_stack_process_str(AI_PrintErrorStack); return; } + gpmi_error_stack_enable = 0; + } #endif /* GPMI */