Skip to content

Commit

Permalink
Trivial code corrections
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
bdgackle committed Apr 3, 2017
1 parent f31165a commit e0c8967
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 24 deletions.
6 changes: 3 additions & 3 deletions doxygen_doc/pages.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
6 changes: 3 additions & 3 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -619,7 +619,7 @@ bool attempt_recharge( player &p, bionic &bio, int &amount, int factor = 1, int
recharged = true;
}
}

return recharged;
}

Expand Down
22 changes: 11 additions & 11 deletions src/calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/crafting_gui.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "crafting_gui.h"

#include "cata_utility.h"
#include "crafting.h"
#include "recipe_dictionary.h"
#include "requirements.h"
Expand Down Expand Up @@ -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<typename T>
bool lcmatch_any( const std::vector< std::vector<T> > &list_of_list, const std::string &filter )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ gate_id get_gate_id( const tripoint &pos )

generic_factory<gate_data> gates_data( "gate type", "handle", "other_handles" );

}
} // namespace

void gate_data::load( JsonObject &jo, const std::string & )
{
Expand Down
2 changes: 0 additions & 2 deletions src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>( "DEF_CHAR_NAME" ).empty() ) {
Expand Down

0 comments on commit e0c8967

Please sign in to comment.