Players start with 9 storage in base and it can now be upgraded. It didn't make sense that you have a whole base, but cannot store anything, so now base can hold9 items until upgraded.

This commit is contained in:
Storm Dragon
2026-02-08 00:35:34 -05:00
parent f5dd4f1d25
commit c36e8d3969
8 changed files with 97 additions and 46 deletions

View File

@@ -616,6 +616,7 @@ void reset_game_state() {
undead_residents_pending = 0;
horses_count = 0;
livestock_count = 0;
storage_level = STORAGE_LEVEL_BASE;
current_hour = 8;
current_day = 1;
@@ -668,6 +669,7 @@ void start_new_game() {
spawn_trees(5, 19);
normalize_tree_positions();
init_barricade();
ensure_base_storage();
init_time();
init_weather();
if (player_name.length() == 0) {
@@ -926,6 +928,7 @@ bool save_game_state() {
saveData.set("world_undead_residents_pending", undead_residents_pending);
saveData.set("world_horses_count", horses_count);
saveData.set("world_livestock_count", livestock_count);
saveData.set("world_storage_level", storage_level);
saveData.set("world_expanded_terrain_types", join_string_array(expanded_terrain_types));
string[] treeData;
@@ -1484,6 +1487,13 @@ bool load_game_state_from_file(const string&in filename) {
for (uint i = 0; i < storagePositions.length(); i++) {
add_world_storage(parse_int(storagePositions[i]));
}
int loadedStorageLevel = int(get_number(saveData, "world_storage_level", -1));
if (loadedStorageLevel >= STORAGE_LEVEL_BASE && loadedStorageLevel <= STORAGE_LEVEL_UPGRADE_2) {
storage_level = loadedStorageLevel;
} else {
storage_level = (world_storages.length() > 0) ? STORAGE_LEVEL_UPGRADE_1 : STORAGE_LEVEL_BASE;
}
ensure_base_storage();
string[] pasturePositions = get_string_list_or_split(saveData, "pastures_positions");
for (uint i = 0; i < pasturePositions.length(); i++) {