mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 23:26:34 +00:00
(svn r3251) -Fix: report errors from GPMI in a more detailed way (Igor2Code)
This commit is contained in:
parent
480b1575fe
commit
ea9cb3ee5b
15
ai/ai.c
15
ai/ai.c
@ -243,6 +243,15 @@ void AI_LoadAIControl(void)
|
||||
|
||||
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 @@ void AI_StartNewAI(PlayerID player)
|
||||
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 @@ void AI_StartNewAI(PlayerID player)
|
||||
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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user