From bcbaa92485d407463be650397518844484e5f3ff Mon Sep 17 00:00:00 2001 From: fonsinchen Date: Fri, 23 Aug 2013 18:37:45 +0000 Subject: (svn r25741) -Fix: shift join dates of link graph jobs when using the date cheat --- src/cheat_gui.cpp | 3 +++ src/linkgraph/linkgraphjob.h | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index c49eb429e..87288279e 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -25,6 +25,7 @@ #include "settings_gui.h" #include "company_gui.h" #include "linkgraph/linkgraph.h" +#include "linkgraph/linkgraphjob.h" #include "widgets/cheat_widget.h" @@ -104,6 +105,8 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2) 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); diff --git a/src/linkgraph/linkgraphjob.h b/src/linkgraph/linkgraphjob.h index e4df614a8..79231c754 100644 --- a/src/linkgraph/linkgraphjob.h +++ b/src/linkgraph/linkgraphjob.h @@ -60,7 +60,7 @@ 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. @@ -281,6 +281,12 @@ public: */ 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. -- cgit v1.2.3-70-g09d2