Skip to content

Commit

Permalink
style(autofix.ci): automated formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Oct 21, 2024
1 parent eef972f commit f6a8d83
Show file tree
Hide file tree
Showing 20 changed files with 452 additions and 437 deletions.
26 changes: 14 additions & 12 deletions src/ballistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,33 @@ struct projectile_attack_aim {
/**
* Evaluates dispersion sources, range, and target to determine attack trajectory.
**/
struct projectile_attack_aim projectile_attack_roll( const dispersion_sources &dispersion, double range,
struct projectile_attack_aim projectile_attack_roll( const dispersion_sources &dispersion,
double range,
double target_size );

/**
* Fires a projectile at the target point from the source point with total_dispersion
* dispersion.
* Returns the rolled dispersion of the shot and the actually hit point.
*/
struct dealt_projectile_attack projectile_attack( const struct projectile &proj_arg, const tripoint &source,
struct dealt_projectile_attack projectile_attack( const struct projectile &proj_arg,
const tripoint &source,
const tripoint &target_arg, const dispersion_sources &dispersion,
Creature *origin = nullptr, item *source_weapon = nullptr, const vehicle *in_veh = nullptr );

namespace ranged;
{

/**
* The chance that a fired shot reaches required accuracy - by default grazing shot.
*
* @param dispersion accuracy of the shot. Must be a purely normal distribution.
* @param range distance between the shooter and the target.
* @param target_size size of the target, in the range (0, 1].
* @param missed_by maximum degree of miss, in the range (0, 1]. Effectively a multiplier on @param target_size.
*/
double hit_chance( const dispersion_sources &dispersion, double range, double target_size,
double missed_by = 1.0 );
/**
* The chance that a fired shot reaches required accuracy - by default grazing shot.
*
* @param dispersion accuracy of the shot. Must be a purely normal distribution.
* @param range distance between the shooter and the target.
* @param target_size size of the target, in the range (0, 1].
* @param missed_by maximum degree of miss, in the range (0, 1]. Effectively a multiplier on @param target_size.
*/
double hit_chance( const dispersion_sources & dispersion, double range, double target_size,
double missed_by = 1.0 );

} // namespace ranged

Expand Down
3 changes: 2 additions & 1 deletion src/cached_item_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#ifndef CATA_SRC_CACHED_ITEM_OPTIONS_H
#define CATA_SRC_CACHED_ITEM_OPTIONS_H

enum class merge_comestible_t; {
enum class merge_comestible_t;
{
merge_legacy,
merge_liquid,
merge_all,
Expand Down
3 changes: 2 additions & 1 deletion src/cached_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ struct FungalOptions {

extern struct FungalOptions fungal_opt;

enum class error_log_format_t; {
enum class error_log_format_t;
{

Check failure on line 129 in src/cached_options.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Curses

expected unqualified-id before ‘{’ token

Check failure on line 129 in src/cached_options.h

View workflow job for this annotation

GitHub Actions / Build

'{': missing function header (old-style formal list?) (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\action.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 129 in src/cached_options.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected unqualified-id before ‘{’ token

Check failure on line 129 in src/cached_options.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected unqualified-id before ‘{’ token

Check failure on line 129 in src/cached_options.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua

expected unqualified-id before ‘{’ token
human_readable,
// Output error messages in github action command format (currently json only)
// See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
Expand Down
52 changes: 25 additions & 27 deletions src/cata_unreachable.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,34 @@
namespace cata;
{

/**
* @brief Marks unreachable code.
*
* Utility function to mark unreachable code to help compiler with optimizations.
*
* Usage:
* void ( bool always_true )
* {
* if ( always_true ) {
* return;
* } else {
* // If always_true happens to be false, this will cause Undefined Behavior.
* cata::unreachable();
* }
* }
*
* Source: https://stackoverflow.com/a/65258501
*/
/**
* @brief Marks unreachable code.
*
* Utility function to mark unreachable code to help compiler with optimizations.
*
* Usage:
* void ( bool always_true )
* {
* if ( always_true ) {
* return;
* } else {
* // If always_true happens to be false, this will cause Undefined Behavior.
* cata::unreachable();
* }
* }
*
* Source: https://stackoverflow.com/a/65258501
*/
#ifdef __GNUC__ // GCC 4.8+, Clang, Intel and other compilers compatible with GCC (-std=c++0x or above)
[[noreturn]] inline __attribute__( ( always_inline ) ) void unreachable()
{
__builtin_unreachable();
}
[[noreturn]] inline __attribute__( ( always_inline ) ) void unreachable() {
__builtin_unreachable();
}
#elif defined(_MSC_VER) // MSVC
[[noreturn]] __forceinline void unreachable()
{
__assume( false );
}
[[noreturn]] __forceinline void unreachable() {
__assume( false );
}
#else // ???
inline void unreachable() {}
inline void unreachable() {}
#endif

} // namespace cata
Expand Down
2 changes: 1 addition & 1 deletion src/catalua_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace cata;
{

void show_lua_console_impl();
void show_lua_console_impl();

} // namespace cata

Expand Down
53 changes: 29 additions & 24 deletions src/character_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,48 @@
class Character;

struct stat_mod {
int strength; = 0;
int dexterity; = 0;
int intelligence; = 0;
int perception; = 0;

int speed; = 0;
int strength;
= 0;
int dexterity;
= 0;
int intelligence;
= 0;
int perception;
= 0;

int speed;
= 0;
};

namespace character_effects;
{

/** Returns the effect of pain on stats */
stat_mod get_pain_penalty( const Character &ch );
/** Returns the effect of pain on stats */
stat_mod get_pain_penalty( const Character & ch );

/** Returns the penalty to speed from starvation */
int get_kcal_speed_penalty( float kcal_percent );
/** Returns the penalty to speed from starvation */
int get_kcal_speed_penalty( float kcal_percent );

/** Returns the penalty to speed from thirst */
int get_thirst_speed_penalty( int thirst );
/** Returns the penalty to speed from thirst */
int get_thirst_speed_penalty( int thirst );

/** Calculates character's morale cap due to fatigue */
int calc_morale_fatigue_cap( int fatigue );
/** Calculates character's morale cap due to fatigue */
int calc_morale_fatigue_cap( int fatigue );

/** Returns the modifier value used for vomiting effects */
double vomit_mod( const Character &ch );
/** Returns the modifier value used for vomiting effects */
double vomit_mod( const Character & ch );

/** Returns a value used when attempting to convince NPC's of something */
int talk_skill( const Character &ch );
/** Returns a value used when attempting to convince NPC's of something */
int talk_skill( const Character & ch );

/** Returns a value used when attempting to intimidate NPC's */
int intimidation( const Character &ch );
/** Returns a value used when attempting to intimidate NPC's */
int intimidation( const Character & ch );

/** Uses morale, pain and fatigue to return the player's focus target goto value */
int calc_focus_equilibrium( const Character &who );
/** Uses morale, pain and fatigue to return the player's focus target goto value */
int calc_focus_equilibrium( const Character & who );

/** Calculates actual focus gain/loss value from focus equilibrium*/
int calc_focus_change( const Character &who );
/** Calculates actual focus gain/loss value from focus equilibrium*/
int calc_focus_change( const Character & who );

} // namespace character_effects

Expand Down
16 changes: 8 additions & 8 deletions src/character_turn.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ struct w_point;
namespace character_funcs;
{

/** Maintains body wetness and handles the rate at which the player dries */
void update_body_wetness( Character &who, const w_point &weather );
/** Maintains body wetness and handles the rate at which the player dries */
void update_body_wetness( Character & who, const w_point & weather );

/** Do pause action ('.' key). */
void do_pause( Character &who );
/** Do pause action ('.' key). */
void do_pause( Character & who );

/** Search surrounding squares for traps (and maybe other things in the future). */
void search_surroundings( Character &who );
/** Search surrounding squares for traps (and maybe other things in the future). */
void search_surroundings( Character & who );

/** Uses calc_focus_change to update the player's current focus */
void update_mental_focus( Character &who );
/** Uses calc_focus_change to update the player's current focus */
void update_mental_focus( Character & who );

} // namespace character_funcs

Expand Down
28 changes: 14 additions & 14 deletions src/fungal_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ class Creature;

class fungal_effects;
{
private:
// Dependency injection to try to be less global
game &gm;
map &m;
public:
fungal_effects( game &g, map &mp );
fungal_effects( const fungal_effects & ) = delete;
fungal_effects( fungal_effects && ) = delete;
private:
// Dependency injection to try to be less global
game &gm;
map &m;
public:
fungal_effects( game & g, map & mp );
fungal_effects( const fungal_effects & ) = delete;
fungal_effects( fungal_effects && ) = delete;

void marlossify( const tripoint &p );
/** Makes spores at p. source is used for kill counting */
void create_spores( const tripoint &p, Creature *origin = nullptr );
void fungalize( const tripoint &p, Creature *origin = nullptr, double spore_chance = 0.0 );
void marlossify( const tripoint & p );
/** Makes spores at p. source is used for kill counting */
void create_spores( const tripoint & p, Creature *origin = nullptr );
void fungalize( const tripoint & p, Creature *origin = nullptr, double spore_chance = 0.0 );

void spread_fungus( const tripoint &p );
void spread_fungus_one_tile( const tripoint &p, int growth );
void spread_fungus( const tripoint & p );
void spread_fungus_one_tile( const tripoint & p, int growth );
};

#endif // CATA_SRC_FUNGAL_EFFECTS_H
2 changes: 1 addition & 1 deletion src/game_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace game_ui;
{
void init_ui();
void init_ui();
} // namespace game_ui

// defined in sdltiles.cpp
Expand Down
20 changes: 10 additions & 10 deletions src/ime.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ void disable_ime();
*/
class ime_sentry;
{
public:
enum mode {
enable = 0,
disable = 1,
keep = 2,
};
public:
enum mode {
enable = 0,
disable = 1,
keep = 2,
};

ime_sentry( mode m = enable );
~ime_sentry();
private:
bool previously_enabled;
ime_sentry( mode m = enable );
~ime_sentry();
private:
bool previously_enabled;
};

#endif // CATA_SRC_IME_H
36 changes: 18 additions & 18 deletions src/io_tags.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
namespace io;

Check failure on line 5 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / Build

syntax error: ';' (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\active_item_cache.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 5 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / Build

syntax error: ';' (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\active_tile_data.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 5 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / Build

syntax error: ';' (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\action.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 5 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected ‘{’ before ‘;’ token

Check failure on line 5 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected ‘{’ before ‘;’ token
{

Check failure on line 6 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / Build

'{': missing function header (old-style formal list?) (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\active_item_cache.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 6 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / Build

'{': missing function header (old-style formal list?) (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\active_tile_data.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 6 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / Build

'{': missing function header (old-style formal list?) (compiling source file D:\a\Cataclysm-BN\Cataclysm-BN\src\action.cpp) [D:\a\Cataclysm-BN\Cataclysm-BN\out\build\windows-tiles-sounds-x64-msvc\src\cataclysm-bn-tiles-common.vcxproj]

Check failure on line 6 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected unqualified-id before ‘{’ token

Check failure on line 6 in src/io_tags.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

expected unqualified-id before ‘{’ token

class JsonArrayInputArchive;
class JsonArrayOutputArchive;
class JsonObjectInputArchive;
class JsonObjectOutputArchive;
class JsonArrayInputArchive;
class JsonArrayOutputArchive;
class JsonObjectInputArchive;
class JsonObjectOutputArchive;

/**
* Tag that indicates the class is stored in a JSON array.
*/
struct array_archive_tag {
using InputArchive = JsonArrayInputArchive;
using OutputArchive = JsonArrayOutputArchive;
};
/**
* Tag that indicates the class is stored in a JSON array.
*/
struct array_archive_tag {
using InputArchive = JsonArrayInputArchive;
using OutputArchive = JsonArrayOutputArchive;
};

/**
* Tag that indicates the class is stored in a JSON object.
*/
struct object_archive_tag {
using InputArchive = JsonObjectInputArchive;
using OutputArchive = JsonObjectOutputArchive;
};
/**
* Tag that indicates the class is stored in a JSON object.
*/
struct object_archive_tag {
using InputArchive = JsonObjectInputArchive;
using OutputArchive = JsonObjectOutputArchive;
};

} // namespace io

Expand Down
14 changes: 7 additions & 7 deletions src/iuse_software_snake.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

namespace catacurses;
{
class window;
class window;
} // namespace catacurses

class snake_game;
{
public:
snake_game();
void print_score( const catacurses::window &w_snake, int iScore );
void print_header( const catacurses::window &w_snake, bool show_shortcut = true );
void snake_over( const catacurses::window &w_snake, int iScore );
int start_game();
public:
snake_game();
void print_score( const catacurses::window & w_snake, int iScore );
void print_header( const catacurses::window & w_snake, bool show_shortcut = true );
void snake_over( const catacurses::window & w_snake, int iScore );
int start_game();
};

#endif // CATA_SRC_IUSE_SOFTWARE_SNAKE_H
Loading

0 comments on commit f6a8d83

Please sign in to comment.