strcat(Hotspot::hotspots.back().text, "\n");
}
-void ch_dialogue(const char* args)
+void ch_dialog(const char* args)
{
int type;
char buf1[32];
Dialog::whichdialogue = Dialog::dialogs.size();
}
-void ch_fixdialogue(const char* args)
+void ch_fixdialog(const char* args)
{
char buf1[32];
- int whichdi;
+ int whichdlg = 0;
- sscanf(args, "%d %31s", &whichdi, buf1);
+ sscanf(args, "%d %31s", &whichdlg, buf1);
std::string filename = std::string("Dialogues/") + buf1 + ".txt";
- Dialog::dialogs[whichdi] = Dialog(Dialog::dialogs[whichdi].type, filename);
+ Dialog::dialogs[whichdlg] = Dialog(Dialog::dialogs[whichdlg].type, filename);
}
void ch_fixtype(const char* args)
{
- int dlg;
- sscanf(args, "%d", &dlg);
- Dialog::dialogs[0].type = dlg;
+ int whichdlg = 0;
+ int type = 0;
+ sscanf(args, "%d %d", &whichdlg, &type);
+ Dialog::dialogs[whichdlg].type = type;
}
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*)