хорошая и простая реализация, гораздо лучше аналогов
Начиная с версии 1.4.0 в моде появляется рекурсия
На new.pwn результат тот-же, за исключением:PHP код:
recursion detected: function Dialog_Close indirectly calls itself:
Dialog_Close <- MDialog_ShowPlayerDialog <- Dialog_Close
recursion detected: function Dialog_Interrupt indirectly calls itself:
Dialog_Interrupt <- Dialog_Close <- MDialog_ShowPlayerDialog <- Dialog_Interrupt
recursion detected: function Dialog_IsOpen indirectly calls itself:
Dialog_IsOpen <- FIXES_OnDialogResponse <- Dialog_IsOpen
recursion detected: function FIXES_ShowPlayerDialog indirectly calls itself:
FIXES_ShowPlayerDialog <- MDialog_ShowPlayerDialog <- Dialog_Close <- FIXES_ShowPlayerDialog
recursion detected: function FIXES_strcmp directly calls itself
recursion detected: function MDialog_ShowPlayerDialog indirectly calls itself:
MDialog_ShowPlayerDialog <- Dialog_Close <- MDialog_ShowPlayerDialog
PHP код:
recursion detected: function FIXES_ShowPlayerDialog indirectly calls itself:
FIXES_ShowPlayerDialog <- MDialog_ShowPlayerDialog <- Dialog_Close <- FIXES_ShowPlayerDialog
recursion detected: function FIXES_strcmp directly calls itself
При всем при этом не работает вызов DialogInterrupt:
PHP код:
CMD:test(playerid)
{
SendClientMessage(id, -1, mes);*/
Dialog_Show(playerid, Dialog:test);
return 1;
}
DialogCreate:test(playerid)
{
Dialog_Open(playerid, Dialog:test, DIALOG_STYLE_MSGBOX,
"Hello",
"Are you ok?",
"Yes", "No");
}
DialogResponse:test(playerid, response, listitem, inputtext[])
{
if (!response) {
SendClientMessage(playerid, -1, "This club only for OK guys!");
return 1;
}
SendClientMessage(playerid, -1, "Welcome to the club");
return 1;
}
DialogInterrupt:test(playerid)
{
SendClientMessage(playerid, -1, "Dialog \"test\" was closed by Dialog_Close or by opening other dialog");
return 1;
}
UPD:
Решение проблемы с рекурсией:
Было:
stock MDialog_ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[]) { if (dialogid != -1 && dialogid != MDIALOG_DIALOG_ID) { if (Dialog_IsOpen(playerid, gDialogFunction[playerid])) { Dialog_Close(playerid, gDialogFunction[playerid][4], false); } } } #if defined _ALS_ShowPlayerDialog #undef ShowPlayerDialog #else #define _ALS_ShowPlayerDialog #endif #define ShowPlayerDialog MDialog_ShowPlayerDialog
Стало:
stock MDialog_ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[]) { if (dialogid != -1 && dialogid != MDIALOG_DIALOG_ID) { if (Dialog_IsOpen(playerid, gDialogFunction[playerid][4])) { Dialog_Interrupt(playerid, gDialogFunction[playerid][4]); } } } #if defined _ALS_ShowPlayerDialog #undef ShowPlayerDialog #else #define _ALS_ShowPlayerDialog #endif #define ShowPlayerDialog MDialog_ShowPlayerDialog
Решение проблемы с неработоспособностью DialogInterrupt:
Было:
static stock _Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[]) { if (Dialog_IsOpen(playerid, gDialogFunction[playerid])) { Dialog_Interrupt(playerid, gDialogFunction[playerid][4]); } gIsDialogOpen{playerid} = true; gDialogFunction[playerid] = "dre_"; switch (style) { case DIALOG_STYLE_MSGBOX, DIALOG_STYLE_INPUT, DIALOG_STYLE_PASSWORD: { #if defined MDIALOG_DISABLE_TAGS #else static info_result[MDIALOG_MAX_INFO_SIZE]; _MDialog_ProcessTags(info, info_result); return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info_result, button1, button2); #endif } } }
Стало:
static stock _Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[]) { gIsDialogOpen{playerid} = true; if (Dialog_IsOpen(playerid, gDialogFunction[playerid][4])) { Dialog_Interrupt(playerid, gDialogFunction[playerid][4]); } gDialogFunction[playerid] = "dre_"; switch (style) { case DIALOG_STYLE_MSGBOX, DIALOG_STYLE_INPUT, DIALOG_STYLE_PASSWORD: { #if defined MDIALOG_DISABLE_TAGS #else static info_result[MDIALOG_MAX_INFO_SIZE]; _MDialog_ProcessTags(info, info_result); return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info_result, button1, button2); #endif } } }
PS: Дорабатывалась версия mdialog v1.4.1
Последний раз редактировалось punkochel; 10.06.2020 в 10:52.
Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)