Advanced Strategic Command
vehicleproductionselection.h
Go to the documentation of this file.
1 
2 /***************************************************************************
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  ***************************************************************************/
10 
11 #ifndef vehicleproductionselectionH
12 #define vehicleproductionselectionH
13 
14 #include <map>
15 #include "vehicletypeselector.h"
16 #include "../actions/constructunitcommand.h"
17 
19 {
20  bool fillResources;
21  bool fillAmmo;
22  const ContainerBase* plant;
23 
24  const ConstructUnitCommand::Producables& produceables;
25 
26  Container* items; // will be initialized by the constructor's call to convertArrays
27 
28  static const Container& convertAndCreateArrays( const ConstructUnitCommand::Producables& from, Container** items );
29  static const Container& convertArrays( const ConstructUnitCommand::Producables& from, Container& items );
30 
31  protected:
32  void vehicleTypeSelected( const VehicleType* type, bool mouse );
33  void itemMarked( const SelectionWidget* widget, bool mouse );
34 
35  public:
36  VehicleProduction_SelectionItemFactory( Resources plantResources, const ContainerBase* productionplant, const ConstructUnitCommand::Producables& produceableUnits );
37 
38  bool getAmmoFilling();
39 
40  bool setAmmoFilling( bool value );
41 
42  bool getResourceFilling();
43 
44  bool setResourceFilling( bool value );
45 
46  Resources getCost( const VehicleType* type );
47 
48  sigc::signal<void,const VehicleType*, bool > sigVehicleTypeSelected;
49  sigc::signal<void,const VehicleType* > sigVehicleTypeMarked;
50 
51  void updateProducables();
52 
53 
55  {
56  delete items;
57  }
58 };
59 
60 
62 {
63  ContainerBase* plant;
64  public:
66 
67  void vehicleTypeSelected( const VehicleType* type, bool mouse );
68 
69  Resources getCost( const VehicleType* type );
70 };
71 
72 
74 {
75  const VehicleType* selected;
76  const VehicleType* finallySelected;
77  ItemSelectorWidget* isw;
79  ContainerBase* my_plant;
80 
81  const ConstructUnitCommand::Producables& produceables;
82  protected:
83  void vtMarked( const VehicleType* vt );
84 
85  void vtSelected( const VehicleType* vt, bool mouse );
86 
87  bool produce();
88 
89  bool closeWindow();
90 
91  bool quitSignalled();
92 
93  void reLoadAndUpdate();
94 
95  bool eventKeyDown(const SDL_KeyboardEvent* key);
96 
97  public:
98  VehicleProduction_SelectionWindow( PG_Widget *parent, const PG_Rect &r, ContainerBase* plant, const ConstructUnitCommand::Producables& produceableUnits, bool internally );
99 
100  void updateProducables();
101 
102  sigc::signal<void> reloadProducebles;
103 
104  bool addProductionLine();
105 
106  bool removeProductionLine();
107 
108  bool fillWithAmmo();
109 
110  bool fillWithResources();
111 
112  const VehicleType* getVehicletype() { return finallySelected; };
113 };
114 
115 
116 #endif
bool eventKeyDown(const SDL_KeyboardEvent *key)
void vtSelected(const VehicleType *vt, bool mouse)
The class describing properties that are common to all vehicles of a certain kind.
Definition: vehicletype.h:177
vector< const VehicleType * > Container
Adapter class for using Paragui Dialogs in ASC. This class transfers the event control from ASC to Pa...
Definition: paradialog.h:127
AddProductionLine_SelectionItemFactory(ContainerBase *my_plant, const Container &types)
sigc::signal< void, const VehicleType * > sigVehicleTypeMarked
void vehicleTypeSelected(const VehicleType *type, bool mouse)
Resources getCost(const VehicleType *type)
sigc::signal< void, const VehicleType *, bool > sigVehicleTypeSelected
VehicleProduction_SelectionItemFactory(Resources plantResources, const ContainerBase *productionplant, const ConstructUnitCommand::Producables &produceableUnits)
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
Resources are basically the currency of ASC.
Definition: typen.h:97
VehicleProduction_SelectionWindow(PG_Widget *parent, const PG_Rect &r, ContainerBase *plant, const ConstructUnitCommand::Producables &produceableUnits, bool internally)
void vehicleTypeSelected(const VehicleType *type, bool mouse)
Resources getCost(const VehicleType *type)
vector< ConstructUnitCommand::ProductionEntry > Producables
void itemMarked(const SelectionWidget *widget, bool mouse)