00001 // 00002 // C++ Interface: weatherdialog 00003 // 00004 // Description: 00005 // 00006 // 00007 // Author: Martin Bickel <bickel@asc-hq.org>, (C) 2004 00008 // 00009 // Copyright: See COPYING file that comes with this distribution 00010 // 00011 // 00012 #ifndef WEATHERDIALOG_H 00013 #define WEATHERDIALOG_H 00014 00015 #include <sstream> 00016 #include "global.h" 00017 #include "paradialog.h" 00018 #include "weatherdialog.h" 00019 #include "weatherarea.h" 00020 #include "events.h" 00021 #include "gameoptions.h" 00022 #include "sdl/sound.h" 00023 00027 class ChanceSettingsDialog : public ASC_PG_Dialog { 00028 public: 00029 ChanceSettingsDialog(std::string title); 00030 00031 virtual ~ChanceSettingsDialog(); 00032 00033 virtual bool closeWindow() { 00034 quitModalLoop(2); 00035 return true; 00036 }; 00037 00038 protected: 00039 virtual void buildUpForm(const vector<string>& labelVec); 00040 private: 00041 virtual bool buttonEvent( PG_Button* button ) = 0; 00042 virtual int getNthChanceValue(int n) = 0; 00043 virtual void setChanceValues(const vector<PG_LineEdit*>& p)= 0; 00044 00045 protected: 00046 vector<PG_LineEdit*> chances; 00047 vector<PG_Label*> labels; 00048 PG_Label* note; 00049 static const int xsize; 00050 static const int ysize; 00051 }; 00052 00053 class FallOutSettingsDialog: public ChanceSettingsDialog { 00054 virtual int getNthChanceValue(int n); 00055 virtual void setChanceValues(const vector<PG_LineEdit*>& p); 00056 virtual bool buttonEvent( PG_Button* button ); 00057 00058 00059 public: 00060 FallOutSettingsDialog(); 00061 ~FallOutSettingsDialog(); 00062 }; 00063 00064 class WindSpeedSettingsDialog: public ChanceSettingsDialog { 00065 virtual int getNthChanceValue(int n); 00066 virtual void setChanceValues(const vector<PG_LineEdit*>& p); 00067 virtual bool buttonEvent( PG_Button* button ); 00068 00069 00070 public: 00071 WindSpeedSettingsDialog(); 00072 ~WindSpeedSettingsDialog(); 00073 }; 00074 00075 class WindDirectionSettingsDialog: public ChanceSettingsDialog { 00076 virtual int getNthChanceValue(int n); 00077 virtual void setChanceValues(const vector<PG_LineEdit*>& p); 00078 virtual bool buttonEvent( PG_Button* button ); 00079 00080 00081 public: 00082 WindDirectionSettingsDialog(); 00083 ~WindDirectionSettingsDialog(); 00084 }; 00085 00086 class WeatherAreaInformation{ 00087 private: 00088 WeatherArea* weatherArea; 00089 GameTime time; 00090 int duration; 00091 FalloutType fallOut; 00092 public: 00093 WeatherAreaInformation(WeatherArea* wa, GameTime time, int duration, FalloutType fallOut); 00094 WeatherAreaInformation(WeatherArea* wa, GameTime time); 00095 ~WeatherAreaInformation(); 00096 00097 GameTime getTriggerTime() const; 00098 int getDuration() const; 00099 FalloutType getFalloutType() const; 00100 WeatherArea* getWeatherArea(){ 00101 return weatherArea; 00102 } 00103 std::string getInformation() const; 00104 00105 }; 00106 class EventAreasDialog: public ASC_PG_Dialog{ 00107 00108 public: 00109 EventAreasDialog(); 00110 ~EventAreasDialog(); 00111 void addNewWeatherAreaInformation(WeatherAreaInformation* wai); 00112 00113 bool closeWindow(); 00114 00115 private: 00116 static const int xSize; 00117 static const int ySize; 00118 static const string SEPERATOR; 00119 list<WeatherAreaInformation*> currentList; 00120 list<WeatherAreaInformation*> removeList; 00121 list<WeatherAreaInformation*> addList; 00122 00123 PG_ListBox* eventList; 00124 PG_Button* addButton; 00125 PG_Button* removeButton; 00126 bool buttonEvent( PG_Button* button ); 00127 00128 bool buttonAdd( PG_Button* button ); 00129 bool buttonRemove( PG_Button* button ); 00130 00131 void updateAreaList(); 00132 }; 00133 00134 class WindInformation{ 00135 private: 00136 WindData data; 00137 int turn; 00138 public: 00139 WindInformation(WindData data, int turn); 00140 ~WindInformation(); 00141 00142 int getTurn() const; 00143 WindData getWindData() const; 00144 std::string getInformation() const; 00145 00146 00147 }; 00148 00149 00150 class EventWindChangesDialog: public ASC_PG_Dialog{ 00151 00152 public: 00153 EventWindChangesDialog(); 00154 ~EventWindChangesDialog(); 00155 void addNewWindInformation(WindInformation* wi); 00156 00157 bool closeWindow(); 00158 00159 private: 00160 static const int xSize; 00161 static const int ySize; 00162 static const string SEPERATOR; 00163 list<WindInformation*> currentList; 00164 list<WindInformation*> addList; 00165 00166 PG_ListBox* eventList; 00167 PG_Button* addButton; 00168 PG_Button* removeButton; 00169 bool buttonEvent( PG_Button* button ); 00170 00171 bool buttonAdd( PG_Button* button ); 00172 bool buttonRemove( PG_Button* button ); 00173 00174 void updateWindChangeList(); 00175 }; 00176 00177 class AddWindChangeDialog: public ASC_PG_Dialog{ 00178 public: 00179 AddWindChangeDialog(EventWindChangesDialog* ead); 00180 ~AddWindChangeDialog(); 00181 00182 00183 private: 00184 static const int xSize; 00185 static const int ySize; 00186 00187 PG_Label* turnLabel; 00188 PG_LineEdit* turnValue; 00189 00190 PG_Label* directionLabel; 00191 PG_DropDown* directionBox; 00192 00193 PG_Label* speedLabel; 00194 PG_LineEdit* speedValue; 00195 00196 bool buttonEvent( PG_Button* button ); 00197 bool closeWindow(); 00198 }; 00199 00200 class AddWeatherAreaDialog: public ASC_PG_Dialog{ 00201 public: 00202 AddWeatherAreaDialog(EventAreasDialog* ead); 00203 ~AddWeatherAreaDialog(); 00204 00205 00206 private: 00207 static const int xSize; 00208 static const int ySize; 00209 00210 PG_Label* turnLabel; 00211 PG_LineEdit* turnValue; 00212 00213 PG_Label* durationLabel; 00214 PG_LineEdit* durationValue; 00215 00216 PG_Label* xCoordLabel; 00217 PG_LineEdit* xCoordValue; 00218 00219 PG_Label* yCoordLabel; 00220 PG_LineEdit* yCoordValue; 00221 00222 PG_Label* widthLabel; 00223 PG_LineEdit* widthValue; 00224 00225 PG_Label* heightLabel; 00226 PG_LineEdit* heightValue; 00227 00228 PG_CheckButton* clusteredMode; 00229 00230 PG_Label* wTypesLabel; 00231 PG_DropDown* weatherTypes; 00232 00233 bool closeWindow(); 00234 bool buttonEvent( PG_Button* button ); 00235 }; 00236 00237 00238 00239 00243 class WeatherDialog : public ASC_PG_Dialog { 00244 public: 00245 WeatherDialog(); 00246 00247 virtual ~WeatherDialog(); 00248 00249 00250 private: 00251 static const int xsize; 00252 static const int ysize; 00253 00254 PG_CheckButton* randomMode; 00255 PG_CheckButton* seedMode; 00256 00257 PG_Label* defaultWeatherLabel; 00258 PG_DropDown* weatherTypes; 00259 00260 PG_Label* areaSpawnsLabel; 00261 PG_LineEdit* areaSpawnsValue; 00262 00263 PG_Label* nthTurnLabel; 00264 PG_LineEdit* nthTurnValue; 00265 00266 PG_Label* windSpeedFieldRatioLabel; 00267 PG_LineEdit* windSpeedFieldRatioValue; 00268 00269 PG_Label* upperSizeLimitsLabel; 00270 PG_LineEdit* upperSizeLimitsValue; 00271 00272 PG_Label* lowerSizeLimitsLabel; 00273 PG_LineEdit* lowerSizeLimitsValue; 00274 00275 PG_Label* lowerDurationLimitLabel; 00276 PG_LineEdit* lowerDurationLimitValue; 00277 00278 PG_Label* upperDurationLimitLabel; 00279 PG_LineEdit* upperDurationLimitValue; 00280 00281 PG_Label* fallOutLabel; 00282 PG_Button* fallOutButton; 00283 00284 PG_Label* windSpeedLabel; 00285 PG_Button* windSpeedButton; 00286 00287 PG_Label* windDirectionLabel; 00288 PG_Button* windDirectionButton; 00289 00290 PG_Label* eventAreasLabel; 00291 PG_Button* eventAreasButton; 00292 00293 PG_Label* eventWindChangesLabel; 00294 PG_Button* eventWindChangesButton; 00295 00296 bool editEventAreas(PG_Button* button ); 00297 bool editEventWindChanges(PG_Button* button ); 00298 bool editFallOut( PG_Button* button ); 00299 bool editWindSpeed( PG_Button* button ); 00300 bool editWindDirection( PG_Button* button ); 00301 00302 bool buttonEvent( PG_Button* button ); 00303 00304 bool closeWindow() { 00305 quitModalLoop(2); 00306 return true; 00307 }; 00308 }; 00309 00310 extern void weatherConfigurationDialog(); 00311 00312 #endif 00313 00314 00315
1.4.2