summaryrefslogtreecommitdiff
path: root/plugins/weather.cpp
diff options
context:
space:
mode:
authorQuietust2012-05-23 12:51:03 -0500
committerQuietust2012-05-23 12:51:03 -0500
commit9a73ea9f14900f8b6fb132f4c0e242f0c4d5a262 (patch)
treed931d66825412a6abae782621a28958a2be3fab3 /plugins/weather.cpp
parent20794ebf191d21d5acce274d70bdad4012deaa44 (diff)
downloaddfhack-9a73ea9f14900f8b6fb132f4c0e242f0c4d5a262.tar.gz
dfhack-9a73ea9f14900f8b6fb132f4c0e242f0c4d5a262.tar.bz2
dfhack-9a73ea9f14900f8b6fb132f4c0e242f0c4d5a262.tar.xz
Cleanup World module to use df::global, and fix crashes when control_mode/game_mode are missing
Diffstat (limited to 'plugins/weather.cpp')
-rw-r--r--plugins/weather.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/plugins/weather.cpp b/plugins/weather.cpp
index 68eb078a..33fa45fd 100644
--- a/plugins/weather.cpp
+++ b/plugins/weather.cpp
@@ -5,10 +5,13 @@
#include <vector>
#include <string>
#include "modules/World.h"
+#include "DataDefs.h"
+#include "df/weather_type.h"
using std::vector;
using std::string;
using namespace DFHack;
+using namespace df::enums;
bool locked = false;
unsigned char locked_data[25];
@@ -82,7 +85,7 @@ command_result weather (color_ostream &con, vector <string> & parameters)
CoreSuspender suspend;
DFHack::World * w = Core::getInstance().getWorld();
- if(!w->wmap)
+ if(!df::global::current_weather)
{
con << "Weather support seems broken :(" << std::endl;
return CR_FAILURE;
@@ -95,19 +98,19 @@ command_result weather (color_ostream &con, vector <string> & parameters)
{
for(int x = 0; x<5;x++)
{
- switch((*w->wmap)[x][y])
+ switch((*df::global::current_weather)[x][y])
{
- case CLEAR:
+ case weather_type::None:
con << "C ";
break;
- case RAINING:
+ case weather_type::Rain:
con << "R ";
break;
- case SNOWING:
+ case weather_type::Snow:
con << "S ";
break;
default:
- con << (int) (*w->wmap)[x][y] << " ";
+ con << (int) (*df::global::current_weather)[x][y] << " ";
break;
}
}
@@ -120,17 +123,17 @@ command_result weather (color_ostream &con, vector <string> & parameters)
if(rain)
{
con << "Here comes the rain." << std::endl;
- w->SetCurrentWeather(RAINING);
+ w->SetCurrentWeather(weather_type::Rain);
}
if(snow)
{
con << "Snow everywhere!" << std::endl;
- w->SetCurrentWeather(SNOWING);
+ w->SetCurrentWeather(weather_type::Snow);
}
if(clear)
{
con << "Suddenly, sunny weather!" << std::endl;
- w->SetCurrentWeather(CLEAR);
+ w->SetCurrentWeather(weather_type::None);
}
if(val_override != -1)
{