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

Fixed one-click selling traps and cursor color of unsellable traps #2285

Merged
merged 3 commits into from Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cursor_tag.c
Expand Up @@ -127,7 +127,7 @@ TbBool tag_cursor_blocks_sell_area(PlayerNumber plyr_idx, MapSubtlCoord stl_x, M
else if (floor_height_z == 1)
{
if ( ( ((subtile_is_sellable_room(plyr_idx, stl_x, stl_y)) || ( (slabmap_owner(slb) == plyr_idx) && ( (slab_is_door(slb_x, slb_y))
|| ((!full_slab) ? (subtile_has_trap_on(stl_x, stl_y)) : (slab_has_trap_on(slb_x, slb_y))) ) ) ) )
|| ((!full_slab) ? (subtile_has_sellable_trap_on(stl_x, stl_y)) : (slab_has_sellable_trap_on(slb_x, slb_y))) ) ) ) )
&& ( slb->kind != SlbT_ENTRANCE && slb->kind != SlbT_DUNGHEART ) )
{
colour = SLC_GREEN;
Expand Down
8 changes: 7 additions & 1 deletion src/thing_traps.c
Expand Up @@ -116,7 +116,7 @@ struct Thing *get_trap_for_slab_position(MapSlabCoord slb_x, MapSlabCoord slb_y)
TbBool slab_has_sellable_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y)
{
struct Thing* traptng = get_trap_for_slab_position(slb_x, slb_y);
return !thing_is_sellable_trap(traptng);
return thing_is_sellable_trap(traptng);
}

TbBool slab_has_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y)
Expand All @@ -125,6 +125,12 @@ TbBool slab_has_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y)
return !thing_is_invalid(traptng);
}

TbBool subtile_has_sellable_trap_on(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
struct Thing* traptng = get_trap_for_position(stl_x, stl_y);
return thing_is_sellable_trap(traptng);
}

TbBool subtile_has_trap_on(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
struct Thing* traptng = get_trap_for_position(stl_x, stl_y);
Expand Down
1 change: 1 addition & 0 deletions src/thing_traps.h
Expand Up @@ -92,6 +92,7 @@ struct TrapStats {
/******************************************************************************/
TbBool slab_has_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y);
TbBool slab_has_sellable_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y);
TbBool subtile_has_sellable_trap_on(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool subtile_has_trap_on(MapSubtlCoord stl_x, MapSubtlCoord stl_y);
TbBool slab_middle_row_has_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y);
TbBool slab_middle_column_has_trap_on(MapSlabCoord slb_x, MapSlabCoord slb_y);
Expand Down