MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / BuildIndustriesLegend

Function BuildIndustriesLegend

src/smallmap_gui.cpp:189–214  ·  view source on GitHub ↗

* Fills an array for the industries legends. */

Source from the content-addressed store, hash-verified

187 * Fills an array for the industries legends.
188 */
189void BuildIndustriesLegend()
190{
191 uint j = 0;
192
193 /* Add each name */
194 for (IndustryType ind : _sorted_industry_types) {
195 const IndustrySpec *indsp = GetIndustrySpec(ind);
196 if (indsp->enabled) {
197 _legend_from_industries[j].legend = indsp->name;
198 _legend_from_industries[j].colour = indsp->map_colour;
199 _legend_from_industries[j].type = ind;
200 _legend_from_industries[j].show_on_map = true;
201 _legend_from_industries[j].col_break = false;
202 _legend_from_industries[j].end = false;
203
204 /* Store widget number for this industry type. */
205 _industry_to_list_pos[ind] = j;
206 j++;
207 }
208 }
209 /* Terminate the list */
210 _legend_from_industries[j].end = true;
211
212 /* Store number of enabled industries */
213 _smallmap_industry_count = j;
214}
215
216/**
217 * Populate legend table for the link stat view.

Callers 2

AfterLoadGRFsFunction · 0.85
ReadLanguagePackFunction · 0.85

Calls 1

GetIndustrySpecFunction · 0.85

Tested by

no test coverage detected