Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove z-level restriction for zone activities. #5234

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions src/clzones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,19 +680,15 @@ bool zone_manager::has_near( const zone_type_id &type, const tripoint &where, in
{
const auto &point_set = get_point_set( type, fac );
for( auto &point : point_set ) {
if( point.z == where.z ) {
if( square_dist( point, where ) <= range ) {
return true;
}
if( square_dist( point, where ) <= range ) {
return true;
}
}

const auto &vzone_set = get_vzone_set( type, fac );
for( auto &point : vzone_set ) {
if( point.z == where.z ) {
if( square_dist( point, where ) <= range ) {
return true;
}
if( square_dist( point, where ) <= range ) {
return true;
}
}

Expand Down Expand Up @@ -752,30 +748,26 @@ std::unordered_set<tripoint> zone_manager::get_near( const zone_type_id &type,
auto near_point_set = std::unordered_set<tripoint>();

for( auto &point : point_set ) {
if( point.z == where.z ) {
if( square_dist( point, where ) <= range ) {
if( it && has( zone_LOOT_CUSTOM, point ) ) {
if( custom_loot_has( point, it ) ) {
near_point_set.insert( point );
}
} else {
if( square_dist( point, where ) <= range ) {
if( it && has( zone_LOOT_CUSTOM, point ) ) {
if( custom_loot_has( point, it ) ) {
near_point_set.insert( point );
}
} else {
near_point_set.insert( point );
}
}
}

const auto &vzone_set = get_vzone_set( type, fac );
for( auto &point : vzone_set ) {
if( point.z == where.z ) {
if( square_dist( point, where ) <= range ) {
if( it && has( zone_LOOT_CUSTOM, point ) ) {
if( custom_loot_has( point, it ) ) {
near_point_set.insert( point );
}
} else {
if( square_dist( point, where ) <= range ) {
if( it && has( zone_LOOT_CUSTOM, point ) ) {
if( custom_loot_has( point, it ) ) {
near_point_set.insert( point );
}
} else {
near_point_set.insert( point );
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6395,8 +6395,13 @@ void game::zones_manager()
break;
}

mgr.add( name, id, g->u.get_faction()->id, false, true, position->first,
position->second, options );
if( position->first.z != position->second.z ) {
popup( _( "The zone start and end should be on the same z-level!" ) );
break;
}

mgr.add( name, id, g->u.get_faction()->id, false, true, position->first, position->second,
options );

zones = get_zones();
active_index = zone_cnt - 1;
Expand Down
Loading