changeset 9898 | 75347c78b276 |
parent 9570 | 8b9c1cbb0077 |
child 10146 | cfea97f96067 |
9897:4d9a6ff6703e | 9898:75347c78b276 |
---|---|
31 |
31 |
32 _date = date; |
32 _date = date; |
33 ConvertDateToYMD(date, &ymd); |
33 ConvertDateToYMD(date, &ymd); |
34 _cur_year = ymd.year; |
34 _cur_year = ymd.year; |
35 _cur_month = ymd.month; |
35 _cur_month = ymd.month; |
36 #ifdef ENABLE_NETWORK |
|
37 _network_last_advertise_frame = 0; |
|
38 _network_need_advertise = true; |
|
39 #endif /* ENABLE_NETWORK */ |
|
40 } |
36 } |
41 |
37 |
42 #define M(a, b) ((a << 5) | b) |
38 #define M(a, b) ((a << 5) | b) |
43 static const uint16 _month_date_from_year_day[] = { |
39 static const uint16 _month_date_from_year_day[] = { |
44 M( 0, 1), M( 0, 2), M( 0, 3), M( 0, 4), M( 0, 5), M( 0, 6), M( 0, 7), M( 0, 8), M( 0, 9), M( 0, 10), M( 0, 11), M( 0, 12), M( 0, 13), M( 0, 14), M( 0, 15), M( 0, 16), M( 0, 17), M( 0, 18), M( 0, 19), M( 0, 20), M( 0, 21), M( 0, 22), M( 0, 23), M( 0, 24), M( 0, 25), M( 0, 26), M( 0, 27), M( 0, 28), M( 0, 29), M( 0, 30), M( 0, 31), |
40 M( 0, 1), M( 0, 2), M( 0, 3), M( 0, 4), M( 0, 5), M( 0, 6), M( 0, 7), M( 0, 8), M( 0, 9), M( 0, 10), M( 0, 11), M( 0, 12), M( 0, 13), M( 0, 14), M( 0, 15), M( 0, 16), M( 0, 17), M( 0, 18), M( 0, 19), M( 0, 20), M( 0, 21), M( 0, 22), M( 0, 23), M( 0, 24), M( 0, 25), M( 0, 26), M( 0, 27), M( 0, 28), M( 0, 29), M( 0, 30), M( 0, 31), |
159 } |
155 } |
160 |
156 |
161 /** Functions used by the IncreaseDate function */ |
157 /** Functions used by the IncreaseDate function */ |
162 |
158 |
163 extern void WaypointsDailyLoop(); |
159 extern void WaypointsDailyLoop(); |
164 extern void ChatMessageDailyLoop(); |
|
165 extern void EnginesDailyLoop(); |
160 extern void EnginesDailyLoop(); |
166 extern void DisasterDailyLoop(); |
161 extern void DisasterDailyLoop(); |
167 |
162 |
168 extern void PlayersMonthlyLoop(); |
163 extern void PlayersMonthlyLoop(); |
169 extern void EnginesMonthlyLoop(); |
164 extern void EnginesMonthlyLoop(); |
226 _date_fract = 0; |
221 _date_fract = 0; |
227 |
222 |
228 /* yeah, increase day counter and call various daily loops */ |
223 /* yeah, increase day counter and call various daily loops */ |
229 _date++; |
224 _date++; |
230 |
225 |
231 ChatMessageDailyLoop(); |
226 #ifdef ENABLE_NETWORK |
227 NetworkChatMessageDailyLoop(); |
|
228 #endif /* ENABLE_NETWORK */ |
|
232 |
229 |
233 DisasterDailyLoop(); |
230 DisasterDailyLoop(); |
234 WaypointsDailyLoop(); |
231 WaypointsDailyLoop(); |
235 |
232 |
236 if (_game_mode != GM_MENU) { |
233 if (_game_mode != GM_MENU) { |
294 _cur_year--; |
291 _cur_year--; |
295 days_this_year = IsLeapYear(_cur_year) ? 366 : 365; |
292 days_this_year = IsLeapYear(_cur_year) ? 366 : 365; |
296 _date -= days_this_year; |
293 _date -= days_this_year; |
297 FOR_ALL_VEHICLES(v) v->date_of_last_service -= days_this_year; |
294 FOR_ALL_VEHICLES(v) v->date_of_last_service -= days_this_year; |
298 |
295 |
296 #ifdef ENABLE_NETWORK |
|
299 /* Because the _date wraps here, and text-messages expire by game-days, we have to clean out |
297 /* Because the _date wraps here, and text-messages expire by game-days, we have to clean out |
300 * all of them if the date is set back, else those messages will hang for ever */ |
298 * all of them if the date is set back, else those messages will hang for ever */ |
301 InitChatMessage(); |
299 NetworkInitChatMessage(); |
300 #endif /* ENABLE_NETWORK */ |
|
302 } |
301 } |
303 |
302 |
304 if (_settings_client.gui.auto_euro) CheckSwitchToEuro(); |
303 if (_settings_client.gui.auto_euro) CheckSwitchToEuro(); |
305 } |
304 } |