Populate flag and var dropdown menus with their respective constants

This commit is contained in:
Marcus Huderle
2018-03-02 21:54:08 -08:00
parent 2bc949612d
commit 669c81b50b
3 changed files with 78 additions and 29 deletions

View File

@@ -285,6 +285,8 @@ void MainWindow::loadDataStructures() {
project->readMapAttributesTable();
project->readAllMapAttributes();
project->readItemNames();
project->readFlagNames();
project->readVarNames();
}
void MainWindow::populateMapList() {
@@ -570,8 +572,8 @@ void MainWindow::updateSelectedObjects() {
field_labels["sight_radius"] = "Sight Radius";
field_labels["destination_warp"] = "Destination Warp";
field_labels["destination_map_name"] = "Destination Map";
field_labels["coord_unknown1"] = "Unknown 1";
field_labels["coord_unknown2"] = "Unknown 2";
field_labels["script_var"] = "Var";
field_labels["script_var_value"] = "Var Value";
field_labels["type"] = "Type";
field_labels["item"] = "Item";
field_labels["item_unknown5"] = "Unknown 5";
@@ -614,8 +616,8 @@ void MainWindow::updateSelectedObjects() {
}
else if (event_type == "trap") {
fields << "script_label";
fields << "coord_unknown1";
fields << "coord_unknown2";
fields << "script_var";
fields << "script_var_value";
}
else if (event_type == "trap_weather") {
fields << "weather";
@@ -650,6 +652,16 @@ void MainWindow::updateSelectedObjects() {
combo->addItem(value);
}
combo->addItems(*editor->project->itemNames);
} else if (key == "flag") {
if (!editor->project->flagNames->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->flagNames);
} else if (key == "script_var") {
if (!editor->project->varNames->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->varNames);
} else {
combo->addItem(value);
}