From c0b16412dc5bd0f4184020a205166b755b964cdd Mon Sep 17 00:00:00 2001 From: Jason Jones Date: Mon, 10 Dec 2018 19:55:45 -0900 Subject: [PATCH] Add function to check if location was from special --- src/overmap.cpp | 15 +++++++++++++++ src/overmap.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/overmap.cpp b/src/overmap.cpp index 17ca4440dc8dd..f7fd871db187c 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -2988,6 +2988,21 @@ bool overmap::check_ot_subtype( const std::string &otype, int x, int y, int z ) return is_ot_subtype( otype.c_str(), oter ); } +bool overmap::check_overmap_special_type( const overmap_special_id &id, int x, int y, int z ) const +{ + // Try and find the special associated with this location. + const tripoint location( x, y, z ); + auto found_id = overmap_special_placements.find( location ); + + // There was no special here, so bail. + if( found_id == overmap_special_placements.end() ) { + return false; + } + + // Return whether the found special was a match with our requested id. + return found_id->second == id; +} + void overmap::good_river( int x, int y, int z ) { if( !is_ot_type( "river", get_ter( x, y, z ) ) ) { diff --git a/src/overmap.h b/src/overmap.h index 2226cb3b244ae..8431dd1c01f22 100644 --- a/src/overmap.h +++ b/src/overmap.h @@ -351,6 +351,7 @@ class overmap // Polishing bool check_ot_type( const std::string &otype, int x, int y, int z ) const; bool check_ot_subtype( const std::string &otype, int x, int y, int z ) const; + bool check_overmap_special_type( const overmap_special_id &id, int x, int y, int z ) const; void chip_rock( int x, int y, int z ); void polish_river();