X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2FDevtools%2FConsoleCmds.cpp;h=3ae5e20c149856410f78cd9d6524b6ea5e9d1e1c;hp=10f37e81398eb6cbdf3a0a9701911d38cb04f848;hb=ddbdc1a8a7b22f7a4c03667672436d8744f45c90;hpb=032eb3ccf8e2ccc6a150ac2765eb56daef77942e diff --git a/Source/Devtools/ConsoleCmds.cpp b/Source/Devtools/ConsoleCmds.cpp index 10f37e8..3ae5e20 100644 --- a/Source/Devtools/ConsoleCmds.cpp +++ b/Source/Devtools/ConsoleCmds.cpp @@ -580,7 +580,7 @@ void ch_hs(const char* args) strcat(Hotspot::hotspots.back().text, "\n"); } -void ch_dialogue(const char* args) +void ch_dialog(const char* args) { int type; char buf1[32]; @@ -595,7 +595,7 @@ void ch_dialogue(const char* args) Dialog::whichdialogue = Dialog::dialogs.size(); } -void ch_fixdialogue(const char* args) +void ch_fixdialog(const char* args) { char buf1[32]; int whichdi; @@ -619,11 +619,27 @@ void ch_fixrotation(const char*) Dialog::currentDialog().participantyaw[playerId] = Person::players[playerId]->yaw; } -void ch_ddialogue(const char*) +void ch_ddialog(const char* args) { - if (!Dialog::dialogs.empty()) { + if (Dialog::dialogs.empty() || Dialog::inDialog()) { + return; + } + + int dlg = -1; + sscanf(args, "%d", &dlg); + if (dlg == -1) { + // Remove last entry Dialog::dialogs.pop_back(); + return; } + + if (dlg >= int(Dialog::dialogs.size())) { + // Invalid index, abort + return; + } + + // Erase given index, higher indexes will be decreased by 1 + Dialog::dialogs.erase(Dialog::dialogs.begin() + dlg); } void ch_dhs(const char*)