Skip to content

Commit

Permalink
Use z = 0 when determining distance from camp for food/water
Browse files Browse the repository at this point in the history
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
  • Loading branch information
RenechCDDA committed Jun 16, 2024
1 parent 482fdba commit a277740
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
4 changes: 0 additions & 4 deletions data/json/obsoletion_and_migration_0.I/camp_placement.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
4 changes: 2 additions & 2 deletions src/basecamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand All @@ -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<double>( num_of_owned_camps ) * 100.0 );
set_owner( new_owner );
Expand Down
4 changes: 4 additions & 0 deletions src/faction_camp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
1 change: 1 addition & 0 deletions src/memorial_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4558,7 +4558,7 @@ bool npc::consume_food_from_camp()
Character &player_character = get_player_character();
std::optional<basecamp *> 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;
Expand Down

0 comments on commit a277740

Please sign in to comment.