/** * @brief Shows the next dialog (if any). */ void DialogBox::show_next_dialog() { const std::string& next_dialog_id = (dialog.is_question() && last_answer == 1) ? dialog.get_next2() : dialog.get_next(); if (next_dialog_id.size() > 0 && next_dialog_id != "_unknown") { start_dialog(next_dialog_id); } else { close(); } }
int main(int argc, char** argv) { if(argc <= 1) return start_dialog(argc, argv); /* do not see possible flags as commands */ if(argv[1][0] == '-') { help(); return 0; } String args; unsigned int alen; for(int i = 1; i < argc; i++) { args += argv[i]; args += ' '; } alen = args.length(); /* remove start/ending quotes and spaces */ if((args[0] == '"') || isspace(args[0]) || (args[alen - 1] == '"') || isspace(args[alen - 1])) { int i; char *copy = strdup(args.c_str()); char *ptr = copy; /* remove ending first */ for(i = (int)alen - 1; i > 0 && (ptr[i] == '"' || isspace(ptr[i])); i--) ; ptr[i + 1] = 0; /* remove then starting */ for(; *ptr && (*ptr == '"' || isspace(*ptr)); ptr++) ; start_child(ptr); free(copy); } else { start_child(args.c_str()); } return 0; }