Skip to content

Commit

Permalink
Moved more string consts into single file (CleverRaven#38237)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramza13 authored Feb 23, 2020
1 parent 5231875 commit 4987742
Show file tree
Hide file tree
Showing 37 changed files with 353 additions and 304 deletions.
2 changes: 1 addition & 1 deletion src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ static bool can_pickup_at( const tripoint &p )
bool veh_has_items = false;
const optional_vpart_position vp = g->m.veh_at( p );
if( vp ) {
const int cargo_part = vp->vehicle().part_with_feature( vp->part_index(), "CARGO", false );
const int cargo_part = vp->vehicle().part_with_feature( vp->part_index(), flag_CARGO, false );
veh_has_items = cargo_part >= 0 && !vp->vehicle().get_items( cargo_part ).empty();
}
return g->m.has_items( p ) || veh_has_items;
Expand Down
2 changes: 1 addition & 1 deletion src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2362,7 +2362,7 @@ struct weldrig_hack {
return false;
}

part = veh->part_with_feature( part, "WELDRIG", true );
part = veh->part_with_feature( part, flag_WELDRIG, true );
return part >= 0;
}

Expand Down
22 changes: 12 additions & 10 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ void put_into_vehicle_or_drop( Character &c, item_drop_reason reason, const std:
void put_into_vehicle_or_drop( Character &c, item_drop_reason reason, const std::list<item> &items,
const tripoint &where, bool force_ground )
{
const cata::optional<vpart_reference> vp = g->m.veh_at( where ).part_with_feature( "CARGO", false );
const cata::optional<vpart_reference> vp = g->m.veh_at( where ).part_with_feature( flag_CARGO,
false );
if( vp && !force_ground ) {
put_into_vehicle( c, reason, items, vp->vehicle(), vp->part_index() );
return;
Expand Down Expand Up @@ -883,7 +884,7 @@ static int move_cost( const item &it, const tripoint &src, const tripoint &dest
tripoint cart_position = g->u.pos() + g->u.grab_point;

if( const cata::optional<vpart_reference> vp = g->m.veh_at(
cart_position ).part_with_feature( "CARGO", false ) ) {
cart_position ).part_with_feature( flag_CARGO, false ) ) {
auto veh = vp->vehicle();
auto vstor = vp->part_index();
auto capacity = veh.free_volume( vstor );
Expand Down Expand Up @@ -1216,7 +1217,7 @@ static bool are_requirements_nearby( const std::vector<tripoint> &loot_spots,
temp_inv += elem2;
}
if( !in_loot_zones ) {
if( const cata::optional<vpart_reference> vp = g->m.veh_at( elem ).part_with_feature( "CARGO",
if( const cata::optional<vpart_reference> vp = g->m.veh_at( elem ).part_with_feature( flag_CARGO,
false ) ) {
vehicle &src_veh = vp->vehicle();
int src_part = vp->part_index();
Expand All @@ -1232,7 +1233,7 @@ static bool are_requirements_nearby( const std::vector<tripoint> &loot_spots,
const optional_vpart_position vp = g->m.veh_at( elem );
if( vp ) {
vehicle &veh = vp->vehicle();
const cata::optional<vpart_reference> weldpart = vp.part_with_feature( "WELDRIG", true );
const cata::optional<vpart_reference> weldpart = vp.part_with_feature( flag_WELDRIG, true );
if( weldpart ) {
item welder( "welder", 0 );
welder.charges = veh.fuel_left( fuel_type_battery, true );
Expand Down Expand Up @@ -1897,7 +1898,7 @@ static bool tidy_activity( player &p, const tripoint &src_loc,
vehicle *dest_veh;
int dest_part;
if( const cata::optional<vpart_reference> vp = g->m.veh_at(
loot_src_lot ).part_with_feature( "CARGO",
loot_src_lot ).part_with_feature( flag_CARGO,
false ) ) {
dest_veh = &vp->vehicle();
dest_part = vp->part_index();
Expand Down Expand Up @@ -1937,7 +1938,7 @@ static void fetch_activity( player &p, const tripoint &src_loc,
auto items_there = g->m.i_at( src_loc );
vehicle *src_veh = nullptr;
int src_part = 0;
if( const cata::optional<vpart_reference> vp = g->m.veh_at( src_loc ).part_with_feature( "CARGO",
if( const cata::optional<vpart_reference> vp = g->m.veh_at( src_loc ).part_with_feature( flag_CARGO,
false ) ) {
src_veh = &vp->vehicle();
src_part = vp->part_index();
Expand Down Expand Up @@ -2142,7 +2143,7 @@ void activity_on_turn_move_loot( player_activity &act, player &p )
}

//nothing to sort?
const cata::optional<vpart_reference> vp = g->m.veh_at( src_loc ).part_with_feature( "CARGO",
const cata::optional<vpart_reference> vp = g->m.veh_at( src_loc ).part_with_feature( flag_CARGO,
false );
if( ( !vp || vp->vehicle().get_items( vp->part_index() ).empty() )
&& g->m.i_at( src_loc ).empty() ) {
Expand Down Expand Up @@ -2213,7 +2214,7 @@ void activity_on_turn_move_loot( player_activity &act, player &p )
//Check source for cargo part
//map_stack and vehicle_stack are different types but inherit from item_stack
// TODO: use one for loop
if( const cata::optional<vpart_reference> vp = g->m.veh_at( src_loc ).part_with_feature( "CARGO",
if( const cata::optional<vpart_reference> vp = g->m.veh_at( src_loc ).part_with_feature( flag_CARGO,
false ) ) {
src_veh = &vp->vehicle();
src_part = vp->part_index();
Expand Down Expand Up @@ -2258,8 +2259,9 @@ void activity_on_turn_move_loot( player_activity &act, player &p )
const tripoint &dest_loc = g->m.getlocal( dest );

//Check destination for cargo part
if( const cata::optional<vpart_reference> vp = g->m.veh_at( dest_loc ).part_with_feature( "CARGO",
false ) ) {
if( const cata::optional<vpart_reference> vp = g->m.veh_at( dest_loc ).part_with_feature(
flag_CARGO,
false ) ) {
dest_veh = &vp->vehicle();
dest_part = vp->part_index();
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/advanced_inv_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <iterator>
#include <utility>
#include <numeric>
#include "cata_string_consts.h"

int advanced_inv_area::get_item_count() const
{
Expand Down Expand Up @@ -80,7 +81,7 @@ void advanced_inv_area::init()
off = g->u.grab_point;
// Reset position because offset changed
pos = g->u.pos() + off;
if( const cata::optional<vpart_reference> vp = g->m.veh_at( pos ).part_with_feature( "CARGO",
if( const cata::optional<vpart_reference> vp = g->m.veh_at( pos ).part_with_feature( flag_CARGO,
false ) ) {
veh = &vp->vehicle();
vstor = vp->part_index();
Expand Down Expand Up @@ -122,7 +123,7 @@ void advanced_inv_area::init()
case AIM_NORTH:
case AIM_NORTHEAST: {
const cata::optional<vpart_reference> vp =
g->m.veh_at( pos ).part_with_feature( "CARGO", false );
g->m.veh_at( pos ).part_with_feature( flag_CARGO, false );
if( vp ) {
veh = &vp->vehicle();
vstor = vp->part_index();
Expand Down Expand Up @@ -398,7 +399,7 @@ void advanced_inv_area::set_container_position()
// update the absolute position
pos = g->u.pos() + off;
// update vehicle information
if( const cata::optional<vpart_reference> vp = g->m.veh_at( pos ).part_with_feature( "CARGO",
if( const cata::optional<vpart_reference> vp = g->m.veh_at( pos ).part_with_feature( flag_CARGO,
false ) ) {
veh = &vp->vehicle();
vstor = vp->part_index();
Expand Down
4 changes: 2 additions & 2 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ bool avatar_action::move( avatar &you, map &m, int dx, int dy, int dz )
} else if( veh1 != veh0 ) {
add_msg( m_info, _( "There is another vehicle in the way." ) );
return false;
} else if( !vp1.part_with_feature( "BOARDABLE", true ) ) {
} else if( !vp1.part_with_feature( flag_BOARDABLE, true ) ) {
add_msg( m_info, _( "That part of the vehicle is currently unsafe." ) );
return false;
}
Expand Down Expand Up @@ -679,7 +679,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",
const bool v_mountable = static_cast<bool>( m.veh_at( you.pos() ).part_with_feature( flag_MOUNTABLE,
true ) );
bool t_mountable = m.has_flag_ter_or_furn( flag_MOUNTABLE, you.pos() );
if( !t_mountable && !v_mountable ) {
Expand Down
43 changes: 41 additions & 2 deletions src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ static const std::string flag_ACID_IMMUNE( "ACID_IMMUNE" );
static const std::string flag_ACT_IN_FIRE( "ACT_IN_FIRE" );
static const std::string flag_ACT_ON_RANGED_HIT( "ACT_ON_RANGED_HIT" );
static const std::string flag_ACTIVE_CLOAKING( "ACTIVE_CLOAKING" );
static const std::string flag_ADVANCED_PLANTER( "ADVANCED_PLANTER" );
static const std::string flag_AISLE( "AISLE" );
static const std::string flag_ALARMCLOCK( "ALARMCLOCK" );
static const std::string flag_ALARMED( "ALARMED" );
Expand All @@ -941,13 +942,15 @@ static const std::string flag_ALLOW_OUTSIDE( "ALLOW_OUTSIDE" );
static const std::string flag_ALLOW_ROTTEN( "ALLOW_ROTTEN" );
static const std::string flag_ALLOWS_NATURAL_ATTACKS( "ALLOWS_NATURAL_ATTACKS" );
static const std::string flag_ALLOWS_REMOTE_USE( "ALLOWS_REMOTE_USE" );
static const std::string flag_ALTERNATOR( "ALTERNATOR" );
static const std::string flag_ALWAYS_TWOHAND( "ALWAYS_TWOHAND" );
static const std::string flag_ANESTHESIA( "ANESTHESIA" );
static const std::string flag_ANIMAL_CTRL( "ANIMAL_CTRL" );
static const std::string flag_ARMOR( "ARMOR" );
static const std::string flag_AURA( "AURA" );
static const std::string flag_AUT_START( "AUT_START" );
static const std::string flag_auto_wield( "auto_wield" );
static const std::string flag_AUTOCLAVE( "AUTOCLAVE" );
static const std::string flag_AUTODOC( "AUTODOC" );
static const std::string flag_AUTODOC_COUCH( "AUTODOC_COUCH" );
static const std::string flag_AUTOPILOT( "AUTOPILOT" );
Expand All @@ -963,6 +966,7 @@ static const std::string flag_BED( "BED" );
static const std::string flag_BEEPER( "BEEPER" );
static const std::string flag_BELTABLE( "BELTABLE" );
static const std::string flag_BELTED( "BELTED" );
static const std::string flag_BIKE_RACK_VEH( "BIKE_RACK_VEH" );
static const std::string flag_BIO_IMMUNE( "BIO_IMMUNE" );
static const std::string flag_BIPOD( "BIPOD" );
static const std::string flag_BIRD( "BIRD" );
Expand All @@ -986,6 +990,7 @@ static const std::string flag_CAN_SIT( "CAN_SIT" );
static const std::string flag_CANNIBAL( "CANNIBAL" );
static const std::string flag_CANNIBALISM( "CANNIBALISM" );
static const std::string flag_CANT_HEAL_EVERYONE( "CANT_HEAL_EVERYONE" );
static const std::string flag_CAPTURE_MONSTER_VEH( "CAPTURE_MONSTER_VEH" );
static const std::string flag_CARGO( "CARGO" );
static const std::string flag_CARGO_LOCKING( "CARGO_LOCKING" );
static const std::string flag_CARNIVORE_OK( "CARNIVORE_OK" );
Expand Down Expand Up @@ -1013,7 +1018,10 @@ static const std::string flag_CONTROLS( "CONTROLS" );
static const std::string flag_COOKED( "COOKED" );
static const std::string flag_COOLER( "COOLER" );
static const std::string flag_CORPSE( "CORPSE" );
static const std::string flag_COVERED( "COVERED" );
static const std::string flag_CRAFTRIG( "CRAFTRIG" );
static const std::string flag_CRASH_TERRAIN_AROUND( "CRASH_TERRAIN_AROUND" );
static const std::string flag_CTRL_ELECTRONIC( "CTRL_ELECTRONIC" );
static const std::string flag_CURRENT( "CURRENT" );
static const std::string flag_CURTAIN( "CURTAIN" );
static const std::string flag_CUT_IMMUNE( "CUT_IMMUNE" );
Expand All @@ -1030,6 +1038,7 @@ 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_DIRTY( "DIRTY" );
static const std::string flag_DISABLE_SIGHTS( "DISABLE_SIGHTS" );
static const std::string flag_DISHWASHER( "DISHWASHER" );
static const std::string flag_DONT_REMOVE_ROTTEN( "DONT_REMOVE_ROTTEN" );
static const std::string flag_DOOR( "DOOR" );
static const std::string flag_DOOR_MOTOR( "DOOR_MOTOR" );
Expand All @@ -1038,6 +1047,7 @@ static const std::string flag_DURABLE_MELEE( "DURABLE_MELEE" );
static const std::string flag_E_ALTERNATOR( "E_ALTERNATOR" );
static const std::string flag_E_COLD_START( "E_COLD_START" );
static const std::string flag_E_COMBUSTION( "E_COMBUSTION" );
static const std::string flag_E_HEATER( "E_HEATER" );
static const std::string flag_E_HIGHER_SKILL( "E_HIGHER_SKILL" );
static const std::string flag_E_STARTS_INSTANTLY( "E_STARTS_INSTANTLY" );
static const std::string flag_EASY_DECONSTRUCT( "EASY_DECONSTRUCT" );
Expand Down Expand Up @@ -1100,7 +1110,9 @@ static const std::string flag_FORAGE_POISON( "FORAGE_POISON" );
static const std::string flag_FORGE( "FORGE" );
static const std::string flag_FRAGILE( "FRAGILE" );
static const std::string flag_FRAGILE_MELEE( "FRAGILE_MELEE" );
static const std::string flag_FREEZER( "FREEZER" );
static const std::string flag_FREEZERBURN( "FREEZERBURN" );
static const std::string flag_FRIDGE( "FRIDGE" );
static const std::string flag_FROZEN( "FROZEN" );
static const std::string flag_FUEL_TANK( "FUEL_TANK" );
static const std::string flag_FULL_BOARD( "FULL_BOARD" );
Expand Down Expand Up @@ -1144,6 +1156,7 @@ static const std::string flag_IRREMOVABLE( "IRREMOVABLE" );
static const std::string flag_IS_ARMOR( "IS_ARMOR" );
static const std::string flag_IS_PET_ARMOR( "IS_PET_ARMOR" );
static const std::string flag_IS_UPS( "IS_UPS" );
static const std::string flag_KILN( "KILN" );
static const std::string flag_KITCHEN( "KITCHEN" );
static const std::string flag_LADDER( "LADDER" );
static const std::string flag_LEAK_ALWAYS( "LEAK_ALWAYS" );
Expand Down Expand Up @@ -1279,6 +1292,7 @@ static const std::string flag_RAMP_END( "RAMP_END" );
static const std::string flag_RAW( "RAW" );
static const std::string flag_REACH_ATTACK( "REACH_ATTACK" );
static const std::string flag_REACH3( "REACH3" );
static const std::string flag_REAPER( "REAPER" );
static const std::string flag_REBREATHER( "REBREATHER" );
static const std::string flag_RECHARGE( "RECHARGE" );
static const std::string flag_REDUCED_BASHING( "REDUCED_BASHING" );
Expand All @@ -1303,6 +1317,7 @@ static const std::string flag_SAFECRACK( "SAFECRACK" );
static const std::string flag_SALT_WATER( "SALT_WATER" );
static const std::string flag_SAPIOVORE( "SAPIOVORE" );
static const std::string flag_SCEN_ONLY( "SCEN_ONLY" );
static const std::string flag_SCOOP( "SCOOP" );
static const std::string flag_SEALED( "SEALED" );
static const std::string flag_SEAT( "SEAT" );
static const std::string flag_SEATBELT( "SEATBELT" );
Expand All @@ -1315,6 +1330,15 @@ static const std::string flag_SHORT( "SHORT" );
static const std::string flag_SHRUB( "SHRUB" );
static const std::string flag_SIGN( "SIGN" );
static const std::string flag_SILENT( "SILENT" );
static const std::string flag_MULTISQUARE( "MULTISQUARE" );
static const std::string flag_CONE_LIGHT( "CONE_LIGHT" );
static const std::string flag_CIRCLE_LIGHT( "CIRCLE_LIGHT" );
static const std::string flag_AISLE_LIGHT( "AISLE_LIGHT" );
static const std::string flag_ROCKWHEEL( "ROCKWHEEL" );
static const std::string flag_PLOW( "PLOW" );
static const std::string flag_ROADHEAD( "ROADHEAD" );
static const std::string flag_DOME_LIGHT( "DOME_LIGHT" );
static const std::string flag_ATOMIC_LIGHT( "ATOMIC_LIGHT" );
static const std::string flag_SKINNED( "SKINNED" );
static const std::string flag_SKINTIGHT( "SKINTIGHT" );
static const std::string flag_SLEEP_AID( "SLEEP_AID" );
Expand Down Expand Up @@ -1352,9 +1376,11 @@ static const std::string flag_TIE_UP( "TIE_UP" );
static const std::string flag_TINDER( "TINDER" );
static const std::string flag_TINY( "TINY" );
static const std::string flag_TOBACCO( "TOBACCO" );
static const std::string flag_TOWEL( "TOWEL" );
static const std::string flag_TRACK( "TRACK" );
static const std::string flag_TRACKED( "TRACKED" );
static const std::string flag_TRADER_AVOID( "TRADER_AVOID" );
static const std::string flag_TRANSFORM_TERRAIN( "TRANSFORM_TERRAIN" );
static const std::string flag_TRANSLOCATOR( "TRANSLOCATOR" );
static const std::string flag_TRANSPARENT( "TRANSPARENT" );
static const std::string flag_TREE( "TREE" );
Expand Down Expand Up @@ -1385,6 +1411,7 @@ static const std::string flag_VEHICLE( "VEHICLE" );
static const std::string flag_VISION( "VISION" );
static const std::string flag_WAIST( "WAIST" );
static const std::string flag_WALL( "WALL" );
static const std::string flag_WASHING_MACHINE( "WASHING_MACHINE" );
static const std::string flag_WATCH( "WATCH" );
static const std::string flag_WATER_EXTINGUISH( "WATER_EXTINGUISH" );
static const std::string flag_WATER_FRIENDLY( "WATER_FRIENDLY" );
Expand Down Expand Up @@ -1412,7 +1439,6 @@ static const std::string flag_WRITE_MESSAGE( "WRITE_MESSAGE" );
static const std::string flag_YOUNG( "YOUNG" );
static const std::string flag_ZOOM( "ZOOM" );


static const skill_id skill_archery( "archery" );
static const skill_id skill_barter( "barter" );
static const skill_id skill_bashing( "bashing" );
Expand Down Expand Up @@ -1473,6 +1499,19 @@ static const zone_type_id zone_type_LOOT_WOOD( "LOOT_WOOD" );
static const zone_type_id zone_type_NO_AUTO_PICKUP( "NO_AUTO_PICKUP" );
static const zone_type_id zone_type_VEHICLE_DECONSTRUCT( "VEHICLE_DECONSTRUCT" );
static const zone_type_id zone_type_VEHICLE_REPAIR( "VEHICLE_REPAIR" );
static const zone_type_id zone_type_LOOT_CUSTOM( "LOOT_CUSTOM" );
static const zone_type_id zone_type_NO_NPC_PICKUP( "NO_NPC_PICKUP" );
static const zone_type_id zone_type_NPC_RETREAT( "NPC_RETREAT" );
static const zone_type_id zone_type_NPC_NO_INVESTIGATE( "NPC_NO_INVESTIGATE" );
static const zone_type_id zone_type_NPC_INVESTIGATE_ONLY( "NPC_INVESTIGATE_ONLY" );
static const zone_type_id zone_type_SOURCE_FIREWOOD( "SOURCE_FIREWOOD" );
static const zone_type_id zone_type_VEHICLE_PATROL( "VEHICLE_PATROL" );
static const zone_type_id zone_type_CAMP_STORAGE( "CAMP_STORAGE" );
static const zone_type_id zone_type_LOOT_PDRINK( "LOOT_PDRINK" );
static const zone_type_id zone_type_LOOT_DRINK( "LOOT_DRINK" );
static const zone_type_id zone_type_LOOT_PFOOD( "LOOT_PFOOD" );
static const zone_type_id zone_type_LOOT_FOOD( "LOOT_FOOD" );
static const zone_type_id zone_type_CAMP_FOOD( "CAMP_FOOD" );

static const zone_type_id z_camp_food( "CAMP_FOOD" );
static const zone_type_id z_camp_storage( "CAMP_STORAGE" );
Expand All @@ -1487,7 +1526,7 @@ static const itype_id fuel_type_animal( "animal" );
static const itype_id fuel_type_battery( "battery" );
static const itype_id fuel_type_muscle( "muscle" );
static const itype_id fuel_type_none( "null" );
static const itype_id fuel_type_plutonium_cell( "plut_cell" );
static const itype_id fuel_type_plut_cell( "plut_cell" );
static const itype_id fuel_type_sun_light( "sunlight" );
static const itype_id fuel_type_water( "water" );
static const itype_id fuel_type_water_clean( "water_clean" );
Expand Down
2 changes: 1 addition & 1 deletion src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,7 @@ bool cata_tiles::draw_vpart( const tripoint &p, lit_level ll, int &height_3d,
g->u.memorize_tile( g->m.getabs( p ), vpname, subtile, rotation );
}
if( !overridden ) {
const cata::optional<vpart_reference> cargopart = vp.part_with_feature( "CARGO", true );
const cata::optional<vpart_reference> cargopart = vp.part_with_feature( flag_CARGO, true );
const bool draw_highlight = cargopart && !veh.get_items( cargopart->part_index() ).empty();
const bool ret = draw_from_id_string( vpname, C_VEHICLE_PART, empty_string, p, subtile, rotation,
ll, nv_goggles_activated, height_3d );
Expand Down
Loading

0 comments on commit 4987742

Please sign in to comment.