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

Yet more string consts moved out #38130

Merged
merged 2 commits into from
Feb 18, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/armor_layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ std::vector<std::string> clothing_flags_description( const item &worn_item )

if( worn_item.has_flag( flag_FIT ) ) {
description_stack.push_back( _( "It fits you well." ) );
} else if( worn_item.has_flag( "VARSIZE" ) ) {
} else if( worn_item.has_flag( flag_VARSIZE ) ) {
description_stack.push_back( _( "It could be refitted." ) );
}

Expand Down
4 changes: 2 additions & 2 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ bool avatar_action::fire_check( avatar &you, const map &m, const targeting_data
if( mode_map.second->has_flag( flag_MOUNTED_GUN ) ) {
const bool v_mountable = static_cast<bool>( m.veh_at( you.pos() ).part_with_feature( "MOUNTABLE",
true ) );
bool t_mountable = m.has_flag_ter_or_furn( "MOUNTABLE", you.pos() );
bool t_mountable = m.has_flag_ter_or_furn( flag_MOUNTABLE, you.pos() );
if( !t_mountable && !v_mountable ) {
messages.push_back( string_format(
_( "You must stand near acceptable terrain or furniture to use this %s. A table, a mound of dirt, a broken window, etc." ),
Expand Down Expand Up @@ -1140,7 +1140,7 @@ void avatar_action::unload( avatar &you )
it = &you.i_at( loc.obtain( you ) );
}
if( you.unload( *it ) ) {
if( it->has_flag( "MAG_DESTROY" ) && it->ammo_remaining() == 0 ) {
if( it->has_flag( flag_MAG_DESTROY ) && it->ammo_remaining() == 0 ) {
you.remove_item( *it );
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@ 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( "CAMERA" );
static const std::string flag_CAMERA_CONTROL( "CAMERA_CONTROL" );
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" );
Expand Down Expand Up @@ -1059,6 +1061,7 @@ static const std::string flag_HELMET_COMPAT( "HELMET_COMPAT" );
static const std::string flag_HIDDEN_HALLU( "HIDDEN_HALLU" );
static const std::string flag_HIDDEN_ITEM( "HIDDEN_ITEM" );
static const std::string flag_HIDDEN_POISON( "HIDDEN_POISON" );
static const std::string flag_HIDE_PLACE( "HIDE_PLACE" );
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" );
Expand Down Expand Up @@ -1155,6 +1158,7 @@ static const std::string flag_RADIO_ACTIVATION( "RADIO_ACTIVATION" );
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_RADIO_MODABLE( "RADIO_MODABLE" );
static const std::string flag_RADIOACTIVE( "RADIOACTIVE" );
static const std::string flag_RADIOCARITEM( "RADIOCARITEM" );
static const std::string flag_RADIOSIGNAL_1( "RADIOSIGNAL_1" );
Expand Down Expand Up @@ -1227,6 +1231,7 @@ static const std::string flag_UNSTABLE( "UNSTABLE" );
static const std::string flag_URSINE_HONEY( "URSINE_HONEY" );
static const std::string flag_USABLE_FIRE( "USABLE_FIRE" );
static const std::string flag_USE_EAT_VERB( "USE_EAT_VERB" );
static const std::string flag_USE_PLAYER_ENERGY( "USE_PLAYER_ENERGY" );
static const std::string flag_USE_UPS( "USE_UPS" );
static const std::string flag_USES_BIONIC_POWER( "USES_BIONIC_POWER" );
static const std::string flag_VARSIZE( "VARSIZE" );
Expand Down Expand Up @@ -1272,7 +1277,7 @@ static const skill_id skill_tailor( "tailor" );
static const skill_id skill_throw( "throw" );
static const skill_id skill_traps( "traps" );
static const skill_id skill_unarmed( "unarmed" );
static const skill_id weapon_skill( "weapon" );
static const skill_id skill_weapon( "weapon" );


static const quality_id qual_ANESTHESIA( "ANESTHESIA" );
Expand Down
3 changes: 2 additions & 1 deletion src/editmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "shadowcasting.h"
#include "string_id.h"
#include "colony.h"
#include "cata_string_consts.h"

static constexpr tripoint editmap_boundary_min( 0, 0, -OVERMAP_DEPTH );
static constexpr tripoint editmap_boundary_max( MAPSIZE_X, MAPSIZE_Y, OVERMAP_HEIGHT + 1 );
Expand Down Expand Up @@ -642,7 +643,7 @@ void editmap::update_view_with_help( const std::string &txt, const std::string &
}
map_stack target_stack = g->m.i_at( target );
const int target_stack_size = target_stack.size();
if( !g->m.has_flag( "CONTAINER", target ) && target_stack_size > 0 ) {
if( !g->m.has_flag( flag_CONTAINER, target ) && target_stack_size > 0 ) {
trim_and_print( w_info, point( 1, off ), getmaxx( w_info ), c_light_gray,
_( "There is a %s there." ),
target_stack.begin()->tname() );
Expand Down
2 changes: 1 addition & 1 deletion src/explosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ void emp_blast( const tripoint &p )
int x = p.x;
int y = p.y;
const bool sight = g->u.sees( p );
if( g->m.has_flag( "CONSOLE", point( x, y ) ) ) {
if( g->m.has_flag( flag_CONSOLE, point( x, y ) ) ) {
if( sight ) {
add_msg( _( "The %s is rendered non-functional!" ), g->m.tername( point( x, y ) ) );
}
Expand Down
12 changes: 6 additions & 6 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5806,9 +5806,9 @@ void game::print_items_info( const tripoint &lp, const catacurses::window &w_loo
{
if( !m.sees_some_items( lp, u ) ) {
return;
} else if( m.has_flag( "CONTAINER", lp ) && !m.could_see_items( lp, u ) ) {
} else if( m.has_flag( flag_CONTAINER, lp ) && !m.could_see_items( lp, u ) ) {
mvwprintw( w_look, point( column, ++line ), _( "You cannot see what is inside of it." ) );
} else if( u.has_effect( effect_blind ) || u.worn_with_flag( "BLIND" ) ) {
} else if( u.has_effect( effect_blind ) || u.worn_with_flag( flag_BLIND ) ) {
mvwprintz( w_look, point( column, ++line ), c_yellow,
_( "There's something there, but you can't see what it is." ) );
return;
Expand Down Expand Up @@ -9462,7 +9462,7 @@ bool game::grabbed_furn_move( const tripoint &dp )
critter_at<npc>( fdest ) == nullptr &&
critter_at<monster>( fdest ) == nullptr &&
( !pulling_furniture || is_empty( u.pos() + dp ) ) &&
( !has_floor || m.has_flag( "FLAT", fdest ) ) &&
( !has_floor || m.has_flag( flag_FLAT, fdest ) ) &&
!m.has_furn( fdest ) &&
!m.veh_at( fdest ) &&
( !has_floor || m.tr_at( fdest ).is_null() )
Expand Down Expand Up @@ -9892,7 +9892,7 @@ void game::vertical_move( int movez, bool force )
bool climbing = false;
int move_cost = 100;
tripoint stairs( u.posx(), u.posy(), u.posz() + movez );
if( m.has_zlevels() && !force && movez == 1 && !m.has_flag( "GOES_UP", u.pos() ) ) {
if( m.has_zlevels() && !force && movez == 1 && !m.has_flag( flag_GOES_UP, u.pos() ) ) {
// Climbing
if( m.has_floor_or_support( stairs ) ) {
add_msg( m_info, _( "You can't climb here - there's a ceiling above your head." ) );
Expand Down Expand Up @@ -9930,10 +9930,10 @@ void game::vertical_move( int movez, bool force )
}
}

if( !force && movez == -1 && !m.has_flag( "GOES_DOWN", u.pos() ) ) {
if( !force && movez == -1 && !m.has_flag( flag_GOES_DOWN, u.pos() ) ) {
add_msg( m_info, _( "You can't go down here!" ) );
return;
} else if( !climbing && !force && movez == 1 && !m.has_flag( "GOES_UP", u.pos() ) ) {
} else if( !climbing && !force && movez == 1 && !m.has_flag( flag_GOES_UP, u.pos() ) ) {
add_msg( m_info, _( "You can't go up here!" ) );
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3848,7 +3848,7 @@ static int findBestGasDiscount( player &p )
for( size_t i = 0; i < p.inv.size(); i++ ) {
item &it = p.inv.find_item( i );

if( it.has_flag( "GAS_DISCOUNT" ) ) {
if( it.has_flag( flag_GAS_DISCOUNT ) ) {

int q = getGasDiscountCardQuality( it );
if( q > discount ) {
Expand Down
4 changes: 2 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ void item::basic_info( std::vector<iteminfo> &info, const iteminfo_query *parts,
} else if( idescription != item_vars.end() ) {
info.push_back( iteminfo( "DESCRIPTION", idescription->second ) );
} else {
if( has_flag( "MAGIC_FOCUS" ) ) {
if( has_flag( flag_MAGIC_FOCUS ) ) {
info.push_back( iteminfo( "DESCRIPTION",
_( "This item is a <info>magical focus</info>. "
"You can cast spells with it in your hand." ) ) );
Expand Down Expand Up @@ -9418,7 +9418,7 @@ skill_id item::contextualize_skill( const skill_id &id ) const
if( id->is_contextual_skill() ) {


if( id == weapon_skill ) {
if( id == skill_weapon ) {
if( is_gun() ) {
return gun_skill();
} else if( is_melee() ) {
Expand Down
12 changes: 6 additions & 6 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static const std::vector<ter_str_id> camera_ter_whitelist_types = {

void remove_radio_mod( item &it, player &p )
{
if( !it.has_flag( "RADIO_MOD" ) ) {
if( !it.has_flag( flag_RADIO_MOD ) ) {
return;
}
p.add_msg_if_player( _( "You remove the radio modification from your %s!" ), it.tname() );
Expand All @@ -179,7 +179,7 @@ void remove_radio_mod( item &it, player &p )
static bool check_litcig( player &u )
{
auto cigs = u.items_with( []( const item & it ) {
return it.active && it.has_flag( "LITCIG" );
return it.active && it.has_flag( flag_LITCIG );
} );
if( cigs.empty() ) {
return true;
Expand Down Expand Up @@ -674,7 +674,7 @@ int iuse::poison( player *p, item *it, bool, const tripoint & )

// NPCs have a magical sense of what is inedible
// Players can abuse the crafting menu instead...
if( !it->has_flag( "HIDDEN_POISON" ) &&
if( !it->has_flag( flag_HIDDEN_POISON ) &&
( p->is_npc() ||
!p->query_yn( _( "Are you sure you want to eat this? It looks poisonous…" ) ) ) ) {
return 0;
Expand Down Expand Up @@ -1462,7 +1462,7 @@ int iuse::radio_mod( player *p, item *, bool, const tripoint & )
}

auto filter = []( const item & itm ) {
return itm.has_flag( "RADIO_MODABLE" );
return itm.has_flag( flag_RADIO_MODABLE );
};

// note: if !p->is_npc() then p is avatar
Expand Down Expand Up @@ -1498,7 +1498,7 @@ int iuse::radio_mod( player *p, item *, bool, const tripoint & )
return 0;
}

if( modded.has_flag( "RADIO_MOD" ) && modded.has_flag( newtag ) ) {
if( modded.has_flag( flag_RADIO_MOD ) && modded.has_flag( newtag ) ) {
p->add_msg_if_player( _( "This item has been modified this way already." ) );
return 0;
}
Expand Down Expand Up @@ -9319,7 +9319,7 @@ int iuse::wash_items( player *p, bool soft_items, bool hard_items )
crafting_inv.charges_of( "detergent" ) );

const inventory_filter_preset preset( [soft_items, hard_items]( const item_location & location ) {
return location->has_flag( "FILTHY" ) && ( ( soft_items && location->is_soft() ) ||
return location->has_flag( flag_FILTHY ) && ( ( soft_items && location->is_soft() ) ||
( hard_items && !location->is_soft() ) );
} );
auto make_raw_stats = [available_water, available_cleanser](
Expand Down
40 changes: 20 additions & 20 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int iuse_transform::use( player &p, item &it, bool t, const tripoint &pos ) cons
}

const bool possess = p.has_item( it ) ||
( it.has_flag( "ALLOWS_REMOTE_USE" ) && square_dist( p.pos(), pos ) == 1 );
( it.has_flag( flag_ALLOWS_REMOTE_USE ) && square_dist( p.pos(), pos ) == 1 );

if( possess && need_worn && !p.is_worn( it ) ) {
p.add_msg_if_player( m_info, _( "You need to wear the %1$s before activating it." ), it.tname() );
Expand Down Expand Up @@ -269,7 +269,7 @@ void iuse_transform::finalize( const itype_id & )
void iuse_transform::info( const item &it, std::vector<iteminfo> &dump ) const
{
item dummy( target, calendar::turn, std::max( ammo_qty, 1 ) );
if( it.has_flag( "FIT" ) ) {
if( it.has_flag( flag_FIT ) ) {
dummy.item_tags.insert( "FIT" );
}
dump.emplace_back( "TOOL", string_format( _( "<bold>Turns into</bold>: %s" ),
Expand Down Expand Up @@ -1056,21 +1056,21 @@ void deploy_furn_actor::info( const item &, std::vector<iteminfo> &dump ) const
if( the_furn.workbench.has_value() ) {
can_function_as.emplace_back( _( "a <info>crafting station</info>" ) );
}
if( the_furn.has_flag( "BUTCHER_EQ" ) ) {
if( the_furn.has_flag( flag_BUTCHER_EQ ) ) {
can_function_as.emplace_back(
_( "a place to hang <info>corpses for butchering</info>" ) );
}
if( the_furn.has_flag( "FLAT_SURF" ) ) {
if( the_furn.has_flag( flag_FLAT_SURF ) ) {
can_function_as.emplace_back(
_( "a flat surface to <info>butcher</info> onto or <info>eat meals</info> from" ) );
}
if( the_furn.has_flag( "CAN_SIT" ) ) {
if( the_furn.has_flag( flag_CAN_SIT ) ) {
can_function_as.emplace_back( _( "a place to <info>sit</info>" ) );
}
if( the_furn.has_flag( "HIDE_PLACE" ) ) {
if( the_furn.has_flag( flag_HIDE_PLACE ) ) {
can_function_as.emplace_back( _( "a place to <info>hide</info>" ) );
}
if( the_furn.has_flag( "FIRE_CONTAINER" ) ) {
if( the_furn.has_flag( flag_FIRE_CONTAINER ) ) {
can_function_as.emplace_back( _( "a safe place to <info>contain a fire</info>" ) );
}
if( the_furn.crafting_pseudo_item == "char_smoker" ) {
Expand Down Expand Up @@ -2448,7 +2448,7 @@ int cast_spell_actor::use( player &p, item &it, bool, const tripoint & ) const
cast_spell.values.emplace_back( 0 );
}
cast_spell.name = casting.id().c_str();
if( it.has_flag( "USE_PLAYER_ENERGY" ) ) {
if( it.has_flag( flag_USE_PLAYER_ENERGY ) ) {
// [2] this value overrides the mana cost if set to 0
cast_spell.values.emplace_back( 1 );
charges = 0;
Expand Down Expand Up @@ -3107,7 +3107,7 @@ bool repair_item_actor::can_repair_target( player &pl, const item &fix,
}
return false;
}
if( fix.count_by_charges() || fix.has_flag( "NO_REPAIR" ) ) {
if( fix.count_by_charges() || fix.has_flag( flag_NO_REPAIR ) ) {
if( print_msg ) {
pl.add_msg_if_player( m_info, _( "You cannot repair this type of item." ) );
}
Expand All @@ -3128,14 +3128,14 @@ bool repair_item_actor::can_repair_target( player &pl, const item &fix,
return false;
}

const bool can_be_refitted = fix.has_flag( "VARSIZE" );
if( can_be_refitted && !fix.has_flag( "FIT" ) ) {
const bool can_be_refitted = fix.has_flag( flag_VARSIZE );
if( can_be_refitted && !fix.has_flag( flag_FIT ) ) {
return true;
}

const bool resizing_matters = fix.get_encumber( pl ) != 0;
const bool small = pl.has_trait( trait_SMALL2 ) || pl.has_trait( trait_SMALL_OK );
const bool can_resize = small != fix.has_flag( "UNDERSIZE" );
const bool can_resize = small != fix.has_flag( flag_UNDERSIZE );
if( can_be_refitted && resizing_matters && can_resize ) {
return true;
}
Expand All @@ -3152,7 +3152,7 @@ bool repair_item_actor::can_repair_target( player &pl, const item &fix,
return false;
}

if( fix.has_flag( "PRIMITIVE_RANGED_WEAPON" ) || !fix.reinforceable() ) {
if( fix.has_flag( flag_PRIMITIVE_RANGED_WEAPON ) || !fix.reinforceable() ) {
if( print_msg ) {
pl.add_msg_if_player( m_info, _( "You cannot improve your %s any more this way." ),
fix.tname() );
Expand Down Expand Up @@ -3343,7 +3343,7 @@ repair_item_actor::attempt_hint repair_item_actor::repair( player &pl, item &too

if( action == RT_REFIT ) {
if( roll == SUCCESS ) {
if( !fix->has_flag( "FIT" ) ) {
if( !fix->has_flag( flag_FIT ) ) {
pl.add_msg_if_player( m_good, _( "You take your %s in, improving the fit." ),
fix->tname() );
fix->item_tags.insert( "FIT" );
Expand Down Expand Up @@ -3380,7 +3380,7 @@ repair_item_actor::attempt_hint repair_item_actor::repair( player &pl, item &too
}

if( action == RT_REINFORCE ) {
if( fix->has_flag( "PRIMITIVE_RANGED_WEAPON" ) || !fix->reinforceable() ) {
if( fix->has_flag( flag_PRIMITIVE_RANGED_WEAPON ) || !fix->reinforceable() ) {
pl.add_msg_if_player( m_info, _( "You cannot improve your %s any more this way." ),
fix->tname() );
return AS_CANT;
Expand Down Expand Up @@ -4004,8 +4004,8 @@ int place_trap_actor::use( player &p, item &it, bool, const tripoint & ) const
}
}

const bool has_shovel = p.has_quality( quality_id( "DIG" ), 3 );
const bool is_diggable = g->m.has_flag( "DIGGABLE", pos );
const bool has_shovel = p.has_quality( qual_DIG, 3 );
const bool is_diggable = g->m.has_flag( flag_DIGGABLE, pos );
bool bury = false;
if( could_bury && has_shovel && is_diggable ) {
bury = query_yn( _( bury_question ) );
Expand Down Expand Up @@ -4144,9 +4144,9 @@ ret_val<bool> install_bionic_actor::can_use( const Character &p, const item &it,
!p.has_trait( trait_DEBUG_BIONICS ) ) {
return ret_val<bool>::make_failure( _( "You can't self-install bionics." ) );
} else if( !p.has_trait( trait_DEBUG_BIONICS ) ) {
if( it.has_flag( "FILTHY" ) ) {
if( it.has_flag( flag_FILTHY ) ) {
return ret_val<bool>::make_failure( _( "You can't install a filthy CBM!" ) );
} else if( it.has_flag( "NO_STERILE" ) ) {
} else if( it.has_flag( flag_NO_STERILE ) ) {
return ret_val<bool>::make_failure( _( "This CBM is not sterile, you can't install it." ) );
} else if( it.has_fault( fault_bionic_salvaged ) ) {
return ret_val<bool>::make_failure(
Expand Down Expand Up @@ -4422,7 +4422,7 @@ int deploy_tent_actor::use( player &p, item &it, bool, const tripoint & ) const
add_msg( m_info, _( "The %s is in the way." ), c->disp_name() );
return 0;
}
if( g->m.impassable( dest ) || !g->m.has_flag( "FLAT", dest ) ) {
if( g->m.impassable( dest ) || !g->m.has_flag( flag_FLAT, dest ) ) {
add_msg( m_info, _( "The %s in that direction isn't suitable for placing the %s." ),
g->m.name( dest ), it.tname() );
return 0;
Expand Down
6 changes: 3 additions & 3 deletions src/lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,10 +1155,10 @@ void map::build_seen_cache( const tripoint &origin, const int target_z )
const tripoint mirror_pos = vp.pos();
// We can utilize the current state of the seen cache to determine
// if the player can see the mirror from their position.
if( !vp.info().has_flag( "CAMERA" ) &&
if( !vp.info().has_flag( flag_CAMERA ) &&
seen_cache[mirror_pos.x][mirror_pos.y] < LIGHT_TRANSPARENCY_SOLID + 0.1 ) {
continue;
} else if( !vp.info().has_flag( "CAMERA_CONTROL" ) ) {
} else if( !vp.info().has_flag( flag_CAMERA_CONTROL ) ) {
mirrors.emplace_back( static_cast<int>( vp.part_index() ) );
} else {
if( square_dist( origin, mirror_pos ) <= 1 && veh->camera_on ) {
Expand All @@ -1168,7 +1168,7 @@ void map::build_seen_cache( const tripoint &origin, const int target_z )
}

for( int mirror : mirrors ) {
bool is_camera = veh->part_info( mirror ).has_flag( "CAMERA" );
bool is_camera = veh->part_info( mirror ).has_flag( flag_CAMERA );
if( is_camera && cam_control < 0 ) {
continue; // Player not at camera control, so cameras don't work
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ void furn_t::check() const
if( !close.is_valid() ) {
debugmsg( "invalid furniture %s for closing %s", close.c_str(), id.c_str() );
}
if( has_flag( "EMITTER" ) ) {
if( has_flag( flag_EMITTER ) ) {
if( emissions.empty() ) {
debugmsg( "furn %s has the EMITTER flag, but no emissions were set", id.c_str() );
} else {
Expand Down
Loading