FS#3157 - Day length patch
|
DetailsPatch to adjust day length. Not first, I know, but I think (hope) that finaly completed.
For more info: http://www.tt-forums.net/viewtopic.php?f=33&t=42432 |
This task depends upon
|
DetailsPatch to adjust day length. Not first, I know, but I think (hope) that finaly completed.
For more info: http://www.tt-forums.net/viewtopic.php?f=33&t=42432 |
I just pick random code fragments I encounter, most comments apply at many places in the code.
+ if( _settings_game.economy.day_length_balance_type == DBT_ALL_COSTS )
+ res.AffectCost( _settings_game.economy.day_length_balance_factor );
Coding style errors.
no space after if
an additional space inside the outer parentheses
statement after the if is not allowed in this way. either at the same line, or use curly brackets
+ if( (((_date_fract % DAY_TICKS) == 0) && ( !(_settings_game.economy.slow_down_industry_changes) )) ||
+ ( _date_fract == 0 ) )
+ {
+ IndustryDailyLoop();
+ }
Coding style errors.
no space after if
an additional space inside the outer parentheses
unneeded parentheses all over the place
open curly bracket at same line as the if, not below it
+* Returns a number of days in current month.
+*/
+static Day DaysInCurrentMonth()
Also document the returned value with @return
+* Return a day and tick, where new month on day length 1 would start.
+*/
+static void NewMonthAt( Day cur_day, DayTick *dt )
"return" ?
formal parameters must also be documented with @param
+#define DAYS_IN_YEAR 365 ///< days per year
+#define DAYS_IN_LEAP_YEAR 366 ///< sometimes, you need one day more...
don't change enums back to #define
+STR_CONFIG_PATCHES_DAY_LENGTH_FACTOR :{LTBLUE}Day length factor: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DAY_LENGTH_BALANCE :{LTBLUE}Balancing of day length: {ORANGE}{STRING}
nearby are CONFIG_SETTINGS which seems a better name than CONFIG_PATCHES to me
+ UpdateGraphPerformance();
in a list if InitializeXXXX calls. looks fishy. perhaps rename it?
+static bool UpdateAllCosts(int32 p1)
static functions must also be documented