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:
@@ -127,7 +127,7 @@ void attempt_resident_fishing() {
|
|||||||
if (residents_count <= 0) return;
|
if (residents_count <= 0) return;
|
||||||
if (get_storage_count(ITEM_FISHING_POLES) <= 0) return;
|
if (get_storage_count(ITEM_FISHING_POLES) <= 0) return;
|
||||||
if (!has_any_streams()) return;
|
if (!has_any_streams()) return;
|
||||||
if (get_storage_count(ITEM_FISH) >= BASE_STORAGE_MAX) return;
|
if (get_storage_count(ITEM_FISH) >= get_storage_stack_limit()) return;
|
||||||
|
|
||||||
int active_fishers = residents_count;
|
int active_fishers = residents_count;
|
||||||
int poles = get_storage_count(ITEM_FISHING_POLES);
|
int poles = get_storage_count(ITEM_FISHING_POLES);
|
||||||
@@ -144,7 +144,7 @@ void attempt_resident_fishing() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (random(1, 100) > fishing_chance) continue;
|
if (random(1, 100) > fishing_chance) continue;
|
||||||
if (get_storage_count(ITEM_FISH) >= BASE_STORAGE_MAX) break;
|
if (get_storage_count(ITEM_FISH) >= get_storage_stack_limit()) break;
|
||||||
add_storage_count(ITEM_FISH, 1);
|
add_storage_count(ITEM_FISH, 1);
|
||||||
add_storage_fish_weight(random(FISH_WEIGHT_MIN, FISH_WEIGHT_MAX));
|
add_storage_fish_weight(random(FISH_WEIGHT_MIN, FISH_WEIGHT_MAX));
|
||||||
caught++;
|
caught++;
|
||||||
@@ -186,7 +186,7 @@ void attempt_resident_fish_smoking() {
|
|||||||
|
|
||||||
int weight = (storage_fish_weights.length() > 0) ? storage_fish_weights[0] : get_default_fish_weight();
|
int weight = (storage_fish_weights.length() > 0) ? storage_fish_weights[0] : get_default_fish_weight();
|
||||||
int yield = get_smoked_fish_yield(weight);
|
int yield = get_smoked_fish_yield(weight);
|
||||||
if (get_storage_count(ITEM_SMOKED_FISH) + yield > BASE_STORAGE_MAX) return;
|
if (get_storage_count(ITEM_SMOKED_FISH) + yield > get_storage_stack_limit()) return;
|
||||||
|
|
||||||
pop_storage_fish_weight();
|
pop_storage_fish_weight();
|
||||||
add_storage_count(ITEM_FISH, -1);
|
add_storage_count(ITEM_FISH, -1);
|
||||||
@@ -212,21 +212,21 @@ void attempt_livestock_production() {
|
|||||||
int feathers_produced = 0;
|
int feathers_produced = 0;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (get_storage_count(ITEM_MEAT) < BASE_STORAGE_MAX) {
|
if (get_storage_count(ITEM_MEAT) < get_storage_stack_limit()) {
|
||||||
if (random(1, 100) <= LIVESTOCK_MEAT_CHANCE) {
|
if (random(1, 100) <= LIVESTOCK_MEAT_CHANCE) {
|
||||||
add_storage_count(ITEM_MEAT, 1);
|
add_storage_count(ITEM_MEAT, 1);
|
||||||
meat_produced++;
|
meat_produced++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_storage_count(ITEM_SKINS) < BASE_STORAGE_MAX) {
|
if (get_storage_count(ITEM_SKINS) < get_storage_stack_limit()) {
|
||||||
if (random(1, 100) <= LIVESTOCK_SKIN_CHANCE) {
|
if (random(1, 100) <= LIVESTOCK_SKIN_CHANCE) {
|
||||||
add_storage_count(ITEM_SKINS, 1);
|
add_storage_count(ITEM_SKINS, 1);
|
||||||
skins_produced++;
|
skins_produced++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_storage_count(ITEM_FEATHERS) < BASE_STORAGE_MAX) {
|
if (get_storage_count(ITEM_FEATHERS) < get_storage_stack_limit()) {
|
||||||
if (random(1, 100) <= LIVESTOCK_FEATHER_CHANCE) {
|
if (random(1, 100) <= LIVESTOCK_FEATHER_CHANCE) {
|
||||||
add_storage_count(ITEM_FEATHERS, 1);
|
add_storage_count(ITEM_FEATHERS, 1);
|
||||||
feathers_produced++;
|
feathers_produced++;
|
||||||
@@ -573,7 +573,7 @@ void process_daily_weapon_breakage() {
|
|||||||
void attempt_resident_clothing_repairs() {
|
void attempt_resident_clothing_repairs() {
|
||||||
if (residents_count <= 0) return;
|
if (residents_count <= 0) return;
|
||||||
|
|
||||||
int threshold = BASE_STORAGE_MAX / 2;
|
int threshold = get_storage_stack_limit() / 2;
|
||||||
if (threshold < RESIDENT_CLOTHING_REPAIR_COST) {
|
if (threshold < RESIDENT_CLOTHING_REPAIR_COST) {
|
||||||
threshold = RESIDENT_CLOTHING_REPAIR_COST;
|
threshold = RESIDENT_CLOTHING_REPAIR_COST;
|
||||||
}
|
}
|
||||||
@@ -678,7 +678,7 @@ void attempt_resident_snare_retrieval() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if storage has room for small game
|
// Check if storage has room for small game
|
||||||
if (get_storage_count(ITEM_SMALL_GAME) >= BASE_STORAGE_MAX) continue;
|
if (get_storage_count(ITEM_SMALL_GAME) >= get_storage_stack_limit()) continue;
|
||||||
|
|
||||||
// Retrieve the game
|
// Retrieve the game
|
||||||
string game_type = snare.catch_type;
|
string game_type = snare.catch_type;
|
||||||
@@ -761,11 +761,11 @@ void attempt_resident_butchering() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check storage capacity for outputs
|
// Check storage capacity for outputs
|
||||||
if (meat_yield > 0 && get_storage_count(ITEM_MEAT) + meat_yield > BASE_STORAGE_MAX) return;
|
if (meat_yield > 0 && get_storage_count(ITEM_MEAT) + meat_yield > get_storage_stack_limit()) return;
|
||||||
if (skins_yield > 0 && get_storage_count(ITEM_SKINS) + skins_yield > BASE_STORAGE_MAX) return;
|
if (skins_yield > 0 && get_storage_count(ITEM_SKINS) + skins_yield > get_storage_stack_limit()) return;
|
||||||
if (feathers_yield > 0 && get_storage_count(ITEM_FEATHERS) + feathers_yield > BASE_STORAGE_MAX) return;
|
if (feathers_yield > 0 && get_storage_count(ITEM_FEATHERS) + feathers_yield > get_storage_stack_limit()) return;
|
||||||
if (down_yield > 0 && get_storage_count(ITEM_DOWN) + down_yield > BASE_STORAGE_MAX) return;
|
if (down_yield > 0 && get_storage_count(ITEM_DOWN) + down_yield > get_storage_stack_limit()) return;
|
||||||
if (sinew_yield > 0 && get_storage_count(ITEM_SINEW) + sinew_yield > BASE_STORAGE_MAX) return;
|
if (sinew_yield > 0 && get_storage_count(ITEM_SINEW) + sinew_yield > get_storage_stack_limit()) return;
|
||||||
|
|
||||||
// Consume the game
|
// Consume the game
|
||||||
if (is_boar) {
|
if (is_boar) {
|
||||||
@@ -896,7 +896,7 @@ void attempt_resident_foraging() {
|
|||||||
if (get_storage_count(ITEM_REED_BASKETS) <= 0) return;
|
if (get_storage_count(ITEM_REED_BASKETS) <= 0) return;
|
||||||
|
|
||||||
// Check if storage has room for basket food
|
// Check if storage has room for basket food
|
||||||
if (get_storage_count(ITEM_BASKET_FOOD) >= BASE_STORAGE_MAX) return;
|
if (get_storage_count(ITEM_BASKET_FOOD) >= get_storage_stack_limit()) return;
|
||||||
|
|
||||||
// Number of residents who can forage = min(residents, baskets)
|
// Number of residents who can forage = min(residents, baskets)
|
||||||
int active_foragers = (residents_count < get_storage_count(ITEM_REED_BASKETS)) ? residents_count : get_storage_count(ITEM_REED_BASKETS);
|
int active_foragers = (residents_count < get_storage_count(ITEM_REED_BASKETS)) ? residents_count : get_storage_count(ITEM_REED_BASKETS);
|
||||||
@@ -917,7 +917,7 @@ void attempt_resident_foraging() {
|
|||||||
if (random(1, 100) > forage_chance) continue;
|
if (random(1, 100) > forage_chance) continue;
|
||||||
|
|
||||||
// Check storage capacity
|
// Check storage capacity
|
||||||
if (get_storage_count(ITEM_BASKET_FOOD) >= BASE_STORAGE_MAX) break;
|
if (get_storage_count(ITEM_BASKET_FOOD) >= get_storage_stack_limit()) break;
|
||||||
|
|
||||||
// Consume a reed basket and produce a basket of fruits and nuts
|
// Consume a reed basket and produce a basket of fruits and nuts
|
||||||
add_storage_count(ITEM_REED_BASKETS, -1);
|
add_storage_count(ITEM_REED_BASKETS, -1);
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ void update_hideout_bandits() {
|
|||||||
|
|
||||||
int add_hideout_storage_item(int itemType, int amount) {
|
int add_hideout_storage_item(int itemType, int amount) {
|
||||||
if (amount <= 0) return 0;
|
if (amount <= 0) return 0;
|
||||||
int capacity = BASE_STORAGE_MAX - get_storage_count(itemType);
|
int capacity = get_storage_stack_limit() - get_storage_count(itemType);
|
||||||
if (capacity <= 0) return 0;
|
if (capacity <= 0) return 0;
|
||||||
int addedAmount = amount;
|
int addedAmount = amount;
|
||||||
if (addedAmount > capacity) addedAmount = capacity;
|
if (addedAmount > capacity) addedAmount = capacity;
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ int walk_speed = BASE_WALK_SPEED;
|
|||||||
int jump_speed = 170;
|
int jump_speed = 170;
|
||||||
const int MAX_ITEM_STACK = 9;
|
const int MAX_ITEM_STACK = 9;
|
||||||
const int POUCH_STACK_BONUS = 2;
|
const int POUCH_STACK_BONUS = 2;
|
||||||
const int BASE_STORAGE_MAX = 50;
|
const int STORAGE_LEVEL_BASE = 0;
|
||||||
|
const int STORAGE_LEVEL_UPGRADE_1 = 1;
|
||||||
|
const int STORAGE_LEVEL_UPGRADE_2 = 2;
|
||||||
|
const int BASE_STORAGE_START_MAX = 9;
|
||||||
|
const int BASE_STORAGE_UPGRADE_1_MAX = 50;
|
||||||
|
const int BASE_STORAGE_UPGRADE_2_MAX = 100;
|
||||||
const int BLESSING_HEAL_AMOUNT = 3;
|
const int BLESSING_HEAL_AMOUNT = 3;
|
||||||
const int BLESSING_BARRICADE_REPAIR = 20;
|
const int BLESSING_BARRICADE_REPAIR = 20;
|
||||||
const int BLESSING_SPEED_DURATION = 300000;
|
const int BLESSING_SPEED_DURATION = 300000;
|
||||||
@@ -126,6 +131,9 @@ const int BARRICADE_STONE_HEALTH = 20;
|
|||||||
const int STORAGE_LOG_COST = 6;
|
const int STORAGE_LOG_COST = 6;
|
||||||
const int STORAGE_STONE_COST = 9;
|
const int STORAGE_STONE_COST = 9;
|
||||||
const int STORAGE_VINE_COST = 8;
|
const int STORAGE_VINE_COST = 8;
|
||||||
|
const int STORAGE_UPGRADE2_LOG_COST = 12;
|
||||||
|
const int STORAGE_UPGRADE2_STONE_COST = 18;
|
||||||
|
const int STORAGE_UPGRADE2_VINE_COST = 16;
|
||||||
const int PASTURE_LOG_COST = 8;
|
const int PASTURE_LOG_COST = 8;
|
||||||
const int PASTURE_ROPE_COST = 18;
|
const int PASTURE_ROPE_COST = 18;
|
||||||
const int STABLE_LOG_COST = 10;
|
const int STABLE_LOG_COST = 10;
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ bool has_building_options() {
|
|||||||
if (x > BASE_END || !base_has_firepit) return true;
|
if (x > BASE_END || !base_has_firepit) return true;
|
||||||
if (x > BASE_END || !base_has_fire) return true;
|
if (x > BASE_END || !base_has_fire) return true;
|
||||||
if (get_herb_garden_at_base() == null) return true;
|
if (get_herb_garden_at_base() == null) return true;
|
||||||
if (world_storages.length() == 0) return true;
|
if (storage_level < STORAGE_LEVEL_UPGRADE_2) return true;
|
||||||
if (world_pastures.length() == 0 && world_storages.length() > 0) return true;
|
if (world_pastures.length() == 0 && storage_level >= STORAGE_LEVEL_UPGRADE_1) return true;
|
||||||
if (world_stables.length() == 0 && world_storages.length() > 0) return true;
|
if (world_stables.length() == 0 && storage_level >= STORAGE_LEVEL_UPGRADE_1) return true;
|
||||||
if (world_altars.length() == 0) return true;
|
if (world_altars.length() == 0) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -64,21 +64,24 @@ void run_buildings_menu() {
|
|||||||
building_types.insert_last(2);
|
building_types.insert_last(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show storage if none built yet
|
// Storage upgrades
|
||||||
if (world_storages.length() == 0) {
|
if (storage_level < STORAGE_LEVEL_UPGRADE_1) {
|
||||||
options.insert_last("Storage (6 Logs, 9 Stones, 8 Vines) [Base Only]");
|
options.insert_last("Upgrade Storage (6 Logs, 9 Stones, 8 Vines) [Base Only, 50 each]");
|
||||||
|
building_types.insert_last(3);
|
||||||
|
} else if (storage_level == STORAGE_LEVEL_UPGRADE_1) {
|
||||||
|
options.insert_last("Upgrade Storage (12 Logs, 18 Stones, 16 Vines) [Base Only, 100 each]");
|
||||||
building_types.insert_last(3);
|
building_types.insert_last(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show pasture if not built and storage exists
|
// Only show pasture if not built and storage is upgraded
|
||||||
if (world_pastures.length() == 0 && world_storages.length() > 0) {
|
if (world_pastures.length() == 0 && storage_level >= STORAGE_LEVEL_UPGRADE_1) {
|
||||||
options.insert_last("Pasture (8 Logs, 18 Ropes) [Base Only, Requires Storage]");
|
options.insert_last("Pasture (8 Logs, 18 Ropes) [Base Only, Requires Storage Upgrade]");
|
||||||
building_types.insert_last(4);
|
building_types.insert_last(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show stable if not built and storage exists
|
// Only show stable if not built and storage is upgraded
|
||||||
if (world_stables.length() == 0 && world_storages.length() > 0) {
|
if (world_stables.length() == 0 && storage_level >= STORAGE_LEVEL_UPGRADE_1) {
|
||||||
options.insert_last("Stable (10 Logs, 15 Stones, 10 Vines) [Base Only, Requires Storage]");
|
options.insert_last("Stable (10 Logs, 15 Stones, 10 Vines) [Base Only, Requires Storage Upgrade]");
|
||||||
building_types.insert_last(5);
|
building_types.insert_last(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,22 +232,39 @@ void craft_storage() {
|
|||||||
speak_with_history("Storage must be built in the base.", true);
|
speak_with_history("Storage must be built in the base.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (world_storages.length() > 0) {
|
if (storage_level >= STORAGE_LEVEL_UPGRADE_2) {
|
||||||
speak_with_history("Storage already built.", true);
|
speak_with_history("Storage is fully upgraded.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string missing = "";
|
string missing = "";
|
||||||
if (get_personal_count(ITEM_LOGS) < STORAGE_LOG_COST) missing += STORAGE_LOG_COST + " logs ";
|
int logCost = STORAGE_LOG_COST;
|
||||||
if (get_personal_count(ITEM_STONES) < STORAGE_STONE_COST) missing += STORAGE_STONE_COST + " stones ";
|
int stoneCost = STORAGE_STONE_COST;
|
||||||
if (get_personal_count(ITEM_VINES) < STORAGE_VINE_COST) missing += STORAGE_VINE_COST + " vines ";
|
int vineCost = STORAGE_VINE_COST;
|
||||||
|
int targetLevel = STORAGE_LEVEL_UPGRADE_1;
|
||||||
|
int newCapacity = BASE_STORAGE_UPGRADE_1_MAX;
|
||||||
|
int craftTime = 23;
|
||||||
|
if (storage_level >= STORAGE_LEVEL_UPGRADE_1) {
|
||||||
|
logCost = STORAGE_UPGRADE2_LOG_COST;
|
||||||
|
stoneCost = STORAGE_UPGRADE2_STONE_COST;
|
||||||
|
vineCost = STORAGE_UPGRADE2_VINE_COST;
|
||||||
|
targetLevel = STORAGE_LEVEL_UPGRADE_2;
|
||||||
|
newCapacity = BASE_STORAGE_UPGRADE_2_MAX;
|
||||||
|
craftTime = 46;
|
||||||
|
}
|
||||||
|
if (get_personal_count(ITEM_LOGS) < logCost) missing += logCost + " logs ";
|
||||||
|
if (get_personal_count(ITEM_STONES) < stoneCost) missing += stoneCost + " stones ";
|
||||||
|
if (get_personal_count(ITEM_VINES) < vineCost) missing += vineCost + " vines ";
|
||||||
|
|
||||||
if (missing == "") {
|
if (missing == "") {
|
||||||
simulate_crafting(23);
|
simulate_crafting(craftTime);
|
||||||
add_personal_count(ITEM_LOGS, -STORAGE_LOG_COST);
|
add_personal_count(ITEM_LOGS, -logCost);
|
||||||
add_personal_count(ITEM_STONES, -STORAGE_STONE_COST);
|
add_personal_count(ITEM_STONES, -stoneCost);
|
||||||
add_personal_count(ITEM_VINES, -STORAGE_VINE_COST);
|
add_personal_count(ITEM_VINES, -vineCost);
|
||||||
add_world_storage(x);
|
if (world_storages.length() == 0) {
|
||||||
speak_with_history("Storage built.", true);
|
add_world_storage(x);
|
||||||
|
}
|
||||||
|
storage_level = targetLevel;
|
||||||
|
speak_with_history("Storage upgraded. Capacity is now " + newCapacity + " per item.", true);
|
||||||
} else {
|
} else {
|
||||||
speak_with_history("Missing: " + missing, true);
|
speak_with_history("Missing: " + missing, true);
|
||||||
}
|
}
|
||||||
@@ -255,8 +275,8 @@ void craft_pasture() {
|
|||||||
speak_with_history("Pasture must be built in the base.", true);
|
speak_with_history("Pasture must be built in the base.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (world_storages.length() == 0) {
|
if (storage_level < STORAGE_LEVEL_UPGRADE_1) {
|
||||||
speak_with_history("Storage must be built before a pasture.", true);
|
speak_with_history("Storage must be upgraded before a pasture.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (world_pastures.length() > 0) {
|
if (world_pastures.length() > 0) {
|
||||||
@@ -283,8 +303,8 @@ void craft_stable() {
|
|||||||
speak_with_history("Stable must be built in the base.", true);
|
speak_with_history("Stable must be built in the base.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (world_storages.length() == 0) {
|
if (storage_level < STORAGE_LEVEL_UPGRADE_1) {
|
||||||
speak_with_history("Storage must be built before a stable.", true);
|
speak_with_history("Storage must be upgraded before a stable.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (world_stables.length() > 0) {
|
if (world_stables.length() > 0) {
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ int get_personal_stack_limit() {
|
|||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_storage_stack_limit() {
|
||||||
|
if (storage_level <= STORAGE_LEVEL_BASE) return BASE_STORAGE_START_MAX;
|
||||||
|
if (storage_level == STORAGE_LEVEL_UPGRADE_1) return BASE_STORAGE_UPGRADE_1_MAX;
|
||||||
|
return BASE_STORAGE_UPGRADE_2_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
int get_arrow_limit() {
|
int get_arrow_limit() {
|
||||||
// Quiver required to hold arrows
|
// Quiver required to hold arrows
|
||||||
// Each quiver holds 12 arrows
|
// Each quiver holds 12 arrows
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void deposit_item(int item_type) {
|
|||||||
speak_with_history("Nothing to deposit.", true);
|
speak_with_history("Nothing to deposit.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int capacity = BASE_STORAGE_MAX - get_storage_count(item_type);
|
int capacity = get_storage_stack_limit() - get_storage_count(item_type);
|
||||||
if (capacity <= 0) {
|
if (capacity <= 0) {
|
||||||
speak_with_history("Storage for that item is full.", true);
|
speak_with_history("Storage for that item is full.", true);
|
||||||
return;
|
return;
|
||||||
@@ -119,7 +119,7 @@ void deposit_item_max(int item_type) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int capacity = BASE_STORAGE_MAX - get_storage_count(item_type);
|
int capacity = get_storage_stack_limit() - get_storage_count(item_type);
|
||||||
if (capacity <= 0) {
|
if (capacity <= 0) {
|
||||||
speak_with_history("Storage for that item is full.", true);
|
speak_with_history("Storage for that item is full.", true);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -616,6 +616,7 @@ void reset_game_state() {
|
|||||||
undead_residents_pending = 0;
|
undead_residents_pending = 0;
|
||||||
horses_count = 0;
|
horses_count = 0;
|
||||||
livestock_count = 0;
|
livestock_count = 0;
|
||||||
|
storage_level = STORAGE_LEVEL_BASE;
|
||||||
|
|
||||||
current_hour = 8;
|
current_hour = 8;
|
||||||
current_day = 1;
|
current_day = 1;
|
||||||
@@ -668,6 +669,7 @@ void start_new_game() {
|
|||||||
spawn_trees(5, 19);
|
spawn_trees(5, 19);
|
||||||
normalize_tree_positions();
|
normalize_tree_positions();
|
||||||
init_barricade();
|
init_barricade();
|
||||||
|
ensure_base_storage();
|
||||||
init_time();
|
init_time();
|
||||||
init_weather();
|
init_weather();
|
||||||
if (player_name.length() == 0) {
|
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_undead_residents_pending", undead_residents_pending);
|
||||||
saveData.set("world_horses_count", horses_count);
|
saveData.set("world_horses_count", horses_count);
|
||||||
saveData.set("world_livestock_count", livestock_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));
|
saveData.set("world_expanded_terrain_types", join_string_array(expanded_terrain_types));
|
||||||
|
|
||||||
string[] treeData;
|
string[] treeData;
|
||||||
@@ -1484,6 +1487,13 @@ bool load_game_state_from_file(const string&in filename) {
|
|||||||
for (uint i = 0; i < storagePositions.length(); i++) {
|
for (uint i = 0; i < storagePositions.length(); i++) {
|
||||||
add_world_storage(parse_int(storagePositions[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");
|
string[] pasturePositions = get_string_list_or_split(saveData, "pastures_positions");
|
||||||
for (uint i = 0; i < pasturePositions.length(); i++) {
|
for (uint i = 0; i < pasturePositions.length(); i++) {
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ WorldAltar@[] world_altars;
|
|||||||
|
|
||||||
int horses_count = 0;
|
int horses_count = 0;
|
||||||
int livestock_count = 0;
|
int livestock_count = 0;
|
||||||
|
int storage_level = STORAGE_LEVEL_BASE;
|
||||||
|
|
||||||
// Add functions
|
// Add functions
|
||||||
void add_world_firepit(int pos) {
|
void add_world_firepit(int pos) {
|
||||||
@@ -74,6 +75,12 @@ void add_world_storage(int pos) {
|
|||||||
world_storages.insert_last(s);
|
world_storages.insert_last(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ensure_base_storage() {
|
||||||
|
if (world_storages.length() == 0) {
|
||||||
|
add_world_storage(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void add_world_pasture(int pos) {
|
void add_world_pasture(int pos) {
|
||||||
WorldPasture@ p = WorldPasture(pos);
|
WorldPasture@ p = WorldPasture(pos);
|
||||||
world_pastures.insert_last(p);
|
world_pastures.insert_last(p);
|
||||||
|
|||||||
Reference in New Issue
Block a user