A few bugs fixed.

This commit is contained in:
Storm Dragon
2026-01-31 14:43:39 -05:00
parent fc4b8d244b
commit f675db3161
3 changed files with 50 additions and 4 deletions

View File

@@ -155,7 +155,7 @@ void reinforce_barricade_max_with_sticks() {
int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford; int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford;
int total_cost = to_do * BARRICADE_STICK_COST; int total_cost = to_do * BARRICADE_STICK_COST;
simulate_crafting(to_do); simulate_crafting(total_cost);
add_personal_count(ITEM_STICKS, -total_cost); add_personal_count(ITEM_STICKS, -total_cost);
barricade_health += (to_do * BARRICADE_STICK_HEALTH); barricade_health += (to_do * BARRICADE_STICK_HEALTH);
if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH; if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH;
@@ -181,7 +181,7 @@ void reinforce_barricade_max_with_vines() {
int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford; int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford;
int total_cost = to_do * BARRICADE_VINE_COST; int total_cost = to_do * BARRICADE_VINE_COST;
simulate_crafting(to_do); simulate_crafting(total_cost);
add_personal_count(ITEM_VINES, -total_cost); add_personal_count(ITEM_VINES, -total_cost);
barricade_health += (to_do * BARRICADE_VINE_HEALTH); barricade_health += (to_do * BARRICADE_VINE_HEALTH);
if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH; if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH;
@@ -207,7 +207,7 @@ void reinforce_barricade_max_with_log() {
int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford; int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford;
int total_cost = to_do * BARRICADE_LOG_COST; int total_cost = to_do * BARRICADE_LOG_COST;
simulate_crafting(to_do); simulate_crafting(total_cost);
add_personal_count(ITEM_LOGS, -total_cost); add_personal_count(ITEM_LOGS, -total_cost);
barricade_health += (to_do * BARRICADE_LOG_HEALTH); barricade_health += (to_do * BARRICADE_LOG_HEALTH);
if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH; if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH;
@@ -233,7 +233,7 @@ void reinforce_barricade_max_with_stones() {
int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford; int to_do = (max_reinforcements < can_afford) ? max_reinforcements : can_afford;
int total_cost = to_do * BARRICADE_STONE_COST; int total_cost = to_do * BARRICADE_STONE_COST;
simulate_crafting(to_do); simulate_crafting(total_cost);
add_personal_count(ITEM_STONES, -total_cost); add_personal_count(ITEM_STONES, -total_cost);
barricade_health += (to_do * BARRICADE_STONE_HEALTH); barricade_health += (to_do * BARRICADE_STONE_HEALTH);
if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH; if (barricade_health > BARRICADE_MAX_HEALTH) barricade_health = BARRICADE_MAX_HEALTH;

View File

@@ -754,6 +754,22 @@ void perform_search(int current_x)
} }
} }
if (!near_stream_bank && !is_mountain_stream_at(current_x)) {
for (uint i = 0; i < world_mountains.length(); i++) {
for (uint j = 0; j < world_mountains[i].stream_positions.length(); j++) {
int stream_world_x = world_mountains[i].start_position + world_mountains[i].stream_positions[j];
if (stream_world_x == current_x) {
continue;
}
if (abs(stream_world_x - current_x) <= 3) {
near_stream_bank = true;
break;
}
}
if (near_stream_bank) break;
}
}
if (near_stream_bank) { if (near_stream_bank) {
try_search_for_terrain("stream_bank"); try_search_for_terrain("stream_bank");
return; return;

View File

@@ -177,6 +177,36 @@ void expand_mountain() {
expanded_terrain_types.insert_last("mountain:" + mountain.terrain_types[i]); expanded_terrain_types.insert_last("mountain:" + mountain.terrain_types[i]);
} }
// Spawn trees in mountain forest/deep_forest segments
int segment_start = -1;
string segment_terrain = "";
for (int i = 0; i < size; i++) {
string terrain = mountain.terrain_types[i];
if (terrain == "forest" || terrain == "deep_forest") {
if (segment_start == -1) {
segment_start = i;
segment_terrain = terrain;
} else if (terrain != segment_terrain) {
int area_start = new_start + segment_start;
int area_end = new_start + i - 1;
spawn_trees(area_start, area_end);
segment_start = i;
segment_terrain = terrain;
}
} else if (segment_start != -1) {
int area_start = new_start + segment_start;
int area_end = new_start + i - 1;
spawn_trees(area_start, area_end);
segment_start = -1;
segment_terrain = "";
}
}
if (segment_start != -1) {
int area_start = new_start + segment_start;
int area_end = new_start + size - 1;
spawn_trees(area_start, area_end);
}
area_expanded_today = true; area_expanded_today = true;
notify("A mountain range has been discovered to the east!"); notify("A mountain range has been discovered to the east!");
} }