Changeset - r20703:b70e534e3b73
[Not reviewed]
master
0 2 0
fonsinchen - 11 years ago 2013-08-23 18:37:45
fonsinchen@openttd.org
(svn r25741) -Fix: shift join dates of link graph jobs when using the date cheat
2 files changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/cheat_gui.cpp
Show inline comments
 
@@ -22,12 +22,13 @@
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "rail_gui.h"
 
#include "settings_gui.h"
 
#include "company_gui.h"
 
#include "linkgraph/linkgraph.h"
 
#include "linkgraph/linkgraphjob.h"
 

	
 
#include "widgets/cheat_widget.h"
 

	
 
#include "table/sprites.h"
 

	
 

	
 
@@ -101,12 +102,14 @@ static int32 ClickChangeDateCheat(int32 
 
	p1 = Clamp(p1, MIN_YEAR, MAX_YEAR);
 
	if (p1 == _cur_year) return _cur_year;
 

	
 
	Date new_date = ConvertYMDToDate(p1, ymd.month, ymd.day);
 
	LinkGraph *lg;
 
	FOR_ALL_LINK_GRAPHS(lg) lg->ShiftDates(new_date - _date);
 
	LinkGraphJob *lgj;
 
	FOR_ALL_LINK_GRAPH_JOBS(lgj) lgj->ShiftJoinDate(new_date - _date);
 
	SetDate(new_date, _date_fract);
 
	EnginesMonthlyLoop();
 
	SetWindowDirty(WC_STATUS_BAR, 0);
 
	InvalidateWindowClassesData(WC_BUILD_STATION, 0);
 
	InvalidateWindowClassesData(WC_BUILD_OBJECT, 0);
 
	ResetSignalVariant();
src/linkgraph/linkgraphjob.h
Show inline comments
 
@@ -57,13 +57,13 @@ private:
 
	friend class LinkGraphSchedule;
 

	
 
protected:
 
	const LinkGraph link_graph;       ///< Link graph to by analyzed. Is copied when job is started and mustn't be modified later.
 
	const LinkGraphSettings settings; ///< Copy of _settings_game.linkgraph at spawn time.
 
	ThreadObject *thread;             ///< Thread the job is running in or NULL if it's running in the main thread.
 
	const Date join_date;             ///< Date when the job is to be joined.
 
	Date join_date;                   ///< Date when the job is to be joined.
 
	NodeAnnotationVector nodes;       ///< Extra node data necessary for link graph calculation.
 
	EdgeAnnotationMatrix edges;       ///< Extra edge data necessary for link graph calculation.
 

	
 
public:
 

	
 
	/**
 
@@ -279,12 +279,18 @@ public:
 
	 * Get the date when the job should be finished.
 
	 * @return Join date.
 
	 */
 
	inline Date JoinDate() const { return join_date; }
 

	
 
	/**
 
	 * Change the join date on date cheating.
 
	 * @param interval Number of days to add.
 
	 */
 
	inline void ShiftJoinDate(int interval) { this->join_date += interval; }
 

	
 
	/**
 
	 * Get the link graph settings for this component.
 
	 * @return Settings.
 
	 */
 
	inline const LinkGraphSettings &Settings() const { return this->settings; }
 

	
 
	/**
0 comments (0 inline, 0 general)