Skip to content

Commit

Permalink
fix ids to appease clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Fris0uman committed Jun 3, 2024
1 parent 7c4e71e commit 9ace449
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 172 deletions.
70 changes: 35 additions & 35 deletions src/ballistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@
#include "units.h"
#include "vpart_position.h"

static const ammo_effect_str_id ammo_effect_id_ACT_ON_RANGED_HIT( "ACT_ON_RANGED_HIT" );
static const ammo_effect_str_id ammo_effect_id_BOUNCE( "BOUNCE" );
static const ammo_effect_str_id ammo_effect_id_BURST( "BURST" );
static const ammo_effect_str_id ammo_effect_id_DRAW_AS_LINE( "DRAW_AS_LINE" );
static const ammo_effect_str_id ammo_effect_id_HEAVY_HIT( "HEAVY_HIT" );
static const ammo_effect_str_id ammo_effect_id_JET( "JET" );
static const ammo_effect_str_id ammo_effect_id_MUZZLE_SMOKE( "MUZZLE_SMOKE" );
static const ammo_effect_str_id ammo_effect_id_NO_EMBED( "NO_EMBED" );
static const ammo_effect_str_id ammo_effect_id_NO_ITEM_DAMAGE( "NO_ITEM_DAMAGE" );
static const ammo_effect_str_id ammo_effect_id_NO_OVERSHOOT( "NO_OVERSHOOT" );
static const ammo_effect_str_id ammo_effect_id_NO_PENETRATE_OBSTACLES( "NO_PENETRATE_OBSTACLES" );
static const ammo_effect_str_id ammo_effect_id_NULL_SOURCE( "NULL_SOURCE" );
static const ammo_effect_str_id ammo_effect_id_SHATTER_SELF( "SHATTER_SELF" );
static const ammo_effect_str_id ammo_effect_id_STREAM( "STREAM" );
static const ammo_effect_str_id ammo_effect_id_STREAM_BIG( "STREAM_BIG" );
static const ammo_effect_str_id ammo_effect_id_STREAM_TINY( "STREAM_TINY" );
static const ammo_effect_str_id ammo_effect_id_TANGLE( "TANGLE" );
static const ammo_effect_str_id ammo_effect_ACT_ON_RANGED_HIT( "ACT_ON_RANGED_HIT" );
static const ammo_effect_str_id ammo_effect_BOUNCE( "BOUNCE" );
static const ammo_effect_str_id ammo_effect_BURST( "BURST" );
static const ammo_effect_str_id ammo_effect_DRAW_AS_LINE( "DRAW_AS_LINE" );
static const ammo_effect_str_id ammo_effect_HEAVY_HIT( "HEAVY_HIT" );
static const ammo_effect_str_id ammo_effect_JET( "JET" );
static const ammo_effect_str_id ammo_effect_MUZZLE_SMOKE( "MUZZLE_SMOKE" );
static const ammo_effect_str_id ammo_effect_NO_EMBED( "NO_EMBED" );
static const ammo_effect_str_id ammo_effect_NO_ITEM_DAMAGE( "NO_ITEM_DAMAGE" );
static const ammo_effect_str_id ammo_effect_NO_OVERSHOOT( "NO_OVERSHOOT" );
static const ammo_effect_str_id ammo_effect_NO_PENETRATE_OBSTACLES( "NO_PENETRATE_OBSTACLES" );
static const ammo_effect_str_id ammo_effect_NULL_SOURCE( "NULL_SOURCE" );
static const ammo_effect_str_id ammo_effect_SHATTER_SELF( "SHATTER_SELF" );
static const ammo_effect_str_id ammo_effect_STREAM( "STREAM" );
static const ammo_effect_str_id ammo_effect_STREAM_BIG( "STREAM_BIG" );
static const ammo_effect_str_id ammo_effect_STREAM_TINY( "STREAM_TINY" );
static const ammo_effect_str_id ammo_effect_TANGLE( "TANGLE" );

static const efftype_id effect_bounced( "bounced" );

Expand All @@ -73,7 +73,7 @@ static void drop_or_embed_projectile( const dealt_projectile_attack &attack )

const tripoint &pt = attack.end_point;

if( effects.count( ammo_effect_id_SHATTER_SELF ) ) {
if( effects.count( ammo_effect_SHATTER_SELF ) ) {
// Drop the contents, not the thrown item
add_msg_if_player_sees( pt, _( "The %s shatters!" ), drop_item.tname() );

Expand Down Expand Up @@ -102,7 +102,7 @@ static void drop_or_embed_projectile( const dealt_projectile_attack &attack )
return;
}

if( effects.count( ammo_effect_id_BURST ) ) {
if( effects.count( ammo_effect_BURST ) ) {
// Drop the contents, not the thrown item
add_msg_if_player_sees( pt, _( "The %s bursts!" ), drop_item.tname() );

Expand All @@ -121,8 +121,8 @@ static void drop_or_embed_projectile( const dealt_projectile_attack &attack )
// We can only embed in monsters
bool mon_there = mon != nullptr && !mon->is_dead_state();
// And if we actually want to embed
bool embed = mon_there && effects.count( ammo_effect_id_NO_EMBED ) == 0 &&
effects.count( ammo_effect_id_TANGLE ) == 0;
bool embed = mon_there && effects.count( ammo_effect_NO_EMBED ) == 0 &&
effects.count( ammo_effect_TANGLE ) == 0;
// Don't embed in small creatures
if( embed ) {
const creature_size critter_size = mon->get_size();
Expand Down Expand Up @@ -150,10 +150,10 @@ static void drop_or_embed_projectile( const dealt_projectile_attack &attack )
// if they aren't friendly they will try and break out of the net/bolas/lasso
// players and NPCs just get the downed effect, and item is dropped.
// TODO: storing the item on player until they recover from downed
if( effects.count( ammo_effect_id_TANGLE ) && mon_there ) {
if( effects.count( ammo_effect_TANGLE ) && mon_there ) {
do_drop = false;
}
if( effects.count( ammo_effect_id_ACT_ON_RANGED_HIT ) ) {
if( effects.count( ammo_effect_ACT_ON_RANGED_HIT ) ) {
// Don't drop if it exploded
do_drop = !dropped_item.activate_thrown( attack.end_point );
}
Expand All @@ -163,7 +163,7 @@ static void drop_or_embed_projectile( const dealt_projectile_attack &attack )
here.add_item_or_charges( attack.end_point, dropped_item );
}

if( effects.count( ammo_effect_id_HEAVY_HIT ) ) {
if( effects.count( ammo_effect_HEAVY_HIT ) ) {
if( here.has_flag( ter_furn_flag::TFLAG_LIQUID, pt ) ) {
sounds::sound( pt, 10, sounds::sound_t::combat, _( "splash!" ), false, "bullet_hit", "hit_water" );
} else {
Expand Down Expand Up @@ -258,21 +258,21 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, const tri
projectile &proj = attack.proj;
const auto &proj_effects = proj.proj_effects;

const bool stream = proj_effects.count( ammo_effect_id_STREAM ) > 0 ||
proj_effects.count( ammo_effect_id_STREAM_TINY ) > 0 ||
proj_effects.count( ammo_effect_id_STREAM_BIG ) > 0 ||
proj_effects.count( ammo_effect_id_JET ) > 0;
const bool stream = proj_effects.count( ammo_effect_STREAM ) > 0 ||
proj_effects.count( ammo_effect_STREAM_TINY ) > 0 ||
proj_effects.count( ammo_effect_STREAM_BIG ) > 0 ||
proj_effects.count( ammo_effect_JET ) > 0;
const char bullet = stream ? '#' : '*';
const bool no_item_damage = proj_effects.count( ammo_effect_id_NO_ITEM_DAMAGE ) > 0;
const bool do_draw_line = proj_effects.count( ammo_effect_id_DRAW_AS_LINE ) > 0;
const bool null_source = proj_effects.count( ammo_effect_id_NULL_SOURCE ) > 0;
const bool no_item_damage = proj_effects.count( ammo_effect_NO_ITEM_DAMAGE ) > 0;
const bool do_draw_line = proj_effects.count( ammo_effect_DRAW_AS_LINE ) > 0;
const bool null_source = proj_effects.count( ammo_effect_NULL_SOURCE ) > 0;
// Determines whether it can penetrate obstacles
const bool is_bullet = proj_arg.speed >= 200 &&
!proj_effects.count( ammo_effect_id_NO_PENETRATE_OBSTACLES );
!proj_effects.count( ammo_effect_NO_PENETRATE_OBSTACLES );

// If we were targeting a tile rather than a monster, don't overshoot
// Unless the target was a wall, then we are aiming high enough to overshoot
const bool no_overshoot = proj_effects.count( ammo_effect_id_NO_OVERSHOOT ) ||
const bool no_overshoot = proj_effects.count( ammo_effect_NO_OVERSHOOT ) ||
( creatures.creature_at( target_arg ) == nullptr && here.passable( target_arg ) );

double extend_to_range = no_overshoot ? range : proj_arg.range;
Expand Down Expand Up @@ -333,7 +333,7 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, const tri
trajectory.insert( trajectory.begin(), source );

static emit_id muzzle_smoke( "emit_smaller_smoke_plume" );
if( proj_effects.count( ammo_effect_id_MUZZLE_SMOKE ) ) {
if( proj_effects.count( ammo_effect_MUZZLE_SMOKE ) ) {
here.emit_field( trajectory.front(), muzzle_smoke );
}

Expand Down Expand Up @@ -518,7 +518,7 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, const tri
}

// TODO: Move this outside now that we have hit point in return values?
if( proj.proj_effects.count( ammo_effect_id_BOUNCE ) ) {
if( proj.proj_effects.count( ammo_effect_BOUNCE ) ) {
// Add effect so the shooter is not targeted itself.
if( origin && !origin->has_effect( effect_bounced ) ) {
origin->add_effect( effect_bounced, 1_turns );
Expand Down
10 changes: 5 additions & 5 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ static const trait_id trait_PROF_MED( "PROF_MED" );
static const trait_id trait_PYROMANIA( "PYROMANIA" );
static const trait_id trait_THRESH_MEDICAL( "THRESH_MEDICAL" );

static const ammo_effect_str_id ammo_effect_id_DRAW_AS_LINE( "DRAW_AS_LINE" );
static const ammo_effect_str_id ammo_effect_id_JET( "JET" );
static const ammo_effect_str_id ammo_effect_id_NO_DAMAGE_SCALING( "NO_DAMAGE_SCALING" );
static const ammo_effect_str_id ammo_effect_id_NO_ITEM_DAMAGE( "NO_ITEM_DAMAGE" );
static const ammo_effect_str_id ammo_effect_DRAW_AS_LINE( "DRAW_AS_LINE" );
static const ammo_effect_str_id ammo_effect_JET( "JET" );
static const ammo_effect_str_id ammo_effect_NO_DAMAGE_SCALING( "NO_DAMAGE_SCALING" );
static const ammo_effect_str_id ammo_effect_NO_ITEM_DAMAGE( "NO_ITEM_DAMAGE" );

struct Character::bionic_fuels {
std::vector<vehicle *> connected_vehicles;
Expand Down Expand Up @@ -1021,7 +1021,7 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics
proj.impact.add_damage( STATIC( damage_type_id( "bash" ) ), pr.first.weight() / 250_gram );
// make the projectile stop one tile short to prevent hitting the player
proj.range = rl_dist( pr.second, pos() ) - 1;
proj.proj_effects = {{ ammo_effect_id_NO_ITEM_DAMAGE, ammo_effect_id_DRAW_AS_LINE, ammo_effect_id_NO_DAMAGE_SCALING, ammo_effect_id_JET }};
proj.proj_effects = {{ ammo_effect_NO_ITEM_DAMAGE, ammo_effect_DRAW_AS_LINE, ammo_effect_NO_DAMAGE_SCALING, ammo_effect_JET }};

dealt_projectile_attack dealt = projectile_attack(
proj, pr.second, pos(), dispersion_sources{ 0 }, this );
Expand Down
58 changes: 29 additions & 29 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@

struct mutation_branch;

static const ammo_effect_str_id ammo_effect_id_APPLY_SAP( "APPLY_SAP" );
static const ammo_effect_str_id ammo_effect_id_BEANBAG( "BEANBAG" );
static const ammo_effect_str_id ammo_effect_id_BLINDS_EYES( "BLINDS_EYES" );
static const ammo_effect_str_id ammo_effect_id_BOUNCE( "BOUNCE" );
static const ammo_effect_str_id ammo_effect_id_FOAMCRETE( "FOAMCRETE" );
static const ammo_effect_str_id ammo_effect_id_LARGE_BEANBAG( "LARGE_BEANBAG" );
static const ammo_effect_str_id ammo_effect_id_MAGIC( "MAGIC" );
static const ammo_effect_str_id ammo_effect_id_NO_DAMAGE_SCALING( "NO_DAMAGE_SCALING" );
static const ammo_effect_str_id ammo_effect_id_NOGIB( "NOGIB" );
static const ammo_effect_str_id ammo_effect_id_PARALYZEPOISON( "PARALYZEPOISON" );
static const ammo_effect_str_id ammo_effect_id_ROBOT_DAZZLE( "ROBOT_DAZZLE" );
static const ammo_effect_str_id ammo_effect_id_TANGLE( "TANGLE" );
static const ammo_effect_str_id ammo_effect_id_IGNITE( "IGNITE" );
static const ammo_effect_str_id ammo_effect_id_INCENDIARY( "INCENDIARY" );
static const ammo_effect_str_id ammo_effect_APPLY_SAP( "APPLY_SAP" );

Check failure on line 80 in src/creature.cpp

View workflow job for this annotation

GitHub Actions / build (src)

string_id declarations should be sorted. [cata-static-string_id-constants,-warnings-as-errors]
static const ammo_effect_str_id ammo_effect_BEANBAG( "BEANBAG" );
static const ammo_effect_str_id ammo_effect_BLINDS_EYES( "BLINDS_EYES" );
static const ammo_effect_str_id ammo_effect_BOUNCE( "BOUNCE" );
static const ammo_effect_str_id ammo_effect_FOAMCRETE( "FOAMCRETE" );
static const ammo_effect_str_id ammo_effect_LARGE_BEANBAG( "LARGE_BEANBAG" );
static const ammo_effect_str_id ammo_effect_MAGIC( "MAGIC" );
static const ammo_effect_str_id ammo_effect_NO_DAMAGE_SCALING( "NO_DAMAGE_SCALING" );
static const ammo_effect_str_id ammo_effect_NOGIB( "NOGIB" );
static const ammo_effect_str_id ammo_effect_PARALYZEPOISON( "PARALYZEPOISON" );
static const ammo_effect_str_id ammo_effect_ROBOT_DAZZLE( "ROBOT_DAZZLE" );
static const ammo_effect_str_id ammo_effect_TANGLE( "TANGLE" );
static const ammo_effect_str_id ammo_effect_IGNITE( "IGNITE" );
static const ammo_effect_str_id ammo_effect_INCENDIARY( "INCENDIARY" );

static const anatomy_id anatomy_human_anatomy( "human_anatomy" );

Expand Down Expand Up @@ -955,7 +955,7 @@ double Creature::accuracy_projectile_attack( dealt_projectile_attack &attack ) c

void projectile::apply_effects_nodamage( Creature &target, Creature *source ) const
{
if( proj_effects.count( ammo_effect_id_BOUNCE ) ) {
if( proj_effects.count( ammo_effect_BOUNCE ) ) {
target.add_effect( effect_source( source ), effect_bounced, 1_turns );
}
}
Expand All @@ -964,7 +964,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
const dealt_damage_instance &dealt_dam, bool critical ) const
{
// Apply ammo effects to target.
if( proj_effects.count( ammo_effect_id_TANGLE ) ) {
if( proj_effects.count( ammo_effect_TANGLE ) ) {
// if its a tameable animal, its a good way to catch them if they are running away, like them ranchers do!
// we assume immediate success, then certain monster types immediately break free in monster.cpp move_effects()
if( target.is_monster() ) {
Expand All @@ -987,7 +987,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
}

Character &player_character = get_player_character();
if( proj_effects.count( ammo_effect_id_INCENDIARY ) ) {
if( proj_effects.count( ammo_effect_INCENDIARY ) ) {
if( x_in_y( 1, 100 ) ) { // 1% chance
if( target.made_of( material_veggy ) || target.made_of_any( Creature::cmat_flammable ) ) {
target.add_effect( effect_source( source ), effect_onfire, rng( 2_turns, 6_turns ),
Expand All @@ -1005,7 +1005,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
player_character.rem_morale( MORALE_PYROMANIA_NOFIRE );
}
}
} else if( proj_effects.count( ammo_effect_id_IGNITE ) ) {
} else if( proj_effects.count( ammo_effect_IGNITE ) ) {
if( x_in_y( 1, 2 ) ) { // 50% chance
if( target.made_of( material_veggy ) || target.made_of_any( Creature::cmat_flammable ) ) {
target.add_effect( effect_source( source ), effect_onfire, 10_turns, dealt_dam.bp_hit );
Expand All @@ -1023,7 +1023,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
}
}

if( proj_effects.count( ammo_effect_id_ROBOT_DAZZLE ) ) {
if( proj_effects.count( ammo_effect_ROBOT_DAZZLE ) ) {
if( critical && target.in_species( species_ROBOT ) ) {
time_duration duration = rng( 6_turns, 8_turns );
target.add_effect( effect_source( source ), effect_stunned, duration );
Expand All @@ -1036,31 +1036,31 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
}

if( dealt_dam.bp_hit->has_type( body_part_type::type::head ) &&
proj_effects.count( ammo_effect_id_BLINDS_EYES ) ) {
proj_effects.count( ammo_effect_BLINDS_EYES ) ) {
// TODO: Change this to require bp_eyes
target.add_env_effect( effect_blind,
target.get_random_body_part_of_type( body_part_type::type::sensor ), 5, rng( 3_turns, 10_turns ) );
}

if( proj_effects.count( ammo_effect_id_APPLY_SAP ) ) {
if( proj_effects.count( ammo_effect_APPLY_SAP ) ) {
target.add_effect( effect_source( source ), effect_sap, 1_turns * dealt_dam.total_damage() );
}
if( proj_effects.count( ammo_effect_id_PARALYZEPOISON ) && dealt_dam.total_damage() > 0 &&
if( proj_effects.count( ammo_effect_PARALYZEPOISON ) && dealt_dam.total_damage() > 0 &&
!dealt_dam.bp_hit->has_flag( json_flag_BIONIC_LIMB ) ) {
target.add_msg_if_player( m_bad, _( "You feel poison coursing through your body!" ) );
target.add_effect( effect_source( source ), effect_paralyzepoison, 5_minutes );
}

if( proj_effects.count( ammo_effect_id_FOAMCRETE ) && effect_foamcrete_slow.is_valid() ) {
if( proj_effects.count( ammo_effect_FOAMCRETE ) && effect_foamcrete_slow.is_valid() ) {
target.add_msg_if_player( m_bad, _( "The foamcrete stiffens around you!" ) );
target.add_effect( effect_source( source ), effect_foamcrete_slow, 5_minutes );
}

int stun_strength = 0;
if( proj_effects.count( ammo_effect_id_BEANBAG ) ) {
if( proj_effects.count( ammo_effect_BEANBAG ) ) {
stun_strength = 4;
}
if( proj_effects.count( ammo_effect_id_LARGE_BEANBAG ) ) {
if( proj_effects.count( ammo_effect_LARGE_BEANBAG ) ) {
stun_strength = 16;
}
if( stun_strength > 0 ) {
Expand Down Expand Up @@ -1104,7 +1104,7 @@ projectile_attack_results Creature::select_body_part_projectile_attack(
const projectile &proj, const double goodhit, const double missed_by ) const
{
projectile_attack_results ret( proj );
const bool magic = proj.proj_effects.count( ammo_effect_id_MAGIC ) > 0;
const bool magic = proj.proj_effects.count( ammo_effect_MAGIC ) > 0;
double hit_value = missed_by + rng_float( -0.5, 0.5 );
if( magic ) {
// Best possible hit
Expand Down Expand Up @@ -1230,7 +1230,7 @@ void Creature::messaging_projectile_attack( const Creature *source,
void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack &attack,
bool print_messages, const weakpoint_attack &wp_attack )
{
const bool magic = attack.proj.proj_effects.count( ammo_effect_id_MAGIC ) > 0;
const bool magic = attack.proj.proj_effects.count( ammo_effect_MAGIC ) > 0;
const double missed_by = attack.missed_by;
if( missed_by >= 1.0 && !magic ) {
// Total miss
Expand Down Expand Up @@ -1297,13 +1297,13 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack

// copy it, since we're mutating.
damage_instance impact = proj.impact;
if( hit_selection.damage_mult > 0.0f && proj_effects.count( ammo_effect_id_NO_DAMAGE_SCALING ) ) {
if( hit_selection.damage_mult > 0.0f && proj_effects.count( ammo_effect_NO_DAMAGE_SCALING ) ) {
hit_selection.damage_mult = 1.0f;
}

impact.mult_damage( hit_selection.damage_mult );

if( proj_effects.count( ammo_effect_id_NOGIB ) > 0 ) {
if( proj_effects.count( ammo_effect_NOGIB ) > 0 ) {
float dmg_ratio = static_cast<float>( impact.total_damage() ) / get_hp_max( hit_selection.bp_hit );
if( dmg_ratio > 1.25f ) {
impact.mult_damage( 1.0f / dmg_ratio );
Expand Down
4 changes: 2 additions & 2 deletions src/explosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#include "vehicle.h"
#include "vpart_position.h"

static const ammo_effect_str_id ammo_effect_id_NULL_SOURCE( "NULL_SOURCE" );
static const ammo_effect_str_id ammo_effect_NULL_SOURCE( "NULL_SOURCE" );

static const damage_type_id damage_bash( "bash" );
static const damage_type_id damage_bullet( "bullet" );
Expand Down Expand Up @@ -398,7 +398,7 @@ static std::vector<tripoint> shrapnel( const Creature *source, const tripoint &s
projectile proj;
proj.speed = fragment_velocity;
proj.range = range;
proj.proj_effects.insert( ammo_effect_id_NULL_SOURCE );
proj.proj_effects.insert( ammo_effect_NULL_SOURCE );

struct local_caches {
cata::mdarray<fragment_cloud, point_bub_ms> obstacle_cache;
Expand Down
Loading

0 comments on commit 9ace449

Please sign in to comment.