267 if (y >= 0 && y < _fund_gui.count) { // Is it within the boundaries of available data? |
267 if (y >= 0 && y < _fund_gui.count) { // Is it within the boundaries of available data? |
268 WP(w, fnd_d).index = y; |
268 WP(w, fnd_d).index = y; |
269 WP(w, fnd_d).select = _fund_gui.index[WP(w, fnd_d).index]; |
269 WP(w, fnd_d).select = _fund_gui.index[WP(w, fnd_d).index]; |
270 indsp = (WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(WP(w, fnd_d).select); |
270 indsp = (WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(WP(w, fnd_d).select); |
271 |
271 |
272 SetWindowDirty(w); |
272 w->SetDirty(); |
273 |
273 |
274 if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) || |
274 if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) || |
275 WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) { |
275 WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) { |
276 /* Reset the button state if going to prospecting or "build many industries" */ |
276 /* Reset the button state if going to prospecting or "build many industries" */ |
277 w->RaiseButtons(); |
277 w->RaiseButtons(); |
355 bool call_back_result = CheckIfCallBackAllowsAvailability(WP(w, fnd_d).select, IACT_USERCREATION); |
355 bool call_back_result = CheckIfCallBackAllowsAvailability(WP(w, fnd_d).select, IACT_USERCREATION); |
356 |
356 |
357 /* Only if result does match the previous state would it require a redraw. */ |
357 /* Only if result does match the previous state would it require a redraw. */ |
358 if (call_back_result != _fund_gui.enabled[WP(w, fnd_d).index]) { |
358 if (call_back_result != _fund_gui.enabled[WP(w, fnd_d).index]) { |
359 _fund_gui.enabled[WP(w, fnd_d).index] = call_back_result; |
359 _fund_gui.enabled[WP(w, fnd_d).index] = call_back_result; |
360 SetWindowDirty(w); |
360 w->SetDirty(); |
361 } |
361 } |
362 } |
362 } |
363 } |
363 } |
364 break; |
364 break; |
365 |
365 |
558 if (IsProductionMaximum(i, line)) return; |
558 if (IsProductionMaximum(i, line)) return; |
559 i->production_rate[line] = minu(new_prod, 255); |
559 i->production_rate[line] = minu(new_prod, 255); |
560 } |
560 } |
561 |
561 |
562 UpdateIndustryProduction(i); |
562 UpdateIndustryProduction(i); |
563 SetWindowDirty(w); |
563 w->SetDirty(); |
564 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
564 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
565 WP(w, indview_d).clicked_line = line + 1; |
565 WP(w, indview_d).clicked_line = line + 1; |
566 WP(w, indview_d).clicked_button = (x < 15 ? 1 : 2); |
566 WP(w, indview_d).clicked_button = (x < 15 ? 1 : 2); |
567 } else if (IsInsideMM(x, 34, 160)) { |
567 } else if (IsInsideMM(x, 34, 160)) { |
568 /* clicked the text */ |
568 /* clicked the text */ |
585 } break; |
585 } break; |
586 |
586 |
587 case WE_TIMEOUT: |
587 case WE_TIMEOUT: |
588 WP(w, indview_d).clicked_line = 0; |
588 WP(w, indview_d).clicked_line = 0; |
589 WP(w, indview_d).clicked_button = 0; |
589 WP(w, indview_d).clicked_button = 0; |
590 SetWindowDirty(w); |
590 w->SetDirty(); |
591 break; |
591 break; |
592 |
592 |
593 case WE_ON_EDIT_TEXT: |
593 case WE_ON_EDIT_TEXT: |
594 if (e->we.edittext.str[0] != '\0') { |
594 if (e->we.edittext.str[0] != '\0') { |
595 Industry* i = GetIndustry(w->window_number); |
595 Industry* i = GetIndustry(w->window_number); |
596 int line = WP(w, indview_d).editbox_line; |
596 int line = WP(w, indview_d).editbox_line; |
597 |
597 |
598 i->production_rate[line] = ClampU(atoi(e->we.edittext.str), 0, 255); |
598 i->production_rate[line] = ClampU(atoi(e->we.edittext.str), 0, 255); |
599 UpdateIndustryProduction(i); |
599 UpdateIndustryProduction(i); |
600 SetWindowDirty(w); |
600 w->SetDirty(); |
601 } |
601 } |
602 } |
602 } |
603 } |
603 } |
604 |
604 |
605 static void UpdateIndustryProduction(Industry *i) |
605 static void UpdateIndustryProduction(Industry *i) |
840 case WE_CLICK: |
840 case WE_CLICK: |
841 switch (e->we.click.widget) { |
841 switch (e->we.click.widget) { |
842 case IDW_SORTBYNAME: { |
842 case IDW_SORTBYNAME: { |
843 _industry_sort_order = _industry_sort_order == 0 ? 1 : 0; |
843 _industry_sort_order = _industry_sort_order == 0 ? 1 : 0; |
844 _industry_sort_dirty = true; |
844 _industry_sort_dirty = true; |
845 SetWindowDirty(w); |
845 w->SetDirty(); |
846 } break; |
846 } break; |
847 |
847 |
848 case IDW_SORTBYTYPE: { |
848 case IDW_SORTBYTYPE: { |
849 _industry_sort_order = _industry_sort_order == 2 ? 3 : 2; |
849 _industry_sort_order = _industry_sort_order == 2 ? 3 : 2; |
850 _industry_sort_dirty = true; |
850 _industry_sort_dirty = true; |
851 SetWindowDirty(w); |
851 w->SetDirty(); |
852 } break; |
852 } break; |
853 |
853 |
854 case IDW_SORTBYPROD: { |
854 case IDW_SORTBYPROD: { |
855 _industry_sort_order = _industry_sort_order == 4 ? 5 : 4; |
855 _industry_sort_order = _industry_sort_order == 4 ? 5 : 4; |
856 _industry_sort_dirty = true; |
856 _industry_sort_dirty = true; |
857 SetWindowDirty(w); |
857 w->SetDirty(); |
858 } break; |
858 } break; |
859 |
859 |
860 case IDW_SORTBYTRANSPORT: { |
860 case IDW_SORTBYTRANSPORT: { |
861 _industry_sort_order = _industry_sort_order == 6 ? 7 : 6; |
861 _industry_sort_order = _industry_sort_order == 6 ? 7 : 6; |
862 _industry_sort_dirty = true; |
862 _industry_sort_dirty = true; |
863 SetWindowDirty(w); |
863 w->SetDirty(); |
864 } break; |
864 } break; |
865 |
865 |
866 case IDW_INDUSRTY_LIST: { |
866 case IDW_INDUSRTY_LIST: { |
867 int y = (e->we.click.pt.y - 28) / 10; |
867 int y = (e->we.click.pt.y - 28) / 10; |
868 uint16 p; |
868 uint16 p; |