Changeset - r27154:32c425976634
[Not reviewed]
master
0 2 0
Tyler Trahan - 13 months ago 2023-04-24 19:58:48
tyler@tylertrahan.com
Cleanup: Don't use a magic number when closing processing industries (#10710)
2 files changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/industry.h
Show inline comments
 
@@ -21,6 +21,8 @@
 
typedef Pool<Industry, IndustryID, 64, 64000> IndustryPool;
 
extern IndustryPool _industry_pool;
 

	
 
static const Year PROCESSING_INDUSTRY_ABANDONMENT_YEARS = 5; ///< If a processing industry doesn't produce for this many consecutive years, it may close.
 

	
 
/**
 
 * Production level maximum, minimum and default values.
 
 * It is not a value been really used in order to change, but rather an indicator
src/industry_cmd.cpp
Show inline comments
 
@@ -2857,7 +2857,7 @@ static void ChangeIndustryProduction(Ind
 
	if ((i->ctlflags & INDCTL_NO_PRODUCTION_INCREASE) && (mul > 0 || increment > 0)) return;
 

	
 
	if (!callback_enabled && (indspec->life_type & INDUSTRYLIFE_PROCESSING)) {
 
		if ( (byte)(TimerGameCalendar::year - i->last_prod_year) >= 5 && Chance16(1, original_economy ? 2 : 180)) {
 
		if (TimerGameCalendar::year - i->last_prod_year >= PROCESSING_INDUSTRY_ABANDONMENT_YEARS && Chance16(1, original_economy ? 2 : 180)) {
 
			closeit = true;
 
		}
 
	}
0 comments (0 inline, 0 general)