From e0c89678a87dd8f63af94141cf9d9ca22e46daa1 Mon Sep 17 00:00:00 2001 From: Barry Gackle Date: Sun, 2 Apr 2017 13:44:11 -0700 Subject: [PATCH] Trivial code corrections 1. Eliminated hanging whitespace from a few places 2. Added a missing comment marking end of anonymous namespace 3. Function lcmatch was used in a couple places by manually declaring the symbol as an extern fuction, rather than including the appropriate header. The parameter names in the header then changed, resulting in this prototype getting out of sync. 4. Fix spelling of symbol: MOONLIGHT_PER_QUARTER 5. Fix symbol names: (*_SOLSTICE -> *_EQUINOX) --- doxygen_doc/pages.h | 6 +++--- src/bionics.cpp | 6 +++--- src/calendar.cpp | 22 +++++++++++----------- src/calendar.h | 2 +- src/crafting_gui.cpp | 4 +--- src/gates.cpp | 2 +- src/newcharacter.cpp | 2 -- 7 files changed, 20 insertions(+), 24 deletions(-) diff --git a/doxygen_doc/pages.h b/doxygen_doc/pages.h index f1f55f0215342..5d710af5bdb0d 100644 --- a/doxygen_doc/pages.h +++ b/doxygen_doc/pages.h @@ -24,15 +24,15 @@ * \ref mapbuffer \ref map \ref submap */ -/*! @page Effects_Stat_Strength +/*! @page Effects_Stat_Strength * @brief Cross referenced effects of the Strength stat. * @par */ -/*! @page Effects_Stat_Dexterity +/*! @page Effects_Stat_Dexterity * @brief Cross referenced effects of the Dexterity stat. * @par */ -/*! @page Effects_Stat_Intelligence +/*! @page Effects_Stat_Intelligence * @brief Cross referenced effects of the Intelligence stat. * @par */ diff --git a/src/bionics.cpp b/src/bionics.cpp index a6c3d3c9587b3..e403d992b508d 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -601,11 +601,11 @@ bool attempt_recharge( player &p, bionic &bio, int &amount, int factor = 1, int const int armor_power_cost = 1; int power_cost = info.power_over_time * factor; bool recharged = false; - + if( power_cost > 0 ) { if( info.armor_interface ) { // Don't spend any power on armor interfacing unless we're wearing active powered armor. - bool powered_armor = std::any_of( p.worn.begin(), p.worn.end(), + bool powered_armor = std::any_of( p.worn.begin(), p.worn.end(), []( const item &w ) { return w.active && w.is_power_armor(); } ); if( !powered_armor ) { power_cost -= armor_power_cost * factor; @@ -619,7 +619,7 @@ bool attempt_recharge( player &p, bionic &bio, int &amount, int factor = 1, int recharged = true; } } - + return recharged; } diff --git a/src/calendar.cpp b/src/calendar.cpp index 05a89ff537023..2246346e7130c 100644 --- a/src/calendar.cpp +++ b/src/calendar.cpp @@ -20,11 +20,11 @@ season_type calendar::initial_season; // Internal constants, not part of the calendar interface. // Times for sunrise, sunset at equinoxes #define SUNRISE_WINTER 7 -#define SUNRISE_SOLSTICE 6 +#define SUNRISE_EQUINOX 6 #define SUNRISE_SUMMER 5 #define SUNSET_WINTER 17 -#define SUNSET_SOLSTICE 19 +#define SUNSET_EQUINOX 19 #define SUNSET_SUMMER 21 // How long, in seconds, does sunrise/sunset last? @@ -190,20 +190,20 @@ calendar calendar::sunrise() const int start_hour = 0, end_hour = 0, newhour = 0, newminute = 0; switch (season) { case SPRING: - start_hour = SUNRISE_SOLSTICE; + start_hour = SUNRISE_EQUINOX; end_hour = SUNRISE_SUMMER; break; case SUMMER: start_hour = SUNRISE_SUMMER; - end_hour = SUNRISE_SOLSTICE; + end_hour = SUNRISE_EQUINOX; break; case AUTUMN: - start_hour = SUNRISE_SOLSTICE; + start_hour = SUNRISE_EQUINOX; end_hour = SUNRISE_WINTER; break; case WINTER: start_hour = SUNRISE_WINTER; - end_hour = SUNRISE_SOLSTICE; + end_hour = SUNRISE_EQUINOX; break; } double percent = double(double(day) / season_length()); @@ -221,20 +221,20 @@ calendar calendar::sunset() const int start_hour = 0, end_hour = 0, newhour = 0, newminute = 0; switch (season) { case SPRING: - start_hour = SUNSET_SOLSTICE; + start_hour = SUNSET_EQUINOX; end_hour = SUNSET_SUMMER; break; case SUMMER: start_hour = SUNSET_SUMMER; - end_hour = SUNSET_SOLSTICE; + end_hour = SUNSET_EQUINOX; break; case AUTUMN: - start_hour = SUNSET_SOLSTICE; + start_hour = SUNSET_EQUINOX; end_hour = SUNSET_WINTER; break; case WINTER: start_hour = SUNSET_WINTER; - end_hour = SUNSET_SOLSTICE; + end_hour = SUNSET_EQUINOX; break; } double percent = double(double(day) / season_length()); @@ -293,7 +293,7 @@ float calendar::sunlight() const current_phase = int(MOON_PHASE_MAX) - current_phase; } - int moonlight = 1 + int(current_phase * MOONLIGHT_PER_QUATER); + int moonlight = 1 + int(current_phase * MOONLIGHT_PER_QUARTER); if( seconds > sunset_seconds + TWILIGHT_SECONDS || seconds < sunrise_seconds ) { // Night return moonlight; diff --git a/src/calendar.h b/src/calendar.h index 8b3513137f886..c071e9c8629b9 100644 --- a/src/calendar.h +++ b/src/calendar.h @@ -30,7 +30,7 @@ constexpr int DAYS( int n ) } // How much light the moon provides per quater -#define MOONLIGHT_PER_QUATER 2.25 +#define MOONLIGHT_PER_QUARTER 2.25 // How much light is provided in full daylight #define DAYLIGHT_LEVEL 100 diff --git a/src/crafting_gui.cpp b/src/crafting_gui.cpp index bb1710a34ed2b..8aa35f1528cc3 100644 --- a/src/crafting_gui.cpp +++ b/src/crafting_gui.cpp @@ -1,5 +1,6 @@ #include "crafting_gui.h" +#include "cata_utility.h" #include "crafting.h" #include "recipe_dictionary.h" #include "requirements.h" @@ -705,9 +706,6 @@ static void draw_recipe_subtabs( WINDOW *w, std::string tab, std::string subtab, wrefresh( w ); } -// ui.cpp -extern bool lcmatch( const std::string &str, const std::string &findstr ); - template bool lcmatch_any( const std::vector< std::vector > &list_of_list, const std::string &filter ) { diff --git a/src/gates.cpp b/src/gates.cpp index b0fdf3e47db71..62b662dbfb99e 100644 --- a/src/gates.cpp +++ b/src/gates.cpp @@ -52,7 +52,7 @@ gate_id get_gate_id( const tripoint &pos ) generic_factory gates_data( "gate type", "handle", "other_handles" ); -} +} // namespace void gate_data::load( JsonObject &jo, const std::string & ) { diff --git a/src/newcharacter.cpp b/src/newcharacter.cpp index be933295caffe..76f4054d181a8 100644 --- a/src/newcharacter.cpp +++ b/src/newcharacter.cpp @@ -175,8 +175,6 @@ tab_direction set_description(WINDOW *w, player *u, bool allow_reroll, points_le void save_template(player *u); -bool lcmatch(const std::string &str, const std::string &findstr); // ui.cpp - void Character::pick_name(bool bUseDefault) { if (bUseDefault && !get_option( "DEF_CHAR_NAME" ).empty() ) {