00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef commonH
00023 #define commonH
00024
00025 #include "../typen.h"
00026
00027 #include "../paradialog.h"
00028
00029 class GameMap;
00030 class ObjectType;
00031 class BuildingType;
00032 class VehicleType;
00033 class TerrainType;
00034
00035 extern GameMap* getActiveMap();
00036
00037 extern const ObjectType* getObjectType( int id );
00038 extern const BuildingType* getBuildingType( int id );
00039 extern const VehicleType* getUnitType( int id );
00040 extern const TerrainType* getTerrainType( int id );
00041
00042 class StringArray {
00043 public:
00044 vector<ASCString> values;
00045 StringArray(){};
00046 void add( const ASCString& s ) { values.push_back( s ); };
00047 ASCString getItem( int n )
00048 {
00049 return (n> 0 && n <= values.size()) ? values[n-1] : ASCString();
00050 }
00051 int size() { return values.size(); };
00052 };
00053
00054 class PropertyDialog : public ASC_PG_Dialog {
00055 private:
00056 PG_PropertyEditor* propertyEditor;
00057 bool result;
00058
00059 bool ok();
00060 bool cancel();
00061
00062 map<ASCString,bool> boolValues;
00063 map<ASCString,int> intValues;
00064 map<ASCString,ASCString> stringValues;
00065
00066 void setup();
00067
00068 public:
00069 PropertyDialog( const ASCString& title );
00070 PropertyDialog( const ASCString& title, const PG_Rect& size );
00071 void addBool( const ASCString& name, bool defaultValue );
00072 void addInteger( const ASCString& name, int defaultValue );
00073 void addIntDropdown ( const ASCString& name, const StringArray& names, int defaultValue );
00074 void addString( const ASCString& name, const ASCString& defaultValue );
00075
00076 std::string getString( const ASCString& name );
00077 int getInteger( const ASCString& name );
00078 bool getBool( const ASCString& name );
00079 bool run();
00080 };
00081
00082 extern int selectString ( const ASCString& title, const StringArray& entries, int defaultEntry = -1 );
00083
00084 extern GameMap* getLoadingMap();
00085
00086 extern void setLocalizedEventMessage( GameMap* map, int eventID, const ASCString& message );
00087 extern void setLocalizedContainerName( GameMap* map, const MapCoordinate& pos, const std::string& name );
00088
00089 extern MapCoordinate getCursorPosition( const GameMap* gamemap );
00090
00091 extern void setCursorPosition( const GameMap* gamemap, const MapCoordinate& pos );
00092
00093 extern void assertSuccess( const ActionResult& result );
00094
00095 #endif
00096