From a277740a855d3e464f52c04c2e747c42f0383dce Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Sun, 16 Jun 2024 13:59:44 -0400 Subject: [PATCH] Use z = 0 when determining distance from camp for food/water No sneaky dialogue access of camps you're not allowed at Remove isherwoods' cabin camp Pass dummy event for camp_taken_over to memorial logger Clang funny stuff --- data/json/obsoletion_and_migration_0.I/camp_placement.json | 4 ---- data/json/overmap/overmap_mutable/farm_isherwood_mutable.json | 2 +- src/basecamp.cpp | 4 ++-- src/faction_camp.cpp | 4 ++++ src/memorial_logger.cpp | 1 + src/npcmove.cpp | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/data/json/obsoletion_and_migration_0.I/camp_placement.json b/data/json/obsoletion_and_migration_0.I/camp_placement.json index 1f651412d5505..1629a78341918 100644 --- a/data/json/obsoletion_and_migration_0.I/camp_placement.json +++ b/data/json/obsoletion_and_migration_0.I/camp_placement.json @@ -35,10 +35,6 @@ "type": "camp_migration", "camp_migrations": { "name": "Cody & Jay", "overmap_terrain": "isolated_house_farm_gunsmith", "faction": "isolated_artisans" } }, - { - "type": "camp_migration", - "camp_migrations": { "name": "Cabin", "overmap_terrain": "cabin_isherwood", "faction": "isherwood_family" } - }, { "type": "camp_migration", "camp_migrations": { "name": "Isherwood Stables", "overmap_terrain": "horse_farm_isherwood_6", "faction": "isherwood_family" } diff --git a/data/json/overmap/overmap_mutable/farm_isherwood_mutable.json b/data/json/overmap/overmap_mutable/farm_isherwood_mutable.json index 60f6de94517e2..c9325bd95e824 100644 --- a/data/json/overmap/overmap_mutable/farm_isherwood_mutable.json +++ b/data/json/overmap/overmap_mutable/farm_isherwood_mutable.json @@ -115,7 +115,7 @@ "farm_isherwood_9_north": { "overmap": "farm_isherwood_9_north" }, "farm_isherwood_8_north": { "overmap": "farm_isherwood_8_north" }, "farm_isherwood_7_north": { "overmap": "farm_isherwood_7_north" }, - "cabin_isherwood_north": { "overmap": "cabin_isherwood_north", "camp": "isherwood_family", "camp_name": "Cabin" }, + "cabin_isherwood_north": { "overmap": "cabin_isherwood_north" }, "cabin_lake_roof_north": { "overmap": "cabin_lake_roof_north" }, "horse_farm_isherwood_1_north": { "overmap": "horse_farm_isherwood_1_north" }, "horse_farm_isherwood_2_north": { "overmap": "horse_farm_isherwood_2_north" }, diff --git a/src/basecamp.cpp b/src/basecamp.cpp index a2006af0664fd..c62ed8159f3a1 100644 --- a/src/basecamp.cpp +++ b/src/basecamp.cpp @@ -879,7 +879,7 @@ void basecamp::handle_takeover_by( faction_id new_owner, bool violent_takeover ) if( checked_camp->get_owner() == get_owner() ) { add_msg_debug( debugmode::DF_CAMPS, "Camp %s at %s is owned by %s, adding it to plunder calculations.", - checked_camp->name, checked_camp->camp_omt_pos().to_string(), get_owner()->name ); + checked_camp->name, checked_camp->camp_omt_pos().to_string_writable(), get_owner()->name ); num_of_owned_camps++; } } @@ -898,7 +898,7 @@ void basecamp::handle_takeover_by( faction_id new_owner, bool violent_takeover ) nutrients taken_from_camp = -captured_with_camp; camp_food_supply( taken_from_camp ); add_msg_debug( debugmode::DF_CAMPS, - "Food supplies of %s plundered by %d kilocalories! Total food supply reduced to %d kilocalories after losing %.1f%% of their camps.", + "Food supplies of %s plundered by %d kilocalories! Total food supply reduced to %d kilocalories after losing %.1f%% of their camps.", fac()->name, captured_with_camp.kcal(), fac()->food_supply.kcal(), 1.0 / static_cast( num_of_owned_camps ) * 100.0 ); set_owner( new_owner ); diff --git a/src/faction_camp.cpp b/src/faction_camp.cpp index a8ba260058568..a37e834848cb6 100644 --- a/src/faction_camp.cpp +++ b/src/faction_camp.cpp @@ -751,6 +751,10 @@ void talk_function::basecamp_mission( npc &p ) return; } basecamp *bcp = *temp_camp; + if( !bcp->allowed_access_by( p ) ) { + popup( _( "%s isn't under your control!" ), bcp->name ); + return; + } bcp->set_by_radio( get_avatar().dialogue_by_radio ); map &here = bcp->get_camp_map(); bcp->form_storage_zones( here, p.get_location() ); diff --git a/src/memorial_logger.cpp b/src/memorial_logger.cpp index 0144a0f025dea..20f8da4c74922 100644 --- a/src/memorial_logger.cpp +++ b/src/memorial_logger.cpp @@ -1113,6 +1113,7 @@ void memorial_logger::notify( const cata::event &e ) // All the events for which we have no memorial log are here case event_type::avatar_enters_omt: case event_type::avatar_moves: + case event_type::camp_taken_over: case event_type::character_consumes_item: case event_type::character_dies: case event_type::character_eats_item: diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 0146b30965724..eb00d020961d7 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -4558,7 +4558,7 @@ bool npc::consume_food_from_camp() Character &player_character = get_player_character(); std::optional potential_bc; for( const tripoint_abs_omt &camp_pos : player_character.camps ) { - if( rl_dist( camp_pos, global_omt_location() ) < 3 ) { + if( rl_dist( camp_pos.xy(), global_omt_location().xy() ) < 3 ) { potential_bc = overmap_buffer.find_camp( camp_pos.xy() ); if( potential_bc ) { break;