Advanced Strategic Command
edselfnt.cpp
Go to the documentation of this file.
1 
5 /*
6  This file is part of Advanced Strategic Command; http://www.asc-hq.de
7  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING. If not, write to the
21  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  Boston, MA 02111-1307 USA
23 */
24 
25 
26 #include "vehicletype.h"
27 #include "buildingtype.h"
28 
29 #include "edmisc.h"
30 #include "edselfnt.h"
31 #include "mapdisplay.h"
32 #include "itemrepository.h"
33 #include "edglobal.h"
34 
35 #include "graphics/blitter.h"
36 #include "paradialog.h"
37 
39 #include "unitset.h"
40 #include "spfst-legacy.h"
41 
42 sigc::signal<void> filtersChangedSignal;
43 
44 
45 
46 
47 
48 bool buildingComp( const BuildingType* v1, const BuildingType* v2 )
49 {
50  int id1 = getUnitSetID(v1);
51  int id2 = getUnitSetID(v2);
52  return (id1 < id2) ||
53  (id1 == id2 && v1->name < v2->name);
54 }
55 
56 bool objectComp( const ObjectType* v1, const ObjectType* v2 )
57 {
58  return v1->name < v2->name;
59 }
60 
61 bool terrainComp( const TerrainType* v1, const TerrainType* v2 )
62 {
63  if ( v1->weather[0] && v2->weather[0] )
64  return v1->weather[0]->art.to_string() < v2->weather[0]->art.to_string();
65  else
66  return v1->name < v2->name;
67 }
68 
69 bool mineComp( const MineType* v1, const MineType* v2 )
70 {
71  return v1->id < v2->id;
72 }
73 
74 
75 void sortItems( vector<VehicleType*>& vec )
76 {
77  sort( vec.begin(), vec.end(), vehicleComp );
78 }
79 
80 void sortItems( vector<BuildingType*>& vec )
81 {
82  sort( vec.begin(), vec.end(), buildingComp );
83 }
84 
85 void sortItems( vector<ObjectType*>& vec )
86 {
87  sort( vec.begin(), vec.end(), objectComp );
88 }
89 
90 void sortItems( vector<TerrainType*>& vec )
91 {
92  sort( vec.begin(), vec.end(), terrainComp );
93 }
94 
95 void sortItems( vector<MineType*>& vec )
96 {
97  sort( vec.begin(), vec.end(), mineComp );
98 }
99 
100 
101 void MapComponent::displayClip( PG_Widget* parent, SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst ) const
102 {
103  if ( !getClippingSurface().valid() )
105 
106  getClippingSurface().Fill(0);
107  display( getClippingSurface(), SPoint( 0, 0 ) );
108 
109  static PG_ThemeWidget* fontProvidingWidget = NULL;
110  if ( !fontProvidingWidget )
111  fontProvidingWidget = new PG_ThemeWidget( NULL, PG_Rect::null , false, "MapedItemSelector" );
112 
113  /*
114  SDL_Rect blitRect;
115  blitRect.x = 0;
116  blitRect.y = displayHeight() + 2;
117  blitRect.w = displayWidth();
118  blitRect.h = displayHeight() - blitRect.y;
119 
120  PG_FontEngine::RenderText( getClippingSurface().getBaseSurface(), blitRect, blitRect.x, blitRect.y+fontProvidingWidget ->GetFontAscender(), getItemType()->getName(), fontProvidingWidget ->GetFont() );
121  */
122 
123  PG_Draw::BlitSurface( getClippingSurface().getBaseSurface(), src, surface, dst);
124 
125  int x = dst.x;
126  int y = dst.y + displayHeight() + fontProvidingWidget ->GetFontAscender() - src.y;
127 
128  PG_FontEngine::RenderText( surface, dst, x, y, getItemType()->getName(), fontProvidingWidget ->GetFont() );
129 }
130 
131 
132 
133 
134 int VehicleItem::place( GameMap* gamemap, const MapCoordinate& mc, const VehicleType* v, int owner )
135 {
136  MapField* fld = gamemap->getField(mc);
137  if ( !fld )
138  return -1;
139 
140  const VehicleType* veh = v;
141 
142  if ( !veh )
143  return -2;
144 
145  if ( owner >= 8 )
146  return -3;
147 
148  bool accessible = veh->terrainaccess.accessible ( fld->bdt );
149  if ( veh->height >= chtieffliegend )
150  accessible = true;
151 
152  if ( fld->building || ( !accessible && !gamemap->getgameparameter( cgp_movefrominvalidfields)) )
153  return -3;
154 
155 
156  if ( fld->vehicle ) {
157  if ( fld->vehicle->typ != veh ) {
158  delete fld->vehicle;
159  fld->vehicle = NULL;
160  } else {
161  fld->vehicle->convert( owner );
162  return 1;
163  }
164  }
165  fld->vehicle = new Vehicle ( v, gamemap, owner );
166  fld->vehicle->setnewposition ( mc );
167  fld->vehicle->fillMagically();
168 
169  for ( int i = 0; i < 9; ++i ) {
170  if ( fld->vehicle->typ->height & (1 << i )) {
171  fld->vehicle->height = 1 << i;
172  if ( terrainaccessible( fld, fld->vehicle ) == 2 ) // || gamemap->getgameparameter( cgp_movefrominvalidfields)
173  break;
174  }
175  if ( i == 8 ) { // no height found
176  delete fld->vehicle;
177  fld->vehicle = NULL;
178  return -3;
179  }
180  }
181  fld->vehicle->resetMovement();
182  return 1;
183 
184 }
185 
186 int VehicleItem::place( const MapCoordinate& mc ) const
187 {
188  return place( actmap, mc, item, selection.getPlayer() );
189 }
190 
191 Surface BuildingItem::clippingSurface;
192 Surface BuildingItem::fullSizeImage;
193 int BuildingItem::place( const MapCoordinate& mc ) const
194 {
195  if ( selection.getPlayer() > 8 )
196  return -3;
197 
198  int f = 0;
199  for ( int x = 0; x < 4; x++ )
200  for ( int y = 0; y < 6; y++ )
201  if ( bld->fieldExists ( BuildingType::LocalCoordinate(x, y) )) {
203  if ( !actmap->getField (mc) )
204  return -1;
205 
206  if ( bld->terrainaccess.accessible ( actmap->getField (mc)->bdt ) <= 0 )
207  f++;
208  }
209  if ( f ) {
210  if (choice_dlg("Invalid terrain for building !","~i~gnore","~c~ancel") == 2)
211  return -1 ;
212  }
213 
215  return 0;
216 }
217 
218 void BuildingItem::display( Surface& s, const SPoint& pos ) const
219 {
220  if ( !fullSizeImage.valid() )
221  fullSizeImage = Surface::createSurface( displayWidth()*2 + 10, displayHeight()*2 + 30, 32, 0 );
222  fullSizeImage.FillTransparent();
223  if ( actmap )
224  bld->paint ( fullSizeImage, SPoint(0,0), actmap->getPlayer( selection.getPlayer()).getPlayerColor() );
225  else
226  bld->paint ( fullSizeImage, SPoint(0,0) );
227 
229  blitter.setZoom( 0.5 );
230  blitter.blit( fullSizeImage, s, pos );
231 }
232 
233 
234 
235 // template<> Surface BasicItem<ObjectType>::clippingSurface;
236 int ObjectItem::place( const MapCoordinate& mc ) const
237 {
238  if ( !actmap->getField(mc)->addobject( item ) )
239  if ( SDL_GetKeyState(NULL)[SDLK_LCTRL] || SDL_GetKeyState(NULL)[SDLK_RCTRL] || choice_dlg("object cannot be built here\n(bypass this dialog by pressing <ctrl>)","~c~ancel","~i~gnore") == 2)
240  actmap->getField(mc)->addobject( item, -1, true );
241 
242  return 0;
243 }
244 
245 
246 bool ObjectItem::remove ( const MapCoordinate& mc ) const
247 {
248  if ( item && actmap->getField(mc)->checkForObject(item) ) {
249  actmap->getField(mc)->removeObject ( item );
250  return true;
251  }
252  return false;
253 
254 }
255 
256 
257 template<typename T> Surface BasicItem<T>::clippingSurface;
258 int TerrainItem::place( const MapCoordinate& mc ) const
259 {
260  MapField* fld = actmap->getField(mc);
261  fld->typ = item->weather[0];
262  fld->setWeather( selection.getWeather() );
263  fld->setparams();
264  for ( int d = 0; d < 6; ++d ) {
266  MapField* fld = actmap->getField( pos );
267  if ( fld )
268  for ( MapField::ObjectContainer::iterator i = fld->objects.begin(); i != fld->objects.end(); ++i )
269  calculateobject( pos, false, i->typ, actmap );
270  }
271  return 0;
272 }
273 
274 
275 int MineItem::place( const MapCoordinate& mc ) const
276 {
278  return 0;
279 }
280 
281 
282 
283 
284 
285 
286 
287 
288 
289 
290 
291 
292 
293 
294 
295 
296 
297 
298 
299 
300 
301 class CargoItemFactory: public MapItemTypeWidgetFactory<MapItemTypeWidget< VehicleType > > {
304  ContainerBase* container;
305  protected:
306  bool isFiltered( const ItemType& item ) {
307  if ( Parent::isFiltered( item ))
308  return true;
309 
310  if ( !container->baseType->vehicleFit( &item ))
311  return true;
312 
313  bool result = true;
314  Vehicle* unit = new Vehicle ( &item, actmap, container->getOwner() );
315  if ( container->doesVehicleFit ( unit ))
316  result = false;
317  delete unit;
318  return result;
319  };
320 
321  public:
322  CargoItemFactory( ContainerBase* container_ ) : Parent(vehicleTypeRepository), container( container_ ) {};
323 
324  void itemSelected( const SelectionWidget* widget, bool mouse )
325  {
326  if ( !widget )
327  return;
328 
329  const WidgetType* mapItemWidget = dynamic_cast<const WidgetType*>(widget);
330  assert( mapItemWidget );
331  if ( mapItemWidget->getItem() ) {
332  Vehicle* unit = new Vehicle ( mapItemWidget->getItem(), actmap, container->getOwner() );
333  unit->fillMagically();
334  unit->setnewposition ( container->getPosition() );
335  unit->tank.material = 0;
336  unit->tank.fuel = 0;
337  if ( container->doesVehicleFit ( unit )) {
338  unit->tank.material = unit->getStorageCapacity().material;
339  unit->tank.fuel = unit->getStorageCapacity().fuel;
340 
341  if ( !container->doesVehicleFit ( unit )) {
342  unit->tank.material = 0;
343  unit->tank.fuel = 0;
344  displaymessage("Warning:\nThe unit you just set could not be loaded with full material and fuel\nPlease set these values manually",1);
345  }
346  container->addToCargo( unit );
347 
348  } else {
349  delete unit;
350  displaymessage("The unit could not be loaded !",1);
351  }
352  }
353  }
354 
355 };
356 
357 
358 void addCargo( ContainerBase* container )
359 {
360  ItemSelectorWindow isw( NULL, PG_Rect( 100, 100, 280, 600), "cargo", new CargoItemFactory( container ) );
361  isw.Show();
362  isw.RunModal();
363 }
364 
365 
366 
367 
368 
369 class ProductionItemFactory: public MapItemTypeWidgetFactory<MapItemTypeWidget< VehicleType > > {
372  ContainerBase* container;
373  const VehicleType* selectedItem;
374  protected:
375  bool isFiltered( const ItemType& item ) {
376  if ( Parent::isFiltered( item ))
377  return true;
378 
379  if ( !container->baseType->vehicleFit( &item ))
380  return true;
381 
382  if ( !(container->baseType->vehicleCategoriesProduceable & (1 << item.movemalustyp)))
383  return true;
384 
385  return false;
386  };
387 
388  public:
389  ProductionItemFactory( ContainerBase* container_ ) : Parent(vehicleTypeRepository), container( container_ ), selectedItem(NULL) {};
390 
391 
392  void itemMarked ( const SelectionWidget* widget )
393  {
394  if ( !widget )
395  return;
396 
397  const WidgetType* mapItemWidget = dynamic_cast<const WidgetType*>(widget);
398  assert( mapItemWidget );
399  const VehicleType* type = mapItemWidget->getItem();
400  if ( type ) {
401  selectedItem = type;
402  }
403  };
404 
405  void itemSelected( const SelectionWidget* widget, bool mouse )
406  {
407  itemMarked( widget );
408  }
409 
411  {
412  return selectedItem;
413  }
414 
415 };
416 
417 
418 class AvailableProductionItemFactory: public SelectionItemFactory, public sigc::trackable {
419  private:
420  const ContainerBase* container;
421  const VehicleType* selectedItem;
422  protected:
423  ContainerBase::Production::const_iterator it;
425  public:
426  AvailableProductionItemFactory( ContainerBase* container_, ContainerBase::Production& prod ) : container( container_ ), selectedItem(NULL), production( prod )
427  {
428  restart();
429  };
430 
431  void restart()
432  {
433  // sort( items.begin(), items.end(), VehicleComp );
434  it = production.begin();
435  }
436 
437  SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos )
438  {
439  if ( it != production.end() ) {
440  const VehicleType* v = *(it++);
441  return new VehicleTypeBaseWidget( parent, pos, parent->Width() - 15, v, actmap->getCurrentPlayer() );
442  } else
443  return NULL;
444  };
445 
446  void itemMarked ( const SelectionWidget* widget )
447  {
448  if ( !widget )
449  return;
450 
451  const VehicleTypeBaseWidget* mapItemWidget = dynamic_cast<const VehicleTypeBaseWidget*>(widget);
452  assert( mapItemWidget );
453  const VehicleType* type = mapItemWidget->getVehicletype();
454  if ( type ) {
455  selectedItem = type;
456  }
457  }
458 
459 
460  void itemSelected( const SelectionWidget* widget, bool mouse )
461  {
462  itemMarked( widget );
463  }
464 
466  {
467  return selectedItem;
468  }
469 
470 };
471 
472 
473 
475  private:
476  ProductionItemFactory* allTypesFactory;
477  ItemSelectorWidget* allTypes;
478 
479  AvailableProductionItemFactory* productionFactory;
480  ItemSelectorWidget* productionWidget;
481 
482 
483  ContainerBase* container;
484 
485  ContainerBase::Production production;
486 
487 
488  bool ok()
489  {
490  container->setProductionLines( production );
491  QuitModal();
492  return true;
493  }
494 
495  bool addOne()
496  {
497  const VehicleType* v = allTypesFactory->getSelectedVehicleType();
498  if ( !v )
499  return false;
500 
501  if ( find( production.begin(), production.end(), v ) == production.end() ) {
502  production.push_back( v );
503  productionWidget->reLoad( true );
504  return true;
505  }
506  return false;
507  }
508 
509  bool removeOne()
510  {
511  const VehicleType* v = productionFactory->getSelectedVehicleType();
512  if ( !v )
513  return false;
514 
515  ContainerBase::Production::iterator i = find( production.begin(), production.end(), v );
516  if ( i != production.end() ) {
517  production.erase( i );
518  productionWidget->reLoad( true );
519  return true;
520  }
521  return false;
522  }
523 
524 
525  public:
526  ProductionEditorWindow ( ContainerBase* container ) : ASC_PG_Dialog ( NULL, PG_Rect( 20,20, 700, 550 ), "Unit Production" )
527  {
528  this->container = container;
529  production = container->getProduction();
530 
531  const int centerSpace = 80;
532  const int border = 10;
533 
534  allTypesFactory = new ProductionItemFactory( container );
535  allTypes = new ItemSelectorWidget( this, PG_Rect( border, 50, (my_width- centerSpace) / 2 - 2 * border, my_height - 100 ), allTypesFactory );
536 
537  productionFactory = new AvailableProductionItemFactory( container, production );
538  productionWidget = new ItemSelectorWidget( this, PG_Rect( (my_width + centerSpace) / 2 + border, 50, (my_width- centerSpace) / 2 - 2 * border, my_height - 100 ), productionFactory);
539 
540 
541 
542  PG_Button* addB = new PG_Button( this, PG_Rect( (my_width - centerSpace) / 2, 100, centerSpace, 30 ), "->" );
543  addB->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &ProductionEditorWindow::addOne )));
544 
545  PG_Button* removeB = new PG_Button( this, PG_Rect( (my_width - centerSpace) / 2, 140, centerSpace, 30 ), "<-" );
546  removeB->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &ProductionEditorWindow::removeOne )));
547 
548 
549  PG_Button* ok = new PG_Button( this, PG_Rect( my_width - 100, my_height - 40, 90, 30 ), "OK" );
550  ok->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &ProductionEditorWindow::ok )));
551  };
552 
553 };
554 
555 
556 void editProduction( ContainerBase* container )
557 {
558  ProductionEditorWindow pew ( container );
559  pew.Show();
560  pew.RunModal();
561 }
562 
TerrainType::Weather * typ
the terraintype of the field
Definition: mapfield.h:38
int fuel
Definition: typen.h:101
Player & getCurrentPlayer()
Definition: gamemap.h:268
bool isFiltered(const ItemType &item)
Definition: edselfnt.cpp:306
void reLoad(bool show=false)
The type of a field.
Definition: terraintype.h:75
int getPlayer()
Definition: edglobal.h:162
Player & getPlayer(PlayerID p)
Definition: gamemap.h:257
MapCoordinate & getCursor()
Definition: gamemap.cpp:933
MapCoordinate getFieldCoordinate(const MapCoordinate &entryOnMap, const LocalCoordinate &localCoordinate) const
returns the Mapcoordinate of a buildings field
bool putmine(int owner, MineTypes typ, int strength)
put a mine of type typ for player owner and a punch of strength on the field. Strength is an absolute...
Definition: mapfield.cpp:441
void fillMagically(bool ammo=true, bool resources=true)
fills a unit with all resources it can carry This function should only be called in the mapeditor ! ...
Definition: vehicle.cpp:1075
Vehicle * vehicle
Definition: mapfield.h:89
ASCString name
Definition: terraintype.h:82
void setnewposition(int x, int y)
checks whether the unit can construct a building of the given type.
Definition: vehicle.cpp:808
virtual int place(const MapCoordinate &mc) const
Definition: edselfnt.cpp:193
void blit(const Surface &src, Surface &dst, SPoint dstPos)
Definition: blitter.h:349
void itemSelected(const SelectionWidget *widget, bool mouse)
Definition: edselfnt.cpp:460
Resources getStorageCapacity() const
returns the local storage capacity for the given resource, which depends on the resource mode of the ...
Weather * weather[cwettertypennum]
Definition: terraintype.h:140
int getOwner() const
returns the number of the player this vehicle/building belongs to
A local coordinate referencing a single field that a building covers.
Definition: buildingtype.h:57
bool objectComp(const ObjectType *v1, const ObjectType *v2)
Definition: edselfnt.cpp:56
int id
Definition: objects.h:75
SelectionWidget * spawnNextItem(PG_Widget *parent, const PG_Point &pos)
Definition: edselfnt.cpp:437
bool vehicleComp(const VehicleType *v1, const VehicleType *v2)
Definition: unitset.cpp:234
static Surface createSurface(int width, int height, SDLmm::Color color=255)
Definition: surface.cpp:387
virtual Surface & getClippingSurface() const =0
void FillTransparent()
Definition: surface.cpp:419
virtual int displayHeight() const
bool vehicleFit(const VehicleType *type) const
can units of the given type be moved into this buildtype? This is a prerequisite - but not the only r...
void calculateobject(const MapCoordinate &pos, bool mof, const ObjectType *obj, GameMap *gamemap)
Definition: spfst.cpp:462
int getWeather()
Definition: edglobal.h:167
a single field of the map
Definition: mapfield.h:26
void displayClip(PG_Widget *parent, SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst) const
Definition: edselfnt.cpp:101
sigc::signal< void > filtersChangedSignal
Definition: edselfnt.cpp:42
void sortItems(vector< VehicleType * > &vec)
Definition: edselfnt.cpp:75
TerrainBits art
the properties defining which unit can move onto this field and which not
Definition: terraintype.h:125
void itemSelected(const SelectionWidget *widget, bool mouse)
Definition: edselfnt.cpp:405
const VehicleType * item
const Production & getProduction() const
virtual int place(const MapCoordinate &mc) const
Definition: edselfnt.cpp:275
virtual int place(const MapCoordinate &mc) const
Definition: edselfnt.cpp:186
int height
the current level of height ( BITMAPPED ! )
Definition: vehicle.h:118
virtual void display(Surface &s, const SPoint &pos) const
Definition: edselfnt.cpp:218
bool isFiltered(const ItemType &item)
Definition: edselfnt.cpp:375
MineTypes
Definition: objects.h:70
bool fieldExists(const LocalCoordinate &localCoordinate) const
returns whether this building covers the given field
Definition: buildingtype.h:108
The class describing properties that are common to all vehicles of a certain kind.
Definition: vehicletype.h:177
int terrainaccessible(const MapField *field, const Vehicle *vehicle, int uheight)
Checks if the unit can drive on the field.
Definition: spfst.cpp:70
void addCargo(ContainerBase *container)
Lets the user choose a unit and adds it to the cargo of container.
Definition: edselfnt.cpp:358
The class describing properties that are common to all buildings of a certain kind.
Definition: buildingtype.h:35
virtual ASCString getName() const
ItemRepositoryLoader< VehicleType > vehicleTypeRepository("vehicletype")
int vehicleCategoriesProduceable
bitmapped: vehicle categories that can be produced in the container
ContainerBase::Production & production
Definition: edselfnt.cpp:424
#define chtieffliegend
Definition: typen.h:414
An object that can be placed on fields. Roads, pipelines and ditches are examples of objects...
Definition: objecttype.h:30
Coordinate on the twodimensional map.
Definition: typen.h:202
A MapItemTypeWidget show any kind of MapItemType in a SelectionWidget It is typically generated by a ...
Definition: edselfnt.h:56
Adapter class for using Paragui Dialogs in ASC. This class transfers the event control from ASC to Pa...
Definition: paradialog.h:127
int movemalustyp
The category of the unit. Original used only to distinguish only between different movement costs for...
Definition: vehicletype.h:206
void setparams(ObjectRemovalStrategy *objectRemovalStrategy)
recalculates the terrain properties, movemalus etc from the terraintype and the objects,
Definition: mapfield.cpp:605
void displaymessage(const char *formatstring, int num,...)
displays a dialog box with a message
Definition: dlg_box.cpp:1849
Dialog classes based on the Paragui library.
The interface for the buildingtype class.
bool terrainComp(const TerrainType *v1, const TerrainType *v2)
Definition: edselfnt.cpp:61
void paint(Surface &s, SPoint pos, const PlayerColor &player, int weather=0, int constructionStep=0) const
const int MineBasePunch[cminenum]
Definition: objects.cpp:39
int accessible(const TerrainBits &bts) const
checks whether a field with the given terrainbits is accessible.
bool mineComp(const MineType *v1, const MineType *v2)
Definition: edselfnt.cpp:69
virtual int displayHeight() const =0
bool addobject(const ObjectType *obj, int dir=-1, bool force=false, ObjectRemovalStrategy *objectRemovalStrategy=NULL)
add an object to the field
Definition: mapfield.cpp:212
int material
Definition: typen.h:100
ProductionItemFactory(ContainerBase *container_)
Definition: edselfnt.cpp:389
int getUnitSetID(const VehicleType *veh)
Definition: unitset.cpp:216
TerrainAccess terrainaccess
the terrain properties which are necessary for the building to be constructed there ...
Definition: buildingtype.h:86
const VehicleType * getSelectedVehicleType()
Definition: edselfnt.cpp:465
void putbuilding(GameMap *actmap, const MapCoordinate &entryPosition, int color, const BuildingType *buildingtyp, int completion, int ignoreunits)
puts a building onto the map. To be used by the map editor! For ingame usage, see ConstructBuildingCo...
Definition: spfst.cpp:210
CargoItemFactory(ContainerBase *container_)
Definition: edselfnt.cpp:322
SDLmm::SPoint SPoint
Definition: surface.h:27
virtual bool remove(const MapCoordinate &mc) const
Definition: edselfnt.cpp:246
TerrainBits bdt
the terraintype properties. They determine which units can move over the field. This variable is reca...
Definition: mapfield.h:161
ContainerBase::Production::const_iterator it
Definition: edselfnt.cpp:423
ProductionEditorWindow(ContainerBase *container)
Definition: edselfnt.cpp:526
SelectionHolder selection
Definition: edglobal.cpp:189
const VehicleType * getVehicletype() const
int getgameparameter(GameParameter num) const
Definition: gamemap.cpp:1047
int height
the levels of height which this unit can enter
virtual int displayWidth() const =0
Adds selection logic to a BaseMapItemTypeWidgetFactory. Selected items are registered as being the ac...
Definition: edselfnt.h:142
static const int fontHeight
bool doesVehicleFit(const Vehicle *vehicle) const
Does the vehicle fit into the container? This does not include checking if it can reach the entry...
void setWeather(int weather)
Definition: mapfield.cpp:380
void convert(int player, bool recursive=true)
converts the unit so it is owned by 'player'.
Definition: vehicle.cpp:843
vector< const VehicleType * > Production
Definition: containerbase.h:87
int construction_steps
the number of stages that are required to construct a building using a construction unit...
Definition: buildingtype.h:89
void addToCargo(Vehicle *veh, int position=-1)
adds the unit to the cargo
const VehicleType * typ
Definition: vehicle.h:83
void itemMarked(const SelectionWidget *widget)
Definition: edselfnt.cpp:446
Building * building
Definition: mapfield.h:102
void editProduction(ContainerBase *container)
Definition: edselfnt.cpp:556
const ContainerBaseType * baseType
the type descriping all non-instance specific properties of the container
Definition: containerbase.h:80
virtual void display(Surface &s, const SPoint &pos) const =0
virtual int place(const MapCoordinate &mc) const
Definition: edselfnt.cpp:258
GameMap * actmap
Definition: spfst.cpp:64
const ItemType * getItem() const
Definition: edselfnt.h:71
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
AvailableProductionItemFactory(ContainerBase *container_, ContainerBase::Production &prod)
Definition: edselfnt.cpp:426
bool buildingComp(const BuildingType *v1, const BuildingType *v2)
Definition: edselfnt.cpp:48
void itemSelected(const SelectionWidget *widget, bool mouse)
Definition: edselfnt.cpp:324
int choice_dlg(const ASCString &title, const ASCString &leftButton, const ASCString &rightButton)
Definition: dialog.cpp:616
const MapItemType * getItemType() const
virtual int place(const MapCoordinate &mc) const
Definition: edselfnt.cpp:236
void resetMovement(void)
resets a units movement. This is called at the beginning of each turn.
Definition: vehicle.cpp:518
Object * checkForObject(const ObjectType *o)
checks if there are objects from the given type on the field and returns them
Definition: mapfield.cpp:648
bool removeObject(const ObjectType *obj, bool force=false, ObjectRemovalStrategy *objectRemovalStrategy=NULL)
removes all objects of the given type from the field
Definition: mapfield.cpp:256
virtual int displayWidth() const
TerrainAccess terrainaccess
the terrain this unit can move to
Definition: vehicletype.h:221
void itemMarked(const SelectionWidget *widget)
Definition: edselfnt.cpp:392
const VehicleType * getSelectedVehicleType()
Definition: edselfnt.cpp:410
ASCString name
a short name, for example B-52
MapCoordinate3D getNeighbouringFieldCoordinate(const MapCoordinate3D &pos, int direc)
returns the coordinate of the field that is adjecent to the given field in the direction of direc ...
ObjectContainer objects
Definition: mapfield.h:124
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
void setProductionLines(const Production &production)
MapField * getField(int x, int y)
Definition: gamemap.h:465
ASCString name
The name of the object.
Definition: objecttype.h:122
virtual MapCoordinate3D getPosition() const =0