Skip to content

Commit

Permalink
Misc terrain fixes, extra terrain verification (#47629)
Browse files Browse the repository at this point in the history
  • Loading branch information
aerrant authored Mar 14, 2021
1 parent f5670fd commit 8419da6
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 27 deletions.
14 changes: 10 additions & 4 deletions data/json/furniture_and_terrain/terrain-walls.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
"color": "pink",
"move_cost": 0,
"coverage": 100,
"roof": "t_flat_roof",
"flags": [ "FLAMMABLE", "NOITEM", "SUPPORTS_ROOF", "WALL", "NO_SCENT", "CHIP", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"bash": {
"str_min": 30,
Expand Down Expand Up @@ -385,6 +386,7 @@
"looks_like": "t_brick_wall",
"move_cost": 0,
"coverage": 100,
"roof": "t_flat_roof",
"flags": [ "NOITEM", "SUPPORTS_ROOF", "WALL", "NO_SCENT", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"connects_to": "WALL",
"bash": {
Expand Down Expand Up @@ -428,7 +430,7 @@
"color": "cyan",
"move_cost": 0,
"coverage": 100,
"roof": "t_flat_roof",
"roof": "t_metal_flat_roof",
"flags": [ "NOITEM", "SUPPORTS_ROOF", "WALL", "NO_SCENT", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"bash": {
"str_min": 200,
Expand Down Expand Up @@ -583,7 +585,7 @@
"color": "dark_gray",
"move_cost": 0,
"coverage": 100,
"roof": "t_flat_roof",
"roof": "t_metal_flat_roof",
"flags": [ "NOITEM", "SUPPORTS_ROOF", "WALL", "REDUCE_SCENT", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"connects_to": "WALL",
"bash": {
Expand Down Expand Up @@ -652,6 +654,7 @@
"color": "light_red",
"move_cost": 0,
"coverage": 100,
"roof": "t_flat_roof",
"flags": [ "FLAMMABLE", "NOITEM", "SUPPORTS_ROOF", "WALL", "REDUCE_SCENT", "AUTO_WALL_SYMBOL", "BLOCK_WIND" ],
"connects_to": "WALL",
"bash": {
Expand Down Expand Up @@ -746,6 +749,7 @@
"color": "brown",
"move_cost": 0,
"coverage": 100,
"roof": "t_flat_roof",
"flags": [ "FLAMMABLE", "NOITEM", "SUPPORTS_ROOF", "WALL", "REDUCE_SCENT", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"connects_to": "WALL",
"bash": {
Expand Down Expand Up @@ -892,6 +896,7 @@
"color": "brown",
"move_cost": 0,
"coverage": 100,
"roof": "t_dirt",
"flags": [ "NOITEM", "SUPPORTS_ROOF", "WALL", "NO_SCENT", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"connects_to": "WALL",
"bash": {
Expand All @@ -913,6 +918,7 @@
"color": "brown",
"move_cost": 0,
"coverage": 100,
"roof": "t_dirt",
"flags": [ "NOITEM", "SUPPORTS_ROOF", "WALL", "NO_SCENT", "AUTO_WALL_SYMBOL", "MINEABLE", "BLOCK_WIND" ],
"connects_to": "WALL",
"bash": {
Expand Down Expand Up @@ -1356,7 +1362,7 @@
"color": "light_gray",
"move_cost": 0,
"coverage": 80,
"roof": "t_flat_roof",
"roof": "t_metal_flat_roof",
"flags": [ "NOITEM", "WALL", "REDUCE_SCENT", "SUPPORTS_ROOF", "MINEABLE" ],
"bash": {
"str_min": 40,
Expand Down Expand Up @@ -1390,7 +1396,7 @@
"color": "light_gray",
"move_cost": 0,
"coverage": 55,
"roof": "t_flat_roof",
"roof": "t_metal_flat_roof",
"flags": [ "NOITEM", "WALL", "PERMEABLE", "SUPPORTS_ROOF", "MINEABLE" ],
"bash": {
"str_min": 20,
Expand Down
42 changes: 20 additions & 22 deletions data/json/furniture_and_terrain/terrain-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_window_no_curtains",
"curtain_transform": "t_window_no_curtains_open",
"examine_action": "curtains",
"close": "t_window_domestic",
"bash": {
Expand Down Expand Up @@ -879,7 +879,7 @@
"flags": [ "NOITEM", "CONNECT_TO_WALL", "THIN_OBSTACLE", "BARRICADABLE_WINDOW_CURTAINS", "BLOCK_WIND", "REDUCE_SCENT", "WINDOW" ],
"curtain_transform": "t_metal_grate_window_noglass",
"examine_action": "curtains",
"open": "t_metal_grate_window_with_curtain_open",
"open": "t_metal_grate_window_with_curtain_open_noglass",
"deconstruct": {
"ter_set": "t_window_reinforced",
"items": [ { "item": "pipe", "count": 12 }, { "item": "sheet_metal_small", "count": 40 } ]
Expand Down Expand Up @@ -920,7 +920,7 @@
],
"curtain_transform": "t_metal_grate_window_noglass",
"examine_action": "curtains",
"close": "t_metal_grate_window_with_curtain",
"close": "t_metal_grate_window_with_curtain_noglass",
"deconstruct": {
"ter_set": "t_window_reinforced",
"items": [ { "item": "pipe", "count": 12 }, { "item": "sheet_metal_small", "count": 40 } ]
Expand Down Expand Up @@ -1134,7 +1134,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_single_pane_glass",
"curtain_transform": "t_single_pane_glass_open",
"examine_action": "curtains",
"close": "t_single_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -1353,7 +1353,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_reinforced_single_pane_glass",
"curtain_transform": "t_reinforced_single_pane_glass_open",
"examine_action": "curtains",
"close": "t_reinforced_single_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -1572,7 +1572,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_double_pane_glass",
"curtain_transform": "t_double_pane_glass_open",
"examine_action": "curtains",
"close": "t_double_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -1659,7 +1659,6 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_reinforced_double_pane_glass",
"close": "t_reinforced_double_pane_glass",
"deconstruct": { "ter_set": "t_window_empty", "items": [ { "item": "reinforced_glass_sheet", "count": 2 } ] },
"bash": {
Expand Down Expand Up @@ -1793,7 +1792,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_reinforced_double_pane_glass",
"curtain_transform": "t_reinforced_double_pane_glass_open",
"examine_action": "curtains",
"close": "t_reinforced_double_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -2012,7 +2011,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_triple_pane_glass",
"curtain_transform": "t_triple_pane_glass_open",
"examine_action": "curtains",
"close": "t_triple_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -2177,11 +2176,10 @@
"FLAMMABLE",
"NOITEM",
"OPENCLOSE_INSIDE",
"MOUNTABLE",
"BARRICADABLE_WINDOW_CURTAINS",
"REDUCE_SCENT",
"CONNECT_TO_WALL",
"THIN_OBSTACLE",
"SMALL_PASSAGE",
"BLOCK_WIND",
"WINDOW"
],
"curtain_transform": "t_reinforced_triple_pane_glass",
Expand Down Expand Up @@ -2232,7 +2230,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_reinforced_triple_pane_glass",
"curtain_transform": "t_reinforced_triple_pane_glass_open",
"examine_action": "curtains",
"close": "t_reinforced_triple_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -2450,7 +2448,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_quadruple_pane_glass",
"curtain_transform": "t_quadruple_pane_glass_open",
"examine_action": "curtains",
"close": "t_quadruple_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -2615,11 +2613,10 @@
"FLAMMABLE",
"NOITEM",
"OPENCLOSE_INSIDE",
"MOUNTABLE",
"BARRICADABLE_WINDOW_CURTAINS",
"REDUCE_SCENT",
"CONNECT_TO_WALL",
"THIN_OBSTACLE",
"SMALL_PASSAGE",
"BLOCK_WIND",
"WINDOW"
],
"curtain_transform": "t_reinforced_quadruple_pane_glass",
Expand Down Expand Up @@ -2670,7 +2667,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_reinforced_quadruple_pane_glass",
"curtain_transform": "t_reinforced_quadruple_pane_glass_open",
"examine_action": "curtains",
"close": "t_reinforced_quadruple_double_pane_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -2881,7 +2878,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_plastic_window",
"curtain_transform": "t_plastic_window_open",
"examine_action": "curtains",
"close": "t_plastic_window_with_curtain_open_window_closed",
"deconstruct": {
Expand Down Expand Up @@ -3108,9 +3105,10 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_reinforced_plastic_window",
"curtain_transform": "t_reinforced_plastic_window_open",
"examine_action": "curtains",
"close": "t_reinforced_plastic_window_with_curtain",
"close": "t_reinforced_plastic_window_with_curtain_open_window_closed",
"open": "t_reinforced_plastic_window_with_curtain",
"deconstruct": {
"ter_set": "t_window_empty",
"items": [
Expand Down Expand Up @@ -3350,7 +3348,7 @@
"SMALL_PASSAGE",
"WINDOW"
],
"curtain_transform": "t_tempered_glass_window",
"curtain_transform": "t_tempered_glass_open",
"examine_action": "curtains",
"close": "t_tempered_glass_with_curtain_open_window_closed",
"deconstruct": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"move_cost": 0,
"coverage": 100,
"description": "The shutters of this porthole are deployed, but the lack of a window between them allows the frozen air to leak into the room.",
"open": "t_wall_prefab_glass",
"open": "t_wall_prefab_bglass",
"flags": [ "NOITEM", "WALL", "PERMEABLE", "OPENCLOSE_INSIDE" ],
"roof": "t_metal_flat_roof",
"bash": {
Expand All @@ -111,6 +111,7 @@
"coverage": 60,
"color": "yellow",
"description": "The glass panel that would have covered this porthole has been broken, allowing unfettered access to the rooms within.",
"close": "t_wall_prefab_bglass_shutters",
"flags": [ "TRANSPARENT", "FLAMMABLE", "NOITEM", "MOUNTABLE", "CONNECT_TO_WALL", "SMALL_PASSAGE", "WINDOW" ],
"roof": "t_metal_flat_roof",
"bash": {
Expand Down
25 changes: 25 additions & 0 deletions src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "trap.h"

static const std::string flag_DIGGABLE( "DIGGABLE" );
static const std::string flag_LOCKED( "LOCKED" );
static const std::string flag_TRANSPARENT( "TRANSPARENT" );

namespace
Expand Down Expand Up @@ -1280,15 +1281,39 @@ void ter_t::check() const
if( !transforms_into.is_valid() ) {
debugmsg( "invalid transforms_into %s for %s", transforms_into.c_str(), id.c_str() );
}

// Validate open/close transforms
if( !open.is_valid() ) {
debugmsg( "invalid terrain %s for opening %s", open.c_str(), id.c_str() );
}
if( !close.is_valid() ) {
debugmsg( "invalid terrain %s for closing %s", close.c_str(), id.c_str() );
}
// Check transition consistency for opening/closing terrain. Has an obvious
// exception for locked terrains - those aren't expected to be locked again
if( open && open->close && open->close != id && !has_flag( flag_LOCKED ) ) {
debugmsg( "opening terrain %s for %s doesn't reciprocate", open.c_str(), id.c_str() );
}
if( close && close->open && close->open != id && !has_flag( flag_LOCKED ) ) {
debugmsg( "closing terrain %s for %s doesn't reciprocate", close.c_str(), id.c_str() );
}

// Validate curtain transforms
if( has_examine( iexamine::curtains ) && !has_curtains() ) {
debugmsg( "%s is a curtain, but has no curtain_transform", id.c_str() );
}
if( !has_examine( iexamine::curtains ) && has_curtains() ) {
debugmsg( "%s is not a curtain, but has curtain_transform", id.c_str() );
}
if( !curtain_transform.is_empty() && !curtain_transform.is_valid() ) {
debugmsg( "%s has invalid curtain transform target %s", id.c_str(), curtain_transform.c_str() );
}

// Validate generic transforms
if( transforms_into && transforms_into == id ) {
debugmsg( "%s transforms_into itself", id.c_str() );
}

for( const emit_id &e : emissions ) {
if( !e.is_valid() ) {
debugmsg( "ter %s has invalid emission %s set", id.c_str(), e.str().c_str() );
Expand Down

0 comments on commit 8419da6

Please sign in to comment.