742 |
742 |
743 SndPlayFx(SND_15_BEEP); |
743 SndPlayFx(SND_15_BEEP); |
744 return w; |
744 return w; |
745 } |
745 } |
746 |
746 |
747 static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray) |
747 static Window *PopupMainPlayerToolbMenu(Window *w, int main_button, int gray) |
748 { |
748 { |
749 x += w->left; |
749 int x = w->widget[main_button].left + w->left; |
750 |
750 |
751 LowerWindowWidget(w, main_button); |
751 LowerWindowWidget(w, main_button); |
752 InvalidateWidget(w, main_button); |
752 InvalidateWidget(w, main_button); |
753 |
753 |
754 DeleteWindowById(WC_TOOLBAR_MENU, 0); |
754 DeleteWindowById(WC_TOOLBAR_MENU, 0); |
793 PopupMainToolbMenu(w, 6, STR_02DD_SUBSIDIES, 1, 0); |
793 PopupMainToolbMenu(w, 6, STR_02DD_SUBSIDIES, 1, 0); |
794 } |
794 } |
795 |
795 |
796 static void ToolbarStationsClick(Window *w) |
796 static void ToolbarStationsClick(Window *w) |
797 { |
797 { |
798 PopupMainPlayerToolbMenu(w, 162, 7, 0); |
798 PopupMainPlayerToolbMenu(w, 7, 0); |
799 } |
799 } |
800 |
800 |
801 static void ToolbarMoneyClick(Window *w) |
801 static void ToolbarMoneyClick(Window *w) |
802 { |
802 { |
803 PopupMainPlayerToolbMenu(w, 191, 8, 0); |
803 PopupMainPlayerToolbMenu(w, 8, 0); |
804 } |
804 } |
805 |
805 |
806 static void ToolbarPlayersClick(Window *w) |
806 static void ToolbarPlayersClick(Window *w) |
807 { |
807 { |
808 PopupMainPlayerToolbMenu(w, 213, 9, 0); |
808 PopupMainPlayerToolbMenu(w, 9, 0); |
809 } |
809 } |
810 |
810 |
811 static void ToolbarGraphsClick(Window *w) |
811 static void ToolbarGraphsClick(Window *w) |
812 { |
812 { |
813 PopupMainToolbMenu(w, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6, 0); |
813 PopupMainToolbMenu(w, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6, 0); |
830 int dis = -1; |
830 int dis = -1; |
831 |
831 |
832 FOR_ALL_VEHICLES(v) { |
832 FOR_ALL_VEHICLES(v) { |
833 if (v->type == VEH_TRAIN && IsFrontEngine(v)) CLRBIT(dis, v->owner); |
833 if (v->type == VEH_TRAIN && IsFrontEngine(v)) CLRBIT(dis, v->owner); |
834 } |
834 } |
835 PopupMainPlayerToolbMenu(w, 310, 13, dis); |
835 PopupMainPlayerToolbMenu(w, 13, dis); |
836 } |
836 } |
837 |
837 |
838 static void ToolbarRoadClick(Window *w) |
838 static void ToolbarRoadClick(Window *w) |
839 { |
839 { |
840 const Vehicle *v; |
840 const Vehicle *v; |
841 int dis = -1; |
841 int dis = -1; |
842 |
842 |
843 FOR_ALL_VEHICLES(v) { |
843 FOR_ALL_VEHICLES(v) { |
844 if (v->type == VEH_ROAD && IsRoadVehFront(v)) CLRBIT(dis, v->owner); |
844 if (v->type == VEH_ROAD && IsRoadVehFront(v)) CLRBIT(dis, v->owner); |
845 } |
845 } |
846 PopupMainPlayerToolbMenu(w, 332, 14, dis); |
846 PopupMainPlayerToolbMenu(w, 14, dis); |
847 } |
847 } |
848 |
848 |
849 static void ToolbarShipClick(Window *w) |
849 static void ToolbarShipClick(Window *w) |
850 { |
850 { |
851 const Vehicle *v; |
851 const Vehicle *v; |
852 int dis = -1; |
852 int dis = -1; |
853 |
853 |
854 FOR_ALL_VEHICLES(v) { |
854 FOR_ALL_VEHICLES(v) { |
855 if (v->type == VEH_SHIP) CLRBIT(dis, v->owner); |
855 if (v->type == VEH_SHIP) CLRBIT(dis, v->owner); |
856 } |
856 } |
857 PopupMainPlayerToolbMenu(w, 354, 15, dis); |
857 PopupMainPlayerToolbMenu(w, 15, dis); |
858 } |
858 } |
859 |
859 |
860 static void ToolbarAirClick(Window *w) |
860 static void ToolbarAirClick(Window *w) |
861 { |
861 { |
862 const Vehicle *v; |
862 const Vehicle *v; |
863 int dis = -1; |
863 int dis = -1; |
864 |
864 |
865 FOR_ALL_VEHICLES(v) { |
865 FOR_ALL_VEHICLES(v) { |
866 if (v->type == VEH_AIRCRAFT) CLRBIT(dis, v->owner); |
866 if (v->type == VEH_AIRCRAFT) CLRBIT(dis, v->owner); |
867 } |
867 } |
868 PopupMainPlayerToolbMenu(w, 376, 16, dis); |
868 PopupMainPlayerToolbMenu(w, 16, dis); |
869 } |
869 } |
870 |
870 |
871 /* Zooms a viewport in a window in or out */ |
871 /* Zooms a viewport in a window in or out */ |
872 /* No button handling or what so ever */ |
872 /* No button handling or what so ever */ |
873 bool DoZoomInOutWindow(int how, Window *w) |
873 bool DoZoomInOutWindow(int how, Window *w) |