summaryrefslogtreecommitdiff
path: root/plugins/weather.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2012-02-22 15:21:29 +0100
committerPetr Mrázek2012-02-22 15:21:29 +0100
commit8ee27e182a2e2935dea0cd0da8fc451cdb3aff05 (patch)
treeda3b162dfe87c650c9d9f82130a181df382839d1 /plugins/weather.cpp
parent34c9c2d663198ce33a270bfa84332684d4cba22b (diff)
downloaddfhack-8ee27e182a2e2935dea0cd0da8fc451cdb3aff05.tar.gz
dfhack-8ee27e182a2e2935dea0cd0da8fc451cdb3aff05.tar.bz2
dfhack-8ee27e182a2e2935dea0cd0da8fc451cdb3aff05.tar.xz
Hidden weather command raw value override
Diffstat (limited to 'plugins/weather.cpp')
-rw-r--r--plugins/weather.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/weather.cpp b/plugins/weather.cpp
index 6490bae1..d6d83cfa 100644
--- a/plugins/weather.cpp
+++ b/plugins/weather.cpp
@@ -40,6 +40,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
command_result weather (Core * c, vector <string> & parameters)
{
Console & con = c->con;
+ int val_override = -1;
bool lock = false;
bool unlock = false;
bool snow = false;
@@ -58,7 +59,11 @@ command_result weather (Core * c, vector <string> & parameters)
else if(parameters[i] == "unlock")
unlock = true;
else
- return CR_WRONG_USAGE;
+ {
+ val_override = atoi(parameters[i].c_str());
+ if(val_override == 0)
+ return CR_WRONG_USAGE;
+ }
}
if(lock && unlock)
{
@@ -74,7 +79,7 @@ command_result weather (Core * c, vector <string> & parameters)
con << "Rain, snow or clear sky? DECIDE!" << std::endl;
return CR_FAILURE;
}
- bool something = lock || unlock || rain || snow || clear;
+ bool something = lock || unlock || rain || snow || clear || val_override != -1;
CoreSuspender suspend(c);
DFHack::World * w = c->getWorld();
@@ -128,6 +133,11 @@ command_result weather (Core * c, vector <string> & parameters)
con << "Suddenly, sunny weather!" << std::endl;
w->SetCurrentWeather(CLEAR);
}
+ if(val_override != -1)
+ {
+ con << "I have no damn idea what this is... " << val_override << std::endl;
+ w->SetCurrentWeather(val_override);
+ }
// FIXME: weather lock needs map ID to work reliably... needs to be implemented.
}
return CR_OK;