Fix up building menu a bit.
This commit is contained in:
+46
-16
@@ -216,15 +216,44 @@ void run_buildings_menu() {
|
||||
screen_reader_speak("Buildings.", true);
|
||||
|
||||
int selection = 0;
|
||||
string[] options = {
|
||||
"Firepit (9 Stones)",
|
||||
"Fire (2 Sticks, 1 Log) [Requires Firepit]",
|
||||
"Herb Garden (9 Stones, 3 Vines, 2 Logs) [Base Only]",
|
||||
"Storage (6 Logs, 9 Stones, 8 Vines) [Base Only]",
|
||||
"Pasture (8 Logs, 20 Vines) [Base Only]",
|
||||
"Stable (10 Logs, 15 Stones, 10 Vines) [Base Only]",
|
||||
"Altar (9 Stones, 3 Sticks) [Base Only]"
|
||||
};
|
||||
string[] options;
|
||||
int[] building_types;
|
||||
|
||||
// Firepit and Fire are always available
|
||||
options.insert_last("Firepit (9 Stones)");
|
||||
building_types.insert_last(0);
|
||||
options.insert_last("Fire (2 Sticks, 1 Log) [Requires Firepit]");
|
||||
building_types.insert_last(1);
|
||||
|
||||
// Only show herb garden if not already built in base
|
||||
if (get_herb_garden_at_base() == null) {
|
||||
options.insert_last("Herb Garden (9 Stones, 3 Vines, 2 Logs) [Base Only]");
|
||||
building_types.insert_last(2);
|
||||
}
|
||||
|
||||
// Only show storage if none built yet
|
||||
if (world_storages.length() == 0) {
|
||||
options.insert_last("Storage (6 Logs, 9 Stones, 8 Vines) [Base Only]");
|
||||
building_types.insert_last(3);
|
||||
}
|
||||
|
||||
// Only show pasture if not built
|
||||
if (world_pastures.length() == 0) {
|
||||
options.insert_last("Pasture (8 Logs, 20 Vines) [Base Only]");
|
||||
building_types.insert_last(4);
|
||||
}
|
||||
|
||||
// Only show stable if not built
|
||||
if (world_stables.length() == 0) {
|
||||
options.insert_last("Stable (10 Logs, 15 Stones, 10 Vines) [Base Only]");
|
||||
building_types.insert_last(5);
|
||||
}
|
||||
|
||||
// Only show altar if not built
|
||||
if (world_altars.length() == 0) {
|
||||
options.insert_last("Altar (9 Stones, 3 Sticks) [Base Only]");
|
||||
building_types.insert_last(6);
|
||||
}
|
||||
|
||||
while(true) {
|
||||
wait(5);
|
||||
@@ -247,13 +276,14 @@ void run_buildings_menu() {
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
if (selection == 0) craft_firepit();
|
||||
else if (selection == 1) craft_campfire();
|
||||
else if (selection == 2) craft_herb_garden();
|
||||
else if (selection == 3) craft_storage();
|
||||
else if (selection == 4) craft_pasture();
|
||||
else if (selection == 5) craft_stable();
|
||||
else if (selection == 6) craft_altar();
|
||||
int building = building_types[selection];
|
||||
if (building == 0) craft_firepit();
|
||||
else if (building == 1) craft_campfire();
|
||||
else if (building == 2) craft_herb_garden();
|
||||
else if (building == 3) craft_storage();
|
||||
else if (building == 4) craft_pasture();
|
||||
else if (building == 5) craft_stable();
|
||||
else if (building == 6) craft_altar();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user