93 ConvertDateToYMD(_date, &ymd); |
93 ConvertDateToYMD(_date, &ymd); |
94 |
94 |
95 int width = w->width - 13; // scroll bar = 11 + pixel each side |
95 int width = w->width - 13; // scroll bar = 11 + pixel each side |
96 y = 15; |
96 y = 15; |
97 x = 1; |
97 x = 1; |
|
98 |
|
99 /* Section for drawing the offered subisidies */ |
98 DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width); |
100 DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width); |
99 y += 10; |
101 y += 10; |
100 num = 0; |
102 num = 0; |
101 |
103 |
102 for (s = _subsidies; s != endof(_subsidies); s++) { |
104 for (s = _subsidies; s != endof(_subsidies); s++) { |
103 if (s->cargo_type != CT_INVALID && s->age < 12) { |
105 if (s->cargo_type != CT_INVALID && s->age < 12) { |
104 int x2; |
106 int x2; |
105 |
107 |
|
108 /* Displays the two offered towns */ |
106 SetupSubsidyDecodeParam(s, 1); |
109 SetupSubsidyDecodeParam(s, 1); |
107 x2 = DrawStringTruncated(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING, width); |
110 x2 = DrawStringTruncated(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING, width); |
108 |
111 |
|
112 /* Displays the deadline before voiding the proposal */ |
109 SetDParam(0, _date - ymd.day + 384 - s->age * 32); |
113 SetDParam(0, _date - ymd.day + 384 - s->age * 32); |
110 DrawStringTruncated(x2, y, STR_2028_BY, TC_FROMSTRING, width - x2); |
114 DrawStringTruncated(x2, y, STR_2028_BY, TC_FROMSTRING, width - x2); |
111 y += 10; |
115 y += 10; |
112 num++; |
116 num++; |
113 } |
117 } |
116 if (num == 0) { |
120 if (num == 0) { |
117 DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2); |
121 DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2); |
118 y += 10; |
122 y += 10; |
119 } |
123 } |
120 |
124 |
|
125 /* Section for drawing the already granted subisidies */ |
121 DrawStringTruncated(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING, width); |
126 DrawStringTruncated(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING, width); |
122 y += 10; |
127 y += 10; |
123 num = 0; |
128 num = 0; |
124 |
129 |
125 for (s = _subsidies; s != endof(_subsidies); s++) { |
130 for (s = _subsidies; s != endof(_subsidies); s++) { |
129 SetupSubsidyDecodeParam(s, 1); |
134 SetupSubsidyDecodeParam(s, 1); |
130 |
135 |
131 PlayerID player = GetStation(s->to)->owner; |
136 PlayerID player = GetStation(s->to)->owner; |
132 SetDParam(3, player); |
137 SetDParam(3, player); |
133 |
138 |
|
139 /* Displays the two connected stations */ |
134 xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2); |
140 xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2); |
135 |
141 |
136 if ((xt > 3) && (width - xt) > 9 ) { // do not draw if it will get on the scrollbar or if last drawing did nothing |
142 /* Displays the date where the granted subsidy will end */ |
|
143 if ((xt > 3) && (width - xt) > 9 ) { // do not draw if previous drawing failed or if it will overlap on scrollbar |
137 SetDParam(0, _date - ymd.day + 768 - s->age * 32); |
144 SetDParam(0, _date - ymd.day + 768 - s->age * 32); |
138 DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt); |
145 DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt); |
139 } |
146 } |
140 y += 10; |
147 y += 10; |
141 num++; |
148 num++; |
163 static const Widget _subsidies_list_widgets[] = { |
170 static const Widget _subsidies_list_widgets[] = { |
164 { WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
171 { WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
165 { WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
172 { WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
166 { WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
173 { WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
167 { WWT_PANEL, RESIZE_RB, 13, 0, 307, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER}, |
174 { WWT_PANEL, RESIZE_RB, 13, 0, 307, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER}, |
168 { WWT_SCROLLBAR, RESIZE_LRB, 13, 308, 319, 14, 114, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // IDW_SCROLLBAR |
175 { WWT_SCROLLBAR, RESIZE_LRB, 13, 308, 319, 14, 114, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
169 { WWT_RESIZEBOX, RESIZE_LRTB, 13, 308, 319, 115, 126, 0x0, STR_RESIZE_BUTTON}, // IDW_RESIZE |
176 { WWT_RESIZEBOX, RESIZE_LRTB, 13, 308, 319, 115, 126, 0x0, STR_RESIZE_BUTTON}, |
170 |
177 |
171 { WIDGETS_END}, |
178 { WIDGETS_END}, |
172 }; |
179 }; |
173 |
180 |
174 static const WindowDesc _subsidies_list_desc = { |
181 static const WindowDesc _subsidies_list_desc = { |