diff options
| author | Quietust | 2012-01-21 18:31:15 -0600 |
|---|---|---|
| committer | Quietust | 2012-01-21 18:31:15 -0600 |
| commit | 2cc6bcf0e97dbdf60492067cd71dc79432a35687 (patch) | |
| tree | e893504d15ef59e8803573f6f4483d2e3ec9ca34 /plugins/weather.cpp | |
| parent | ccf22bed10a78504701bbdb1f8177a16cf9ffdde (diff) | |
| download | dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.gz dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.bz2 dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.xz | |
Use CoreSuspender and namespace df::enums
Diffstat (limited to 'plugins/weather.cpp')
| -rw-r--r-- | plugins/weather.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/plugins/weather.cpp b/plugins/weather.cpp index efe4ecae..73eda774 100644 --- a/plugins/weather.cpp +++ b/plugins/weather.cpp @@ -59,11 +59,11 @@ DFhackCExport command_result weather (Core * c, vector <string> & parameters) if(help) { c->con.print("Prints the current weather map by default.\n" - "Options:\n" - "snow - make it snow everywhere.\n" - "rain - make it rain.\n" - "clear - clear the sky.\n" - ); + "Options:\n" + "snow - make it snow everywhere.\n" + "rain - make it rain.\n" + "clear - clear the sky.\n" + ); return CR_OK; } if(lock && unlock) @@ -81,12 +81,12 @@ DFhackCExport command_result weather (Core * c, vector <string> & parameters) return CR_FAILURE; } bool something = lock || unlock || rain || snow || clear; - c->Suspend(); + + CoreSuspender suspend(c); DFHack::World * w = c->getWorld(); if(!w->wmap) { con << "Weather support seems broken :(" << std::endl; - c->Resume(); return CR_FAILURE; } if(!something) @@ -99,18 +99,18 @@ DFhackCExport command_result weather (Core * c, vector <string> & parameters) { switch((*w->wmap)[x][y]) { - case DFHack::CLEAR: - con << "C "; - break; - case DFHack::RAINING: - con << "R "; - break; - case DFHack::SNOWING: - con << "S "; - break; - default: - con << (int) (*w->wmap)[x][y] << " "; - break; + case CLEAR: + con << "C "; + break; + case RAINING: + con << "R "; + break; + case SNOWING: + con << "S "; + break; + default: + con << (int) (*w->wmap)[x][y] << " "; + break; } } con << std::endl; @@ -136,6 +136,5 @@ DFhackCExport command_result weather (Core * c, vector <string> & parameters) } // FIXME: weather lock needs map ID to work reliably... needs to be implemented. } - c->Resume(); return CR_OK; } |
