equal
deleted
inserted
replaced
11 #include "player.h" |
11 #include "player.h" |
12 #include "gfx.h" |
12 #include "gfx.h" |
13 #include "economy.h" |
13 #include "economy.h" |
14 #include "variables.h" |
14 #include "variables.h" |
15 #include "date.h" |
15 #include "date.h" |
|
16 #include "cargotype.h" |
16 |
17 |
17 static void HandleSubsidyClick(int y) |
18 static void HandleSubsidyClick(int y) |
18 { |
19 { |
19 const Subsidy *s; |
20 const Subsidy *s; |
20 uint num; |
21 uint num; |
48 } |
49 } |
49 return; |
50 return; |
50 |
51 |
51 handle_click: |
52 handle_click: |
52 |
53 |
|
54 TownEffect te = GetCargo(s->cargo_type)->town_effect; |
|
55 |
53 /* determine from coordinate for subsidy and try to scroll to it */ |
56 /* determine from coordinate for subsidy and try to scroll to it */ |
54 offs = s->from; |
57 offs = s->from; |
55 if (s->age >= 12) { |
58 if (s->age >= 12) { |
56 xy = GetStation(offs)->xy; |
59 xy = GetStation(offs)->xy; |
57 } else if (s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL) { |
60 } else if (te == TE_PASSENGERS || te == TE_MAIL) { |
58 xy = GetTown(offs)->xy; |
61 xy = GetTown(offs)->xy; |
59 } else { |
62 } else { |
60 xy = GetIndustry(offs)->xy; |
63 xy = GetIndustry(offs)->xy; |
|
64 } |
61 |
65 |
62 } |
|
63 if (!ScrollMainWindowToTile(xy)) { |
66 if (!ScrollMainWindowToTile(xy)) { |
64 /* otherwise determine to coordinate for subsidy and scroll to it */ |
67 /* otherwise determine to coordinate for subsidy and scroll to it */ |
65 offs = s->to; |
68 offs = s->to; |
66 if (s->age >= 12) { |
69 if (s->age >= 12) { |
67 xy = GetStation(offs)->xy; |
70 xy = GetStation(offs)->xy; |
68 } else if (s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL || s->cargo_type == CT_GOODS || s->cargo_type == CT_FOOD) { |
71 } else if (te == TE_PASSENGERS || te == TE_MAIL || te == TE_GOODS || te == TE_FOOD) { |
69 xy = GetTown(offs)->xy; |
72 xy = GetTown(offs)->xy; |
70 } else { |
73 } else { |
71 xy = GetIndustry(offs)->xy; |
74 xy = GetIndustry(offs)->xy; |
72 } |
75 } |
73 ScrollMainWindowToTile(xy); |
76 ScrollMainWindowToTile(xy); |
168 _subsidies_list_widgets, |
171 _subsidies_list_widgets, |
169 SubsidiesListWndProc |
172 SubsidiesListWndProc |
170 }; |
173 }; |
171 |
174 |
172 |
175 |
173 void ShowSubsidiesList(void) |
176 void ShowSubsidiesList() |
174 { |
177 { |
175 AllocateWindowDescFront(&_subsidies_list_desc, 0); |
178 AllocateWindowDescFront(&_subsidies_list_desc, 0); |
176 } |
179 } |