1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
/***************************************************************************
cargodialog.cpp - description
-------------------
begin : Tue Oct 24 2000
copyright : (C) 2000 by Martin Bickel
email : bickel@asc-hq.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef buildingtypeselectorH
#define buildingtypeselectorH
#include <pgimage.h>
#include "selectionwindow.h"
#include "../buildingtype.h"
#include "../paradialog.h"
class BuildingTypeBaseWidget: public SelectionWidget {
const BuildingType* vt;
static Surface clippingSurface;
Surface& getClippingSurface() { return clippingSurface; };
const Player& actplayer;
public:
BuildingTypeBaseWidget( PG_Widget* parent, const PG_Point& pos, int width, const BuildingType* BuildingType, const Player& player );
ASCString getName() const;
const BuildingType* getBuildingType() const { return vt; };
protected:
void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst );
static int getBuildingHeight( const BuildingType* type );
};
class BuildingTypeResourceWidget: public BuildingTypeBaseWidget {
public:
BuildingTypeResourceWidget( PG_Widget* parent, const PG_Point& pos, int width, const BuildingType* BuildingType, int lackingResources, const Resources& cost, const Player& player );
};
class BuildingTypeCountWidget: public BuildingTypeBaseWidget {
public:
BuildingTypeCountWidget( PG_Widget* parent, const PG_Point& pos, int width, const BuildingType* BuildingType, const Player& player, int number );
};
class BuildingTypeSelectionItemFactory: public SelectionItemFactory, public sigc::trackable {
Resources plantResources;
const Player& actplayer;
public:
typedef vector<const BuildingType*> Container;
protected:
Container::iterator it;
Container items;
virtual void BuildingTypeSelected( const BuildingType* type ) = 0;
virtual Resources getCost( const BuildingType* type );
private:
const Container& original_items;
public:
BuildingTypeSelectionItemFactory( Resources plantResources, const Container& types, const Player& player );
sigc::signal<void> reloadAllItems;
void restart();
void setAvailableResource( const Resources& plantResources ) { this->plantResources = plantResources; };
SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
void itemSelected( const SelectionWidget* widget, bool mouse );
};
bool BuildingComp ( const BuildingType* v1, const BuildingType* v2 );
#endif
|