00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef vehicleproductionselectionH
00012 #define vehicleproductionselectionH
00013
00014 #include <map>
00015 #include "vehicletypeselector.h"
00016 #include "../actions/constructunitcommand.h"
00017
00018 class VehicleProduction_SelectionItemFactory: public VehicleTypeSelectionItemFactory
00019 {
00020 bool fillResources;
00021 bool fillAmmo;
00022 const ContainerBase* plant;
00023
00024 const ConstructUnitCommand::Producables& produceables;
00025
00026 Container* items;
00027
00028 static const Container& convertAndCreateArrays( const ConstructUnitCommand::Producables& from, Container** items );
00029 static const Container& convertArrays( const ConstructUnitCommand::Producables& from, Container& items );
00030
00031 protected:
00032 void vehicleTypeSelected( const VehicleType* type, bool mouse );
00033 void itemMarked( const SelectionWidget* widget, bool mouse );
00034
00035 public:
00036 VehicleProduction_SelectionItemFactory( Resources plantResources, const ContainerBase* productionplant, const ConstructUnitCommand::Producables& produceableUnits );
00037
00038 bool getAmmoFilling();
00039
00040 bool setAmmoFilling( bool value );
00041
00042 bool getResourceFilling();
00043
00044 bool setResourceFilling( bool value );
00045
00046 Resources getCost( const VehicleType* type );
00047
00048 SigC::Signal2<void,const VehicleType*, bool > sigVehicleTypeSelected;
00049 SigC::Signal1<void,const VehicleType* > sigVehicleTypeMarked;
00050
00051 void updateProducables();
00052
00053
00054 ~VehicleProduction_SelectionItemFactory()
00055 {
00056 delete items;
00057 }
00058 };
00059
00060
00061 class AddProductionLine_SelectionItemFactory: public VehicleTypeSelectionItemFactory
00062 {
00063 ContainerBase* plant;
00064 public:
00065 AddProductionLine_SelectionItemFactory( ContainerBase* my_plant, const Container& types );
00066
00067 void vehicleTypeSelected( const VehicleType* type, bool mouse );
00068
00069 Resources getCost( const VehicleType* type );
00070 };
00071
00072
00073 class VehicleProduction_SelectionWindow : public ASC_PG_Dialog
00074 {
00075 const VehicleType* selected;
00076 const VehicleType* finallySelected;
00077 ItemSelectorWidget* isw;
00078 VehicleProduction_SelectionItemFactory* factory;
00079 ContainerBase* my_plant;
00080
00081 const ConstructUnitCommand::Producables& produceables;
00082 protected:
00083 void vtMarked( const VehicleType* vt );
00084
00085 void vtSelected( const VehicleType* vt, bool mouse );
00086
00087 bool produce();
00088
00089 bool closeWindow();
00090
00091 bool quitSignalled();
00092
00093 void reLoadAndUpdate();
00094
00095 bool eventKeyDown(const SDL_KeyboardEvent* key);
00096
00097 public:
00098 VehicleProduction_SelectionWindow( PG_Widget *parent, const PG_Rect &r, ContainerBase* plant, const ConstructUnitCommand::Producables& produceableUnits, bool internally );
00099
00100 void updateProducables();
00101
00102 SigC::Signal0<void> reloadProducebles;
00103
00104 bool addProductionLine();
00105
00106 bool removeProductionLine();
00107
00108 bool fillWithAmmo();
00109
00110 bool fillWithResources();
00111
00112 const VehicleType* getVehicletype() { return finallySelected; };
00113 };
00114
00115
00116 #endif