Skip to content

Commit

Permalink
Move more string consts into single file (#38175)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramza13 authored Feb 20, 2020
1 parent 9c9835f commit 571efb2
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 101 deletions.
5 changes: 2 additions & 3 deletions src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ static const efftype_id effect_weed_high( "weed_high" );
static const efftype_id effect_winded( "winded" );
static const efftype_id effect_zapped( "zapped" );


static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" );
static const trait_id trait_ACIDPROOF( "ACIDPROOF" );
static const trait_id trait_ADDICTIVE( "ADDICTIVE" );
Expand Down Expand Up @@ -758,7 +757,6 @@ static const mongroup_id GROUP_WORM( "GROUP_WORM" );
static const mongroup_id GROUP_ZOMBIE( "GROUP_ZOMBIE" );
static const mongroup_id GROUP_ZOMBIE_COP( "GROUP_ZOMBIE_COP" );


static const mtype_id mon_amigara_horror( "mon_amigara_horror" );
static const mtype_id mon_ant( "mon_ant" );
static const mtype_id mon_ant_acid_larva( "mon_ant_acid_larva" );
Expand Down Expand Up @@ -824,6 +822,7 @@ static const mtype_id mon_hologram( "mon_hologram" );
static const mtype_id mon_horse( "mon_horse" );
static const mtype_id mon_hound_tindalos_afterimage( "mon_hound_tindalos_afterimage" );
static const mtype_id mon_jabberwock( "mon_jabberwock" );
static const mtype_id mon_laserturret( "mon_laserturret" );
static const mtype_id mon_leech_blossom( "mon_leech_blossom" );
static const mtype_id mon_leech_root_drone( "mon_leech_root_drone" );
static const mtype_id mon_leech_root_runner( "mon_leech_root_runner" );
Expand All @@ -835,6 +834,7 @@ static const mtype_id mon_marloss_zealot_m( "mon_marloss_zealot_m" );
static const mtype_id mon_mink( "mon_mink" );
static const mtype_id mon_moose( "mon_moose" );
static const mtype_id mon_muskrat( "mon_muskrat" );
static const mtype_id mon_null( "mon_null" );
static const mtype_id mon_opossum( "mon_opossum" );
static const mtype_id mon_otter( "mon_otter" );
static const mtype_id mon_pheasant( "mon_pheasant" );
Expand Down Expand Up @@ -1349,7 +1349,6 @@ 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 z_camp_food( "CAMP_FOOD" );
static const zone_type_id z_camp_storage( "CAMP_STORAGE" );
static const zone_type_id z_loot_unsorted( "LOOT_UNSORTED" );
Expand Down
40 changes: 20 additions & 20 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8305,26 +8305,26 @@ int Character::bonus_item_warmth( body_part bp ) const
bool Character::can_use_floor_warmth() const
{
return in_sleep_state() ||
has_activity( activity_id( "ACT_WAIT" ) ) ||
has_activity( activity_id( "ACT_WAIT_NPC" ) ) ||
has_activity( activity_id( "ACT_WAIT_STAMINA" ) ) ||
has_activity( activity_id( "ACT_AUTODRIVE" ) ) ||
has_activity( activity_id( "ACT_READ" ) ) ||
has_activity( activity_id( "ACT_SOCIALIZE" ) ) ||
has_activity( activity_id( "ACT_MEDITATE" ) ) ||
has_activity( activity_id( "ACT_FISH" ) ) ||
has_activity( activity_id( "ACT_GAME" ) ) ||
has_activity( activity_id( "ACT_HAND_CRANK" ) ) ||
has_activity( activity_id( "ACT_HEATING" ) ) ||
has_activity( activity_id( "ACT_VIBE" ) ) ||
has_activity( activity_id( "ACT_TRY_SLEEP" ) ) ||
has_activity( activity_id( "ACT_OPERATION" ) ) ||
has_activity( activity_id( "ACT_TREE_COMMUNION" ) ) ||
has_activity( activity_id( "ACT_EAT_MENU" ) ) ||
has_activity( activity_id( "ACT_CONSUME_FOOD_MENU" ) ) ||
has_activity( activity_id( "ACT_CONSUME_DRINK_MENU" ) ) ||
has_activity( activity_id( "ACT_CONSUME_MEDS_MENU" ) ) ||
has_activity( activity_id( "ACT_STUDY_SPELL" ) );
has_activity( ACT_WAIT ) ||
has_activity( ACT_WAIT_NPC ) ||
has_activity( ACT_WAIT_STAMINA ) ||
has_activity( ACT_AUTODRIVE ) ||
has_activity( ACT_READ ) ||
has_activity( ACT_SOCIALIZE ) ||
has_activity( ACT_MEDITATE ) ||
has_activity( ACT_FISH ) ||
has_activity( ACT_GAME ) ||
has_activity( ACT_HAND_CRANK ) ||
has_activity( ACT_HEATING ) ||
has_activity( ACT_VIBE ) ||
has_activity( ACT_TRY_SLEEP ) ||
has_activity( ACT_OPERATION ) ||
has_activity( ACT_TREE_COMMUNION ) ||
has_activity( ACT_EAT_MENU ) ||
has_activity( ACT_CONSUME_FOOD_MENU ) ||
has_activity( ACT_CONSUME_DRINK_MENU ) ||
has_activity( ACT_CONSUME_MEDS_MENU ) ||
has_activity( ACT_STUDY_SPELL );
}

int Character::floor_bedding_warmth( const tripoint &pos )
Expand Down
2 changes: 1 addition & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8366,7 +8366,7 @@ void game::reload_weapon( bool try_everything )
if( veh && ( turret = veh->turret_query( u.pos() ) ) && turret.can_reload() ) {
item::reload_option opt = g->u.select_ammo( *turret.base(), true );
if( opt ) {
g->u.assign_activity( activity_id( "ACT_RELOAD" ), opt.moves(), opt.qty() );
g->u.assign_activity( activity_id( ACT_RELOAD ), opt.moves(), opt.qty() );
g->u.activity.targets.emplace_back( turret.base() );
g->u.activity.targets.push_back( std::move( opt.ammo ) );
}
Expand Down
5 changes: 3 additions & 2 deletions src/handle_liquid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "optional.h"
#include "player_activity.h"
#include "string_formatter.h"
#include "cata_string_consts.h"

#define dbg(x) DebugLog((x),D_GAME) << __FILE__ << ":" << __LINE__ << ": "

Expand Down Expand Up @@ -301,11 +302,11 @@ static bool perform_liquid_transfer( item &liquid, const tripoint *const source_

const auto create_activity = [&]() {
if( source_veh != nullptr ) {
g->u.assign_activity( activity_id( "ACT_FILL_LIQUID" ) );
g->u.assign_activity( ACT_FILL_LIQUID );
serialize_liquid_source( g->u.activity, *source_veh, part_num, liquid );
return true;
} else if( source_pos != nullptr ) {
g->u.assign_activity( activity_id( "ACT_FILL_LIQUID" ) );
g->u.assign_activity( ACT_FILL_LIQUID );
serialize_liquid_source( g->u.activity, *source_pos, liquid );
return true;
} else if( source_mon != nullptr ) {
Expand Down
2 changes: 1 addition & 1 deletion src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5649,7 +5649,7 @@ void iexamine::workbench_internal( player &p, const tripoint &examp,
pgettext( "in progress craft", "You start working on the %s." ),
pgettext( "in progress craft", "<npcname> starts working on the %s." ),
selected_craft->tname() );
p.assign_activity( activity_id( "ACT_CRAFT" ) );
p.assign_activity( ACT_CRAFT );
p.activity.targets.push_back( crafts[amenu2.ret] );
p.activity.values.push_back( 0 ); // Not a long craft
break;
Expand Down
2 changes: 1 addition & 1 deletion src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ int place_monster_iuse::use( player &p, item &it, bool, const tripoint & ) const
newmon.friendly = -1;
}
// TODO: add a flag instead of monster id or something?
if( newmon.type->id == mtype_id( "mon_laserturret" ) && !g->is_in_sunlight( newmon.pos() ) ) {
if( newmon.type->id == mon_laserturret && !g->is_in_sunlight( newmon.pos() ) ) {
p.add_msg_if_player( _( "A flashing LED on the laser turret appears to indicate low light." ) );
}
return 1;
Expand Down
3 changes: 2 additions & 1 deletion src/monstergenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "pathfinding.h"
#include "units.h"
#include "translations.h"
#include "cata_string_consts.h"

namespace io
{
Expand Down Expand Up @@ -1100,7 +1101,7 @@ void mtype::remove_special_attacks( const JsonObject &jo, const std::string &mem
void MonsterGenerator::check_monster_definitions() const
{
for( const auto &mon : mon_templates->get_all() ) {
if( mon.harvest == "null" && !mon.has_flag( MF_ELECTRONIC ) && mon.id != mtype_id( "mon_null" ) ) {
if( mon.harvest == "null" && !mon.has_flag( MF_ELECTRONIC ) && mon.id != mon_null ) {
debugmsg( "monster %s has no harvest entry", mon.id.c_str(), mon.harvest.c_str() );
}
for( auto &spec : mon.species ) {
Expand Down
2 changes: 1 addition & 1 deletion src/mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void Character::activate_mutation( const trait_id &mut )
invoke_item( &burrowing_item );
return; // handled when the activity finishes
} else if( mut == trait_SLIMESPAWNER ) {
monster *const slime = g->place_critter_around( mtype_id( "mon_player_blob" ), pos(), 1 );
monster *const slime = g->place_critter_around( mon_player_blob, pos(), 1 );
if( !slime ) {
// Oops, no room to divide!
add_msg_if_player( m_bad, _( "You focus, but are too hemmed in to birth a new slimespring!" ) );
Expand Down
2 changes: 1 addition & 1 deletion src/overmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ void overmap::move_hordes()
auto &type = *( this_monster.type );
if(
!type.species.count( ZOMBIE ) || // Only add zombies to hordes.
type.id == mtype_id( "mon_jabberwock" ) || // Jabberwockies are an exception.
type.id == mon_jabberwock || // Jabberwockies are an exception.
this_monster.get_speed() <= 30 || // So are very slow zombies, like crawling zombies.
this_monster.has_effect( effect_pet ) || // "Zombie pet" zlaves are, too.
!this_monster.will_join_horde( INT_MAX ) || // So are zombies who won't join a horde of any size.
Expand Down
48 changes: 24 additions & 24 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3173,25 +3173,25 @@ bool player::unwield()

// ids of martial art styles that are available with the bio_cqb bionic.
static const std::vector<matype_id> bio_cqb_styles{ {
matype_id{ "style_aikido" },
matype_id{ "style_biojutsu" },
matype_id{ "style_boxing" },
matype_id{ "style_capoeira" },
matype_id{ "style_crane" },
matype_id{ "style_dragon" },
matype_id{ "style_judo" },
matype_id{ "style_karate" },
matype_id{ "style_krav_maga" },
matype_id{ "style_leopard" },
matype_id{ "style_muay_thai" },
matype_id{ "style_ninjutsu" },
matype_id{ "style_pankration" },
matype_id{ "style_snake" },
matype_id{ "style_taekwondo" },
matype_id{ "style_tai_chi" },
matype_id{ "style_tiger" },
matype_id{ "style_wingchun" },
matype_id{ "style_zui_quan" }
style_aikido,
style_biojutsu,
style_boxing,
style_capoeira,
style_crane,
style_dragon,
style_judo,
style_karate,
style_krav_maga,
style_leopard,
style_muay_thai,
style_ninjutsu,
style_pankration,
style_snake,
style_taekwondo,
style_tai_chi,
style_tiger,
style_wingchun,
style_zui_quan
}};

bool character_martial_arts::pick_style( const avatar &you ) // Style selection menu
Expand Down Expand Up @@ -3427,7 +3427,7 @@ void player::mend_item( item_location &&obj, bool interactive )
}

const mending_method &method = opt.method;
assign_activity( activity_id( "ACT_MEND_ITEM" ), to_moves<int>( method.time ) );
assign_activity( ACT_MEND_ITEM, to_moves<int>( method.time ) );
activity.name = opt.fault.str();
activity.str_values.emplace_back( method.id );
activity.targets.push_back( std::move( obj ) );
Expand Down Expand Up @@ -3728,7 +3728,7 @@ bool player::unload( item &it )
} );

if( target->is_magazine() ) {
player_activity unload_mag_act( activity_id( "ACT_UNLOAD_MAG" ) );
player_activity unload_mag_act( ACT_UNLOAD_MAG );
assign_activity( unload_mag_act );
activity.targets.emplace_back( item_location( *this, target ) );

Expand Down Expand Up @@ -4161,7 +4161,7 @@ void player::gunmod_add( item &gun, item &mod )

const int moves = !has_trait( trait_DEBUG_HS ) ? mod.type->gunmod->install_time : 0;

assign_activity( activity_id( "ACT_GUNMOD_ADD" ), moves, -1, get_item_position( &gun ), tool );
assign_activity( ACT_GUNMOD_ADD, moves, -1, get_item_position( &gun ), tool );
activity.values.push_back( get_item_position( &mod ) );
activity.values.push_back( roll ); // chance of success (%)
activity.values.push_back( risk ); // chance of damage (%)
Expand All @@ -4186,7 +4186,7 @@ void player::toolmod_add( item_location tool, item_location mod )
return; // player canceled installation
}

assign_activity( activity_id( "ACT_TOOLMOD_ADD" ), 1, -1 );
assign_activity( ACT_TOOLMOD_ADD, 1, -1 );
activity.targets.emplace_back( std::move( tool ) );
activity.targets.emplace_back( std::move( mod ) );
}
Expand Down Expand Up @@ -4445,7 +4445,7 @@ void player::try_to_sleep( const time_duration &dur )
add_msg_if_player( m_bad, _( "Your soporific inducer doesn't have enough power to operate." ) );
}
}
assign_activity( activity_id( "ACT_TRY_SLEEP" ), to_moves<int>( dur ) );
assign_activity( ACT_TRY_SLEEP, to_moves<int>( dur ) );
}

int player::sleep_spot( const tripoint &p ) const
Expand Down
10 changes: 5 additions & 5 deletions src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void Character::load( const JsonObject &data )
matype_id temp_selected_style;
data.read( "style_selected", temp_selected_style );
if( !temp_selected_style.is_valid() ) {
temp_selected_style = matype_id( "style_none" );
temp_selected_style = style_none;
}
martial_arts_data = character_martial_arts( temp_styles, temp_selected_style,
temp_keep_hands_free );
Expand Down Expand Up @@ -481,8 +481,8 @@ void Character::load( const JsonObject &data )
backlog.push_front( temp );
}
if( !backlog.empty() && !backlog.front().str_values.empty() && ( ( activity &&
activity.id() == activity_id( "ACT_FETCH_REQUIRED" ) ) || ( destination_activity &&
destination_activity.id() == activity_id( "ACT_FETCH_REQUIRED" ) ) ) ) {
activity.id() == ACT_FETCH_REQUIRED ) || ( destination_activity &&
destination_activity.id() == ACT_FETCH_REQUIRED ) ) ) {
requirement_data fetch_reqs;
data.read( "fetch_data", fetch_reqs );
const requirement_id req_id( backlog.front().str_values.back() );
Expand Down Expand Up @@ -718,8 +718,8 @@ void Character::store( JsonOut &json ) const

// handling for storing activity requirements
if( !backlog.empty() && !backlog.front().str_values.empty() && ( ( activity &&
activity.id() == activity_id( "ACT_FETCH_REQUIRED" ) ) || ( destination_activity &&
destination_activity.id() == activity_id( "ACT_FETCH_REQUIRED" ) ) ) ) {
activity.id() == ACT_FETCH_REQUIRED ) || ( destination_activity &&
destination_activity.id() == ACT_FETCH_REQUIRED ) ) ) {
requirement_data things_to_fetch = requirement_id( backlog.front().str_values.back() ).obj();
json.member( "fetch_data", things_to_fetch );
}
Expand Down
83 changes: 42 additions & 41 deletions src/savegame_legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "type_id.h"
#include "flat_set.h"
#include "point.h"
#include "cata_string_consts.h"

namespace std
{
Expand Down Expand Up @@ -197,49 +198,49 @@ void player_activity::deserialize_legacy_type( int legacy_type, activity_id &des
{
static const std::vector< activity_id > legacy_map = {
activity_id::NULL_ID(),
activity_id( "ACT_RELOAD" ),
activity_id( "ACT_READ" ),
activity_id( "ACT_GAME" ),
activity_id( "ACT_WAIT" ),
activity_id( "ACT_CRAFT" ),
ACT_RELOAD,
ACT_READ,
ACT_GAME,
ACT_WAIT,
ACT_CRAFT,
activity_id::NULL_ID(), // ACT_LONGCRAFT is deprecated
activity_id( "ACT_DISASSEMBLE" ),
activity_id( "ACT_BUTCHER" ),
activity_id( "ACT_LONGSALVAGE" ),
activity_id( "ACT_FORAGE" ),
activity_id( "ACT_BUILD" ),
activity_id( "ACT_VEHICLE" ),
ACT_DISASSEMBLE,
ACT_BUTCHER,
ACT_LONGSALVAGE,
ACT_FORAGE,
ACT_BUILD,
ACT_VEHICLE,
activity_id::NULL_ID(), // ACT_REFILL_VEHICLE is deprecated
activity_id( "ACT_TRAIN" ),
activity_id( "ACT_WAIT_WEATHER" ),
activity_id( "ACT_FIRSTAID" ),
activity_id( "ACT_FISH" ),
activity_id( "ACT_PICKAXE" ),
activity_id( "ACT_BURROW" ),
activity_id( "ACT_PULP" ),
activity_id( "ACT_VIBE" ),
activity_id( "ACT_MAKE_ZLAVE" ),
activity_id( "ACT_DROP" ),
activity_id( "ACT_STASH" ),
activity_id( "ACT_PICKUP" ),
activity_id( "ACT_MOVE_ITEMS" ),
activity_id( "ACT_ADV_INVENTORY" ),
activity_id( "ACT_ARMOR_LAYERS" ),
activity_id( "ACT_START_FIRE" ),
activity_id( "ACT_OPEN_GATE" ),
activity_id( "ACT_FILL_LIQUID" ),
activity_id( "ACT_HOTWIRE_CAR" ),
activity_id( "ACT_AIM" ),
activity_id( "ACT_ATM" ),
activity_id( "ACT_START_ENGINES" ),
activity_id( "ACT_OXYTORCH" ),
activity_id( "ACT_CRACKING" ),
activity_id( "ACT_REPAIR_ITEM" ),
activity_id( "ACT_MEND_ITEM" ),
activity_id( "ACT_GUNMOD_ADD" ),
activity_id( "ACT_WAIT_NPC" ),
activity_id( "ACT_CLEAR_RUBBLE" ),
activity_id( "ACT_MEDITATE" ),
ACT_TRAIN,
ACT_WAIT_WEATHER,
ACT_FIRSTAID,
ACT_FISH,
ACT_PICKAXE,
ACT_BURROW,
ACT_PULP,
ACT_VIBE,
ACT_MAKE_ZLAVE,
ACT_DROP,
ACT_STASH,
ACT_PICKUP,
ACT_MOVE_ITEMS,
ACT_ADV_INVENTORY,
ACT_ARMOR_LAYERS,
ACT_START_FIRE,
ACT_OPEN_GATE,
ACT_FILL_LIQUID,
ACT_HOTWIRE_CAR,
ACT_AIM,
ACT_ATM,
ACT_START_ENGINES,
ACT_OXYTORCH,
ACT_CRACKING,
ACT_REPAIR_ITEM,
ACT_MEND_ITEM,
ACT_GUNMOD_ADD,
ACT_WAIT_NPC,
ACT_CLEAR_RUBBLE,
ACT_MEDITATE,
activity_id::NULL_ID() // NUM_ACTIVITIES
};

Expand Down

0 comments on commit 571efb2

Please sign in to comment.