89 MS(0xD7, STR_00F9_TRANSPORT_ROUTES), |
89 MS(0xD7, STR_00F9_TRANSPORT_ROUTES), |
90 MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
90 MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
91 MKEND() |
91 MKEND() |
92 }; |
92 }; |
93 |
93 |
94 static const LegendAndColour _legend_industries_normal[] = { |
|
95 MK(0xD7, STR_00FA_COAL_MINE), |
|
96 MK(0xB8, STR_00FB_POWER_STATION), |
|
97 MK(0x56, STR_00FC_FOREST), |
|
98 MK(0xC2, STR_00FD_SAWMILL), |
|
99 MK(0xBF, STR_00FE_OIL_REFINERY), |
|
100 MK(0x0F, STR_0105_BANK), |
|
101 |
|
102 MS(0x30, STR_00FF_FARM), |
|
103 MK(0xAE, STR_0100_FACTORY), |
|
104 MK(0x98, STR_0102_OIL_WELLS), |
|
105 MK(0x37, STR_0103_IRON_ORE_MINE), |
|
106 MK(0x0A, STR_0104_STEEL_MILL), |
|
107 MKEND() |
|
108 }; |
|
109 |
|
110 static const LegendAndColour _legend_industries_hilly[] = { |
|
111 MK(0xD7, STR_00FA_COAL_MINE), |
|
112 MK(0xB8, STR_00FB_POWER_STATION), |
|
113 MK(0x56, STR_00FC_FOREST), |
|
114 MK(0x0A, STR_0106_PAPER_MILL), |
|
115 MK(0xBF, STR_00FE_OIL_REFINERY), |
|
116 MK(0x37, STR_0108_FOOD_PROCESSING_PLANT), |
|
117 MS(0x30, STR_00FF_FARM), |
|
118 |
|
119 MK(0xAE, STR_0101_PRINTING_WORKS), |
|
120 MK(0x98, STR_0102_OIL_WELLS), |
|
121 MK(0xC2, STR_0107_GOLD_MINE), |
|
122 MK(0x0F, STR_0105_BANK), |
|
123 MKEND() |
|
124 }; |
|
125 |
|
126 static const LegendAndColour _legend_industries_desert[] = { |
|
127 MK(0xBF, STR_00FE_OIL_REFINERY), |
|
128 MK(0x98, STR_0102_OIL_WELLS), |
|
129 MK(0x0F, STR_0105_BANK), |
|
130 MK(0xB8, STR_0109_DIAMOND_MINE), |
|
131 MK(0x37, STR_0108_FOOD_PROCESSING_PLANT), |
|
132 MK(0x0A, STR_010A_COPPER_ORE_MINE), |
|
133 MK(0x30, STR_00FF_FARM), |
|
134 MS(0x56, STR_010B_FRUIT_PLANTATION), |
|
135 |
|
136 MK(0x27, STR_010C_RUBBER_PLANTATION), |
|
137 MK(0x25, STR_010D_WATER_SUPPLY), |
|
138 MK(0xD0, STR_010E_WATER_TOWER), |
|
139 MK(0xAE, STR_0100_FACTORY), |
|
140 MK(0xC2, STR_010F_LUMBER_MILL), |
|
141 MKEND() |
|
142 }; |
|
143 |
|
144 static const LegendAndColour _legend_industries_candy[] = { |
|
145 MK(0x30, STR_0110_COTTON_CANDY_FOREST), |
|
146 MK(0xAE, STR_0111_CANDY_FACTORY), |
|
147 MK(0x27, STR_0112_BATTERY_FARM), |
|
148 MK(0x37, STR_0113_COLA_WELLS), |
|
149 MK(0xD0, STR_0114_TOY_SHOP), |
|
150 MK(0x0A, STR_0115_TOY_FACTORY), |
|
151 MS(0x25, STR_0116_PLASTIC_FOUNTAINS), |
|
152 |
|
153 MK(0xB8, STR_0117_FIZZY_DRINK_FACTORY), |
|
154 MK(0x98, STR_0118_BUBBLE_GENERATOR), |
|
155 MK(0xC2, STR_0119_TOFFEE_QUARRY), |
|
156 MK(0x0F, STR_011A_SUGAR_MINE), |
|
157 MKEND() |
|
158 }; |
|
159 |
|
160 static const LegendAndColour _legend_routes[] = { |
94 static const LegendAndColour _legend_routes[] = { |
161 MK(0xD7, STR_00EB_ROADS), |
95 MK(0xD7, STR_00EB_ROADS), |
162 MK(0x0A, STR_00EC_RAILROADS), |
96 MK(0x0A, STR_00EC_RAILROADS), |
163 MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
97 MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
164 MS(0x56, STR_011B_RAILROAD_STATION), |
98 MS(0x56, STR_011B_RAILROAD_STATION), |
195 }; |
129 }; |
196 #undef MK |
130 #undef MK |
197 #undef MS |
131 #undef MS |
198 #undef MKEND |
132 #undef MKEND |
199 |
133 |
200 |
134 /** Allow room for all industries, plus a terminator entry |
201 enum { IND_OFFS = 6 }; ///< allow to "jump" to the industries corresponding to the landscape |
135 * This is required in order to have the indutry slots all filled up */ |
|
136 static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES+1]; |
|
137 |
|
138 /** |
|
139 * Fills an array for the industries legends. |
|
140 */ |
|
141 void BuildIndustriesLegend() |
|
142 { |
|
143 const IndustrySpec *indsp; |
|
144 uint j = 0; |
|
145 |
|
146 /* Add each name */ |
|
147 for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) { |
|
148 indsp = GetIndustrySpec(i); |
|
149 if (HASBIT(indsp->climate_availability, _opt.landscape)) { |
|
150 _legend_from_industries[j].legend = indsp->name; |
|
151 _legend_from_industries[j].colour = indsp->map_colour; |
|
152 _legend_from_industries[j].col_break = (j % 6) == 0; // break is performed on the 7th item |
|
153 _legend_from_industries[j].end = false; |
|
154 j++; |
|
155 } |
|
156 } |
|
157 /* Terminate the list */ |
|
158 _legend_from_industries[j].end = true; |
|
159 } |
202 |
160 |
203 static const LegendAndColour * const _legend_table[] = { |
161 static const LegendAndColour * const _legend_table[] = { |
204 _legend_land_contours, |
162 _legend_land_contours, |
205 _legend_vehicles, |
163 _legend_vehicles, |
206 NULL, |
164 _legend_from_industries, |
207 _legend_routes, |
165 _legend_routes, |
208 _legend_vegetation, |
166 _legend_vegetation, |
209 _legend_land_owners, |
167 _legend_land_owners, |
210 |
|
211 _legend_industries_normal, |
|
212 _legend_industries_hilly, |
|
213 _legend_industries_desert, |
|
214 _legend_industries_candy, |
|
215 }; |
168 }; |
216 |
169 |
217 #if defined(OTTD_ALIGNMENT) |
170 #if defined(OTTD_ALIGNMENT) |
218 static inline void WRITE_PIXELS(Pixel* d, uint32 val) |
171 static inline void WRITE_PIXELS(Pixel* d, uint32 val) |
219 { |
172 { |
798 |
751 |
799 /* draw the window */ |
752 /* draw the window */ |
800 SetDParam(0, STR_00E5_CONTOURS + _smallmap_type); |
753 SetDParam(0, STR_00E5_CONTOURS + _smallmap_type); |
801 DrawWindowWidgets(w); |
754 DrawWindowWidgets(w); |
802 |
755 |
803 /* draw the legend */ |
756 tbl = _legend_table[_smallmap_type]; |
804 tbl = _legend_table[(_smallmap_type != 2) ? _smallmap_type : (_opt.landscape + IND_OFFS)]; |
757 |
805 x = 4; |
758 x = 4; |
806 y_org = w->height - 44 - 11; |
759 y_org = w->height - 44 - 11; |
807 y = y_org; |
760 y = y_org; |
808 for (;;) { |
761 for (;;) { |
809 GfxFillRect(x, y + 1, x + 8, y + 5, 0); |
762 GfxFillRect(x, y + 1, x + 8, y + 5, 0); |
810 GfxFillRect(x + 1, y + 2, x + 7, y + 4, tbl->colour); |
763 GfxFillRect(x + 1, y + 2, x + 7, y + 4, tbl->colour); |
811 DrawString(x + 11, y, tbl->legend, 0); |
764 |
|
765 if (_smallmap_type == 2) { |
|
766 /* Industry name must be formated, since it's not in tiny font in the specs. |
|
767 * So, draw with a parameter and use the STR_7065 string, which is tiny, black */ |
|
768 SetDParam(0, tbl->legend); |
|
769 DrawString(x + 11, y, STR_7065, 0); |
|
770 } else { |
|
771 DrawString(x + 11, y, tbl->legend, 0); |
|
772 } |
812 |
773 |
813 tbl += 1; |
774 tbl += 1; |
814 y += 6; |
775 y += 6; |
815 |
776 |
816 if (tbl->end) { // end of the list |
777 if (tbl->end) { // end of the list |
1092 if (w != NULL) { |
1053 if (w != NULL) { |
1093 int x, y; |
1054 int x, y; |
1094 /* the main window with the main view */ |
1055 /* the main window with the main view */ |
1095 v = FindWindowById(WC_MAIN_WINDOW, 0); |
1056 v = FindWindowById(WC_MAIN_WINDOW, 0); |
1096 /* New viewport start ats (zero,zero) */ |
1057 /* New viewport start ats (zero,zero) */ |
1097 AssignWindowViewport(w, 3, 17, 294, 214, 0 , 0); |
1058 AssignWindowViewport(w, 3, 17, 294, 214, 0 , ZOOM_LVL_VIEWPORT); |
1098 |
1059 |
1099 /* center on same place as main window (zoom is maximum, no adjustment needed) */ |
1060 /* center on same place as main window (zoom is maximum, no adjustment needed) */ |
1100 x = WP(v, vp_d).scrollpos_x; |
1061 x = WP(v, vp_d).scrollpos_x; |
1101 y = WP(v, vp_d).scrollpos_y; |
1062 y = WP(v, vp_d).scrollpos_y; |
1102 WP(w, vp_d).scrollpos_x = x + (v->viewport->virtual_width - (294)) / 2; |
1063 WP(w, vp_d).scrollpos_x = x + (v->viewport->virtual_width - (294)) / 2; |