diff --git a/src/cata_string_consts.h b/src/cata_string_consts.h index 489bcdf3baab5..56b56993c83e4 100644 --- a/src/cata_string_consts.h +++ b/src/cata_string_consts.h @@ -945,6 +945,7 @@ static const std::string flag_AUT_START( "AUT_START" ); static const std::string flag_AUTODOC( "AUTODOC" ); static const std::string flag_AUTODOC_COUCH( "AUTODOC_COUCH" ); static const std::string flag_BAD_DAY( "BAD_DAY" ); +static const std::string flag_BAROMETER( "BAROMETER" ); static const std::string flag_BARRICADABLE_DOOR( "BARRICADABLE_DOOR" ); static const std::string flag_BARRICADABLE_DOOR_DAMAGED( "BARRICADABLE_DOOR_DAMAGED" ); static const std::string flag_BARRICADABLE_DOOR_REINFORCED( "BARRICADABLE_DOOR_REINFORCED" ); @@ -961,6 +962,7 @@ static const std::string flag_BOMB( "BOMB" ); static const std::string flag_BUTCHER_EQ( "BUTCHER_EQ" ); static const std::string flag_BYPRODUCT( "BYPRODUCT" ); static const std::string flag_CABLE_SPOOL( "CABLE_SPOOL" ); +static const std::string flag_CAMERA_PRO( "CAMERA_PRO" ); static const std::string flag_CAN_SIT( "CAN_SIT" ); static const std::string flag_CANNIBALISM( "CANNIBALISM" ); static const std::string flag_CARNIVORE_OK( "CARNIVORE_OK" ); @@ -989,6 +991,7 @@ static const std::string flag_DIAMOND( "DIAMOND" ); static const std::string flag_DIFFICULT_Z( "DIFFICULT_Z" ); static const std::string flag_DIG_TOOL( "DIG_TOOL" ); static const std::string flag_DIGGABLE( "DIGGABLE" ); +static const std::string flag_DIGGABLE_CAN_DEEPEN( "DIGGABLE_CAN_DEEPEN" ); static const std::string flag_DIMENSIONAL_ANCHOR( "DIMENSIONAL_ANCHOR" ); static const std::string flag_DISABLE_SIGHTS( "DISABLE_SIGHTS" ); static const std::string flag_DONT_REMOVE_ROTTEN( "DONT_REMOVE_ROTTEN" ); @@ -1058,6 +1061,7 @@ static const std::string flag_HIDDEN_POISON( "HIDDEN_POISON" ); static const std::string flag_HOOD( "HOOD" ); static const std::string flag_HOT( "HOT" ); static const std::string flag_HURT_WHEN_WIELDED( "HURT_WHEN_WIELDED" ); +static const std::string flag_HYGROMETER( "HYGROMETER" ); static const std::string flag_IN_CBM( "IN_CBM" ); static const std::string flag_INDOORS( "INDOORS" ); static const std::string flag_INEDIBLE( "INEDIBLE" ); @@ -1082,9 +1086,18 @@ static const std::string flag_MAG_BELT( "MAG_BELT" ); static const std::string flag_MAG_DESTROY( "MAG_DESTROY" ); static const std::string flag_MAG_EJECT( "MAG_EJECT" ); static const std::string flag_MAGIC_FOCUS( "MAGIC_FOCUS" ); +static const std::string flag_MC_ENCRYPTED( "MC_ENCRYPTED" ); +static const std::string flag_MC_HAS_DATA( "MC_HAS_DATA" ); +static const std::string flag_MC_MAY_BE_ENCRYPTED( "MC_MAY_BE_ENCRYPTED" ); +static const std::string flag_MC_MOBILE( "MC_MOBILE" ); +static const std::string flag_MC_RANDOM_STUFF( "MC_RANDOM_STUFF" ); +static const std::string flag_MC_SCIENCE_STUFF( "MC_SCIENCE_STUFF" ); +static const std::string flag_MC_TURN_USED( "MC_TURN_USED" ); +static const std::string flag_MC_USED( "MC_USED" ); static const std::string flag_MELTS( "MELTS" ); static const std::string flag_MESSY( "MESSY" ); static const std::string flag_MILLABLE( "MILLABLE" ); +static const std::string flag_MINEABLE( "MINEABLE" ); static const std::string flag_MOUNTABLE( "MOUNTABLE" ); static const std::string flag_MOUNTED_GUN( "MOUNTED_GUN" ); static const std::string flag_MUSHY( "MUSHY" ); @@ -1122,6 +1135,7 @@ static const std::string flag_OVERSIZE( "OVERSIZE" ); static const std::string flag_PARTIAL_DEAF( "PARTIAL_DEAF" ); static const std::string flag_PERPETUAL( "PERPETUAL" ); static const std::string flag_PERSONAL( "PERSONAL" ); +static const std::string flag_PLACE_RANDOMLY( "PLACE_RANDOMLY" ); static const std::string flag_PLANT( "PLANT" ); static const std::string flag_PLANTABLE( "PLANTABLE" ); static const std::string flag_PLOWABLE( "PLOWABLE" ); @@ -1141,6 +1155,7 @@ static const std::string flag_RADIO_CONTAINER( "RADIO_CONTAINER" ); static const std::string flag_RADIO_INVOKE_PROC( "RADIO_INVOKE_PROC" ); static const std::string flag_RADIO_MOD( "RADIO_MOD" ); static const std::string flag_RADIOACTIVE( "RADIOACTIVE" ); +static const std::string flag_RADIOCARITEM( "RADIOCARITEM" ); static const std::string flag_RADIOSIGNAL_1( "RADIOSIGNAL_1" ); static const std::string flag_RADIOSIGNAL_2( "RADIOSIGNAL_2" ); static const std::string flag_RADIOSIGNAL_3( "RADIOSIGNAL_3" ); @@ -1162,6 +1177,7 @@ static const std::string flag_ROLLER_INLINE( "ROLLER_INLINE" ); static const std::string flag_ROLLER_ONE( "ROLLER_ONE" ); static const std::string flag_ROLLER_QUAD( "ROLLER_QUAD" ); static const std::string flag_ROUGH( "ROUGH" ); +static const std::string flag_RUBBLE( "RUBBLE" ); static const std::string flag_SAFE_FUEL_OFF( "SAFE_FUEL_OFF" ); static const std::string flag_SAFECRACK( "SAFECRACK" ); static const std::string flag_SALT_WATER( "SALT_WATER" ); @@ -1227,6 +1243,7 @@ static const std::string flag_WIND_EXTINGUISH( "WIND_EXTINGUISH" ); static const std::string flag_WRITE_MESSAGE( "WRITE_MESSAGE" ); static const std::string flag_YOUNG( "YOUNG" ); + static const skill_id skill_archery( "archery" ); static const skill_id skill_barter( "barter" ); static const skill_id skill_bashing( "bashing" ); @@ -1256,20 +1273,26 @@ static const skill_id skill_traps( "traps" ); static const skill_id skill_unarmed( "unarmed" ); static const skill_id weapon_skill( "weapon" ); + static const quality_id qual_ANESTHESIA( "ANESTHESIA" ); static const quality_id qual_AXE( "AXE" ); static const quality_id qual_BUTCHER( "BUTCHER" ); static const quality_id qual_CUT( "CUT" ); static const quality_id qual_CUT_FINE( "CUT_FINE" ); static const quality_id qual_DIG( "DIG" ); +static const quality_id qual_DRILL( "DRILL" ); static const quality_id qual_FISHING( "FISHING" ); +static const quality_id qual_HAMMER( "HAMMER" ); static const quality_id qual_JACK( "JACK" ); static const quality_id qual_LIFT( "LIFT" ); +static const quality_id qual_PRY( "PRY" ); static const quality_id qual_SAW_M( "SAW_M" ); static const quality_id qual_SAW_W( "SAW_W" ); +static const quality_id qual_SCREW_FINE( "SCREW_FINE" ); static const quality_id qual_SELF_JACK( "SELF_JACK" ); static const quality_id qual_WELD( "WELD" ); + static const zone_type_id zone_investigate_only( "NPC_INVESTIGATE_ONLY" ); static const zone_type_id zone_no_investigate( "NPC_NO_INVESTIGATE" ); static const zone_type_id zone_type_CHOP_TREES( "CHOP_TREES" ); diff --git a/src/item_action.cpp b/src/item_action.cpp index a91ee8c9a9d19..a9c7dba5e1ade 100644 --- a/src/item_action.cpp +++ b/src/item_action.cpp @@ -126,7 +126,7 @@ item_action_map item_action_generator::map_actions_to_items( player &p, // Don't try to remove 'irremovable' toolmods if( actual_item->is_toolmod() && use == item_action_id( "TOOLMOD_ATTACH" ) && - actual_item->has_flag( "IRREMOVABLE" ) ) { + actual_item->has_flag( flag_IRREMOVABLE ) ) { continue; } diff --git a/src/iuse.cpp b/src/iuse.cpp index 861761559ad79..8fb9786610277 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -1557,7 +1557,7 @@ static bool good_fishing_spot( tripoint pos ) // isolated little body of water with no definite fish population const oter_id &cur_omt = overmap_buffer.ter( ms_to_omt_copy( g->m.getabs( pos ) ) ); std::string om_id = cur_omt.id().c_str(); - if( fishables.empty() && !g->m.has_flag( "CURRENT", pos ) && + if( fishables.empty() && !g->m.has_flag( flag_CURRENT, pos ) && om_id.find( "river_" ) == std::string::npos && !cur_omt->is_lake() && !cur_omt->is_lake_shore() ) { g->u.add_msg_if_player( m_info, _( "You doubt you will have much luck catching fish here" ) ); return false; @@ -1626,7 +1626,7 @@ int iuse::fish_trap( player *p, item *it, bool t, const tripoint &pos ) } const tripoint pnt = *pnt_; - if( !g->m.has_flag( "FISHABLE", pnt ) ) { + if( !g->m.has_flag( flag_FISHABLE, pnt ) ) { p->add_msg_if_player( m_info, _( "You can't fish there!" ) ); return 0; } @@ -1651,7 +1651,7 @@ int iuse::fish_trap( player *p, item *it, bool t, const tripoint &pos ) if( it->age() > 3_hours ) { it->active = false; - if( !g->m.has_flag( "FISHABLE", pos ) ) { + if( !g->m.has_flag( flag_FISHABLE, pos ) ) { return 0; } @@ -1839,7 +1839,7 @@ int iuse::unpack_item( player *p, item *it, bool, const tripoint & ) int iuse::pack_cbm( player *p, item *it, bool, const tripoint & ) { item_location bionic = g->inv_map_splice( []( const item & e ) { - return e.is_bionic() && e.has_flag( "NO_PACKED" ); + return e.is_bionic() && e.has_flag( flag_NO_PACKED ); }, _( "Choose CBM to pack" ), PICKUP_RANGE, _( "You don't have any CBMs." ) ); if( !bionic ) { @@ -2564,7 +2564,7 @@ int iuse::dig( player *p, item *it, bool t, const tripoint & ) } const tripoint dig_point = p->pos(); - const bool can_dig_here = g->m.has_flag( "DIGGABLE", dig_point ) && + const bool can_dig_here = g->m.has_flag( flag_DIGGABLE, dig_point ) && !g->m.has_furn( dig_point ) && g->m.tr_at( dig_point ).is_null() && ( g->m.ter( dig_point ) == t_grave_new || g->m.i_at( dig_point ).empty() ) && @@ -2575,7 +2575,7 @@ int iuse::dig( player *p, item *it, bool t, const tripoint & ) _( "You can't dig a pit in this location. Ensure it is clear diggable ground with no items or obstacles." ) ); return 0; } - const bool can_deepen = g->m.has_flag( "DIGGABLE_CAN_DEEPEN", dig_point ); + const bool can_deepen = g->m.has_flag( flag_DIGGABLE_CAN_DEEPEN, dig_point ); const bool grave = g->m.ter( dig_point ) == t_grave; if( !p->crafting_inventory().has_quality( qual_DIG, 2 ) ) { @@ -2796,7 +2796,7 @@ int iuse::clear_rubble( player *p, item *it, bool, const tripoint & ) return 0; } const std::function f = []( const tripoint & pnt ) { - return g->m.has_flag( "RUBBLE", pnt ); + return g->m.has_flag( flag_RUBBLE, pnt ); }; const cata::optional pnt_ = choose_adjacent_highlight( @@ -3102,7 +3102,7 @@ int iuse::jackhammer( player *p, item *it, bool, const tripoint &pos ) pnt = *pnt_; } - if( !g->m.has_flag( "MINEABLE", pnt ) ) { + if( !g->m.has_flag( flag_MINEABLE, pnt ) ) { p->add_msg_if_player( m_info, _( "You can't drill there." ) ); return 0; } @@ -3157,7 +3157,7 @@ int iuse::pickaxe( player *p, item *it, bool, const tripoint &pos ) pnt = *pnt_; } - if( !g->m.has_flag( "MINEABLE", pnt ) ) { + if( !g->m.has_flag( flag_MINEABLE, pnt ) ) { p->add_msg_if_player( m_info, _( "You can't mine there." ) ); return 0; } @@ -3212,7 +3212,7 @@ int iuse::burrow( player *p, item *it, bool, const tripoint &pos ) pnt = *pnt_; } - if( !g->m.has_flag( "MINEABLE", pnt ) ) { + if( !g->m.has_flag( flag_MINEABLE, pnt ) ) { p->add_msg_if_player( m_info, _( "You can't burrow there." ) ); return 0; } @@ -4329,7 +4329,7 @@ int iuse::hand_crank( player *p, item *it, bool, const tripoint & ) return 0; } item *magazine = it->magazine_current(); - if( magazine && magazine->has_flag( "RECHARGE" ) ) { + if( magazine && magazine->has_flag( flag_RECHARGE ) ) { // 1600 minutes. It shouldn't ever run this long, but it's an upper bound. // expectation is it runs until the player is too tired. int moves = to_moves( 1600_minutes ); @@ -4614,7 +4614,7 @@ static int chop_moves( player *p, item *it ) const int quality = it->get_quality( qual_AXE ); // attribute; regular tools - based on STR, powered tools - based on DEX - const int attr = it->has_flag( "POWERED" ) ? p->dex_cur : p->str_cur; + const int attr = it->has_flag( flag_POWERED ) ? p->dex_cur : p->str_cur; int moves = to_moves( time_duration::from_minutes( 60 - attr ) / std::pow( 2, quality - 1 ) ); const int helpersize = g->u.get_num_crafting_helpers( 3 ); @@ -4635,7 +4635,7 @@ int iuse::chop_tree( player *p, item *it, bool t, const tripoint & ) if( pnt == g->u.pos() ) { return false; } - return g->m.has_flag( "TREE", pnt ); + return g->m.has_flag( flag_TREE, pnt ); }; const cata::optional pnt_ = choose_adjacent_highlight( @@ -4959,7 +4959,7 @@ int iuse::mop( player *p, item *it, bool, const tripoint & ) fd_sludge }; const std::function f = [&to_check]( const tripoint & pnt ) { - if( !g->m.has_flag( "LIQUIDCONT", pnt ) ) { + if( !g->m.has_flag( flag_LIQUIDCONT, pnt ) ) { map_stack items = g->m.i_at( pnt ); auto found = std::find_if( items.begin(), items.end(), []( const item & it ) { return it.made_of( LIQUID ); @@ -5518,7 +5518,7 @@ int iuse::towel_common( player *p, item *it, bool t ) const std::string name = it ? it->tname() : _( "towel" ); // can't use an already wet towel! - if( it && it->has_flag( "WET" ) ) { + if( it && it->has_flag( flag_WET ) ) { p->add_msg_if_player( m_info, _( "That %s is too wet to soak up any more liquid!" ), it->tname() ); // clean off the messes first, more important @@ -5798,7 +5798,7 @@ int iuse::gun_repair( player *p, item *it, bool, const tripoint & ) p->add_msg_if_player( m_info, _( "That isn't a firearm!" ) ); return 0; } - if( fix.has_flag( "NO_REPAIR" ) ) { + if( fix.has_flag( flag_NO_REPAIR ) ) { p->add_msg_if_player( m_info, _( "You cannot repair your %s." ), fix.tname() ); return 0; } @@ -5880,8 +5880,8 @@ int iuse::toolmod_attach( player *p, item *it, bool, const tripoint & ) auto filter = [&it]( const item & e ) { // don't allow ups battery mods on a UPS or UPS-powered tools - if( it->has_flag( "USE_UPS" ) && ( e.typeId() == "UPS_off" || e.typeId() == "adv_UPS_off" || - e.has_flag( "USE_UPS" ) ) ) { + if( it->has_flag( flag_USE_UPS ) && ( e.typeId() == "UPS_off" || e.typeId() == "adv_UPS_off" || + e.has_flag( flag_USE_UPS ) ) ) { return false; } @@ -6063,20 +6063,20 @@ int iuse::robotcontrol( player *p, item *it, bool, const tripoint & ) static void init_memory_card_with_random_stuff( item &it ) { - if( it.has_flag( "MC_MOBILE" ) && ( it.has_flag( "MC_RANDOM_STUFF" ) || - it.has_flag( "MC_SCIENCE_STUFF" ) ) && !( it.has_flag( "MC_USED" ) || - it.has_flag( "MC_HAS_DATA" ) ) ) { + if( it.has_flag( flag_MC_MOBILE ) && ( it.has_flag( flag_MC_RANDOM_STUFF ) || + it.has_flag( flag_MC_SCIENCE_STUFF ) ) && !( it.has_flag( flag_MC_USED ) || + it.has_flag( flag_MC_HAS_DATA ) ) ) { it.item_tags.insert( "MC_HAS_DATA" ); bool encrypted = false; - if( it.has_flag( "MC_MAY_BE_ENCRYPTED" ) && one_in( 8 ) ) { + if( it.has_flag( flag_MC_MAY_BE_ENCRYPTED ) && one_in( 8 ) ) { it.convert( it.typeId() + "_encrypted" ); } //some special cards can contain "MC_ENCRYPTED" flag - if( it.has_flag( "MC_ENCRYPTED" ) ) { + if( it.has_flag( flag_MC_ENCRYPTED ) ) { encrypted = true; } @@ -6130,7 +6130,7 @@ static void init_memory_card_with_random_stuff( item &it ) it.set_var( "MC_RECIPE", "SIMPLE" ); } - if( it.has_flag( "MC_SCIENCE_STUFF" ) ) { + if( it.has_flag( flag_MC_SCIENCE_STUFF ) ) { it.set_var( "MC_RECIPE", "SCIENCE" ); } } @@ -6276,7 +6276,7 @@ static bool einkpc_download_memory_card( player &p, item &eink, item &mc ) } } - if( mc.has_flag( "MC_TURN_USED" ) ) { + if( mc.has_flag( flag_MC_TURN_USED ) ) { mc.clear_vars(); mc.unset_flags(); mc.convert( "mobile_memory_card_used" ); @@ -6542,7 +6542,7 @@ int iuse::einktabletpc( player *p, item *it, bool t, const tripoint &pos ) avatar *you = p->as_avatar(); item_location loc; auto filter = []( const item & it ) { - return it.has_flag( "MC_MOBILE" ); + return it.has_flag( flag_MC_MOBILE ); }; const std::string title = _( "Insert memory card" ); @@ -6559,18 +6559,18 @@ int iuse::einktabletpc( player *p, item *it, bool t, const tripoint &pos ) } item &mc = *loc; - if( !mc.has_flag( "MC_MOBILE" ) ) { + if( !mc.has_flag( flag_MC_MOBILE ) ) { p->add_msg_if_player( m_info, _( "This is not a compatible memory card." ) ); return it->type->charges_to_use(); } init_memory_card_with_random_stuff( mc ); - if( mc.has_flag( "MC_ENCRYPTED" ) ) { + if( mc.has_flag( flag_MC_ENCRYPTED ) ) { p->add_msg_if_player( m_info, _( "This memory card is encrypted." ) ); return it->type->charges_to_use(); } - if( !mc.has_flag( "MC_HAS_DATA" ) ) { + if( !mc.has_flag( flag_MC_HAS_DATA ) ) { p->add_msg_if_player( m_info, _( "This memory card does not contain any new data." ) ); return it->type->charges_to_use(); } @@ -6591,14 +6591,14 @@ int iuse::einktabletpc( player *p, item *it, bool t, const tripoint &pos ) } item &mc = *loc; - if( !mc.has_flag( "MC_MOBILE" ) ) { + if( !mc.has_flag( flag_MC_MOBILE ) ) { p->add_msg_if_player( m_info, _( "This is not a compatible memory card." ) ); return it->type->charges_to_use(); } init_memory_card_with_random_stuff( mc ); - if( !mc.has_flag( "MC_ENCRYPTED" ) ) { + if( !mc.has_flag( flag_MC_ENCRYPTED ) ) { p->add_msg_if_player( m_info, _( "This memory card is not encrypted." ) ); return it->type->charges_to_use(); } @@ -6755,7 +6755,7 @@ static std::string colorized_feature_description_at( const tripoint ¢er_poin if( !sign_message.empty() ) { furn_str += string_format( _( " with message \"%s\"" ), sign_message ); } - if( !furn->has_flag( "CONTAINER" ) && !furn->has_flag( "SEALED" ) ) { + if( !furn->has_flag( flag_CONTAINER ) && !furn->has_flag( flag_SEALED ) ) { const item item = get_top_item_at_point( center_point, min_visible_volume ); if( !item.is_null() ) { furn_str += string_format( _( " with %s on it" ), colorized_item_name( item ) ); @@ -7489,7 +7489,7 @@ int iuse::camera( player *p, item *it, bool, const tripoint & ) if( mon || guy || trajectory_point == aim_point ) { int dist = rl_dist( p->pos(), trajectory_point ); - int camera_bonus = it->has_flag( "CAMERA_PRO" ) ? 10 : 0; + int camera_bonus = it->has_flag( flag_CAMERA_PRO ) ? 10 : 0; int photo_quality = 20 - rng( dist, dist * 2 ) * 2 + rng( camera_bonus / 2, camera_bonus ); if( photo_quality > 5 ) { photo_quality = 5; @@ -7664,7 +7664,7 @@ int iuse::camera( player *p, item *it, bool, const tripoint & ) item_location loc; if( you != nullptr ) { loc = game_menus::inv::titled_filter_menu( []( const item & it ) { - return it.has_flag( "MC_MOBILE" ); + return it.has_flag( flag_MC_MOBILE ); }, *you, _( "Insert memory card" ) ); } if( !loc ) { @@ -7673,19 +7673,19 @@ int iuse::camera( player *p, item *it, bool, const tripoint & ) } item &mc = *loc; - if( !mc.has_flag( "MC_MOBILE" ) ) { + if( !mc.has_flag( flag_MC_MOBILE ) ) { p->add_msg_if_player( m_info, _( "This is not a compatible memory card." ) ); return it->type->charges_to_use(); } init_memory_card_with_random_stuff( mc ); - if( mc.has_flag( "MC_ENCRYPTED" ) ) { + if( mc.has_flag( flag_MC_ENCRYPTED ) ) { if( !query_yn( _( "This memory card is encrypted. Format and clear data?" ) ) ) { return it->type->charges_to_use(); } } - if( mc.has_flag( "MC_HAS_DATA" ) ) { + if( mc.has_flag( flag_MC_HAS_DATA ) ) { if( !query_yn( _( "Are you sure you want to clear the old data on the card?" ) ) ) { return it->type->charges_to_use(); } @@ -7712,7 +7712,7 @@ int iuse::ehandcuffs( player *p, item *it, bool t, const tripoint &pos ) if( t ) { - if( g->m.has_flag( "SWIMMABLE", pos.xy() ) ) { + if( g->m.has_flag( flag_SWIMMABLE, pos.xy() ) ) { it->item_tags.erase( "NO_UNWIELD" ); it->ammo_unset(); it->active = false; @@ -7827,7 +7827,7 @@ int iuse::radiocar( player *p, item *it, bool, const tripoint & ) { int choice = -1; auto bomb_it = std::find_if( it->contents.begin(), it->contents.end(), []( const item & c ) { - return c.has_flag( "RADIOCARITEM" ); + return c.has_flag( flag_RADIOCARITEM ); } ); if( bomb_it == it->contents.end() ) { choice = uilist( _( "Using RC car:" ), { @@ -7864,7 +7864,7 @@ int iuse::radiocar( player *p, item *it, bool, const tripoint & ) item_location loc; if( you != nullptr ) { loc = game_menus::inv::titled_filter_menu( []( const item & it ) { - return it.has_flag( "RADIOCARITEM" ); + return it.has_flag( flag_RADIOCARITEM ); }, *you, _( "Arm what?" ) ); } if( !loc ) { @@ -7873,13 +7873,13 @@ int iuse::radiocar( player *p, item *it, bool, const tripoint & ) } item &put = *loc; - if( put.has_flag( "RADIOCARITEM" ) && ( put.volume() <= 1250_ml || - ( put.weight() <= 2_kilogram ) ) ) { + if( put.has_flag( flag_RADIOCARITEM ) && ( put.volume() <= 1250_ml || + ( put.weight() <= 2_kilogram ) ) ) { p->moves -= to_moves( 3_seconds ); p->add_msg_if_player( _( "You armed your RC car with %s." ), put.tname() ); it->put_in( p->i_rem( &put ) ); - } else if( !put.has_flag( "RADIOCARITEM" ) ) { + } else if( !put.has_flag( flag_RADIOCARITEM ) ) { p->add_msg_if_player( _( "RC car with %s? How?" ), put.tname() ); } else { @@ -7935,14 +7935,14 @@ static void sendRadioSignal( player &p, const std::string &signal ) { for( const tripoint &loc : g->m.points_in_radius( p.pos(), 30 ) ) { for( item &it : g->m.i_at( loc ) ) { - if( it.has_flag( "RADIO_ACTIVATION" ) && it.has_flag( signal ) ) { + if( it.has_flag( flag_RADIO_ACTIVATION ) && it.has_flag( signal ) ) { sounds::sound( p.pos(), 6, sounds::sound_t::alarm, _( "beep" ), true, "misc", "beep" ); - if( it.has_flag( "RADIO_INVOKE_PROC" ) ) { + if( it.has_flag( flag_RADIO_INVOKE_PROC ) ) { // Invoke to transform a radio-modded explosive into its active form it.type->invoke( p, it, loc ); it.ammo_unset(); } - } else if( it.has_flag( "RADIO_CONTAINER" ) && !it.contents.empty() ) { + } else if( it.has_flag( flag_RADIO_CONTAINER ) && !it.contents.empty() ) { auto itm = std::find_if( it.contents.begin(), it.contents.end(), [&signal]( const item & c ) { return c.has_flag( signal ); @@ -7951,12 +7951,12 @@ static void sendRadioSignal( player &p, const std::string &signal ) if( itm != it.contents.end() ) { sounds::sound( p.pos(), 6, sounds::sound_t::alarm, _( "beep" ), true, "misc", "beep" ); // Invoke twice: first to transform, then later to proc - if( itm->has_flag( "RADIO_INVOKE_PROC" ) ) { + if( itm->has_flag( flag_RADIO_INVOKE_PROC ) ) { itm->type->invoke( p, *itm, loc ); itm->ammo_unset(); // The type changed } - if( itm->has_flag( "BOMB" ) ) { + if( itm->has_flag( flag_BOMB ) ) { itm->type->invoke( p, *itm, loc ); it.contents.clear(); } @@ -8027,7 +8027,7 @@ int iuse::radiocontrol( player *p, item *it, bool t, const tripoint & ) auto item_list = p->get_radio_items(); for( auto &elem : item_list ) { - if( elem->has_flag( "BOMB" ) && elem->has_flag( signal ) ) { + if( elem->has_flag( flag_BOMB ) && elem->has_flag( signal ) ) { p->add_msg_if_player( m_warning, _( "The %s in your inventory would explode on this signal. Place it down before sending the signal." ), elem->display_name() ); @@ -8036,14 +8036,14 @@ int iuse::radiocontrol( player *p, item *it, bool t, const tripoint & ) } std::vector radio_containers = p->items_with( []( const item & itm ) { - return itm.has_flag( "RADIO_CONTAINER" ); + return itm.has_flag( flag_RADIO_CONTAINER ); } ); if( !radio_containers.empty() ) { for( auto items : radio_containers ) { auto itm = std::find_if( items->contents.begin(), items->contents.end(), [&]( const item & c ) { - return c.has_flag( "BOMB" ) && c.has_flag( signal ); + return c.has_flag( flag_BOMB ) && c.has_flag( signal ); } ); if( itm != items->contents.end() ) { @@ -8308,7 +8308,7 @@ int iuse::autoclave( player *p, item *it, bool t, const tripoint &pos ) it->active = false; it->erase_var( "CYCLETIME" ); for( item &bio : it->contents ) { - if( bio.is_bionic() && !bio.has_flag( "NO_PACKED" ) ) { + if( bio.is_bionic() && !bio.has_flag( flag_NO_PACKED ) ) { bio.unset_flag( "NO_STERILE" ); } } @@ -8454,7 +8454,7 @@ int iuse::multicooker( player *p, item *it, bool t, const tripoint &pos ) } } - if( p->has_trait( trait_HYPEROPIC ) && !p->worn_with_flag( "FIX_FARSIGHT" ) && + if( p->has_trait( trait_HYPEROPIC ) && !p->worn_with_flag( flag_FIX_FARSIGHT ) && !p->has_effect( effect_contacts ) ) { p->add_msg_if_player( m_info, _( "You'll need to put on reading glasses before you can see the screen." ) ); @@ -8518,11 +8518,11 @@ int iuse::multicooker( player *p, item *it, bool t, const tripoint &pos ) if( mc_take == choice ) { item &dish = *dish_it; - if( dish.has_flag( "FROZEN" ) ) { + if( dish.has_flag( flag_FROZEN ) ) { dish.cold_up(); //don't know how to check if the dish is frozen liquid and prevent extraction of it into inventory... } const std::string dish_name = dish.tname( dish.charges, false ); - const bool is_delicious = dish.has_flag( "HOT" ) && dish.has_flag( "EATEN_HOT" ); + const bool is_delicious = dish.has_flag( flag_HOT ) && dish.has_flag( flag_EATEN_HOT ); if( dish.made_of( LIQUID ) ) { if( !p->check_eligible_containers_for_crafting( *recipe_id( it->get_var( "RECIPE" ) ), 1 ) ) { p->add_msg_if_player( m_info, _( "You don't have a suitable container to store your %s." ), @@ -8644,10 +8644,9 @@ int iuse::multicooker( player *p, item *it, bool t, const tripoint &pos ) has_tools = false; } - static const quality_id SCREW_FINE( "SCREW_FINE" ); - if( !cinv.has_quality( SCREW_FINE ) ) { + if( !cinv.has_quality( qual_SCREW_FINE ) ) { p->add_msg_if_player( m_warning, _( "You need an item with %s of 1 or more to disassemble this." ), - SCREW_FINE.obj().name ); + qual_SCREW_FINE.obj().name ); has_tools = false; } @@ -8713,7 +8712,7 @@ int iuse::cable_attach( player *p, item *it, bool, const tripoint & ) avatar *you = p->as_avatar(); auto filter = [&]( const item & itm ) { - return itm.has_flag( "IS_UPS" ); + return itm.has_flag( flag_IS_UPS ); }; const std::string choose_ups = _( "Choose UPS:" ); @@ -8980,7 +8979,7 @@ int iuse::weather_tool( player *p, item *it, bool, const tripoint & ) p->add_msg_if_player( m_neutral, _( "The %s's monitor slowly outputs the data…" ), it->tname() ); } - if( it->has_flag( "THERMOMETER" ) ) { + if( it->has_flag( flag_THERMOMETER ) ) { if( it->typeId() == "thermometer" ) { p->add_msg_if_player( m_neutral, _( "The %1$s reads %2$s." ), it->tname(), print_temperature( player_local_temp ) ); @@ -8989,7 +8988,7 @@ int iuse::weather_tool( player *p, item *it, bool, const tripoint & ) print_temperature( player_local_temp ) ); } } - if( it->has_flag( "HYGROMETER" ) ) { + if( it->has_flag( flag_HYGROMETER ) ) { if( it->typeId() == "hygrometer" ) { p->add_msg_if_player( m_neutral, _( "The %1$s reads %2$s." ), it->tname(), @@ -9002,7 +9001,7 @@ int iuse::weather_tool( player *p, item *it, bool, const tripoint & ) g->is_sheltered( g->u.pos() ) ) ) ); } } - if( it->has_flag( "BAROMETER" ) ) { + if( it->has_flag( flag_BAROMETER ) ) { if( it->typeId() == "barometer" ) { p->add_msg_if_player( m_neutral, _( "The %1$s reads %2$s." ), it->tname(), @@ -9074,7 +9073,7 @@ int iuse::capture_monster_veh( player *p, item *it, bool, const tripoint &pos ) p->add_msg_if_player( m_info, _( "You cannot do that while mounted." ) ); return 0; } - if( !it->has_flag( "VEHICLE" ) ) { + if( !it->has_flag( flag_VEHICLE ) ) { p->add_msg_if_player( m_info, _( "The %s must be installed in a vehicle before being loaded." ), it->tname() ); return 0; @@ -9136,7 +9135,7 @@ int iuse::capture_monster_act( player *p, item *it, bool, const tripoint &pos ) // It's been activated somewhere where there isn't a player or monster, good. return 0; } - if( it->has_flag( "PLACE_RANDOMLY" ) ) { + if( it->has_flag( flag_PLACE_RANDOMLY ) ) { if( it->release_monster( p->pos(), 1 ) ) { return 0; } @@ -9539,20 +9538,20 @@ static int gobag( player *p, item *it, const bool is_personal ) for( item &content : items ) { if( content.is_armor() ) { - if( is_personal && !content.has_flag( "FIT" ) ) { - content.set_flag( "FIT" ); + if( is_personal && !content.has_flag( flag_FIT ) ) { + content.set_flag( flag_FIT ); } else if( content.typeId() == last_armor.typeId() ) { - if( last_armor.has_flag( "FIT" ) && !content.has_flag( "FIT" ) ) { - content.set_flag( "FIT" ); - } else if( !last_armor.has_flag( "FIT" ) && content.has_flag( "FIT" ) ) { - content.unset_flag( "FIT" ); + if( last_armor.has_flag( flag_FIT ) && !content.has_flag( flag_FIT ) ) { + content.set_flag( flag_FIT ); + } else if( !last_armor.has_flag( flag_FIT ) && content.has_flag( flag_FIT ) ) { + content.unset_flag( flag_FIT ); } } last_armor = content; } - if( units::to_liter( content.get_storage() ) >= 10.0 && it->has_flag( "FILTHY" ) ) { - content.set_flag( "FILTHY" ); + if( units::to_liter( content.get_storage() ) >= 10.0 && it->has_flag( flag_FILTHY ) ) { + content.set_flag( flag_FILTHY ); } g->m.add_item_or_charges( p->pos(), content );