summaryrefslogtreecommitdiff
path: root/plugins/regrass.cpp
diff options
context:
space:
mode:
authorQuietust2012-01-21 18:31:15 -0600
committerQuietust2012-01-21 18:31:15 -0600
commit2cc6bcf0e97dbdf60492067cd71dc79432a35687 (patch)
treee893504d15ef59e8803573f6f4483d2e3ec9ca34 /plugins/regrass.cpp
parentccf22bed10a78504701bbdb1f8177a16cf9ffdde (diff)
downloaddfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.gz
dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.bz2
dfhack-2cc6bcf0e97dbdf60492067cd71dc79432a35687.tar.xz
Use CoreSuspender and namespace df::enums
Diffstat (limited to 'plugins/regrass.cpp')
-rw-r--r--plugins/regrass.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/plugins/regrass.cpp b/plugins/regrass.cpp
index 53733fc2..e28f75e3 100644
--- a/plugins/regrass.cpp
+++ b/plugins/regrass.cpp
@@ -19,64 +19,64 @@ using df::global::world;
DFhackCExport command_result df_regrass (Core * c, vector <string> & parameters)
{
- if (!parameters.empty())
- return CR_WRONG_USAGE;
+ if (!parameters.empty())
+ return CR_WRONG_USAGE;
- CoreSuspender suspend(c);
+ CoreSuspender suspend(c);
- int count = 0;
- for (int i = 0; i < world->map.map_blocks.size(); i++)
- {
- df::map_block *cur = world->map.map_blocks[i];
- for (int x = 0; x < 16; x++)
- {
- for (int y = 0; y < 16; y++)
- {
- if (DFHack::tileShape(cur->tiletype[x][y]) != DFHack::FLOOR)
- continue;
- if (DFHack::tileMaterial(cur->tiletype[x][y]) != DFHack::SOIL)
- continue;
- if (cur->designation[x][y].bits.subterranean)
- continue;
- if (cur->occupancy[x][y].bits.building)
- continue;
+ int count = 0;
+ for (int i = 0; i < world->map.map_blocks.size(); i++)
+ {
+ df::map_block *cur = world->map.map_blocks[i];
+ for (int x = 0; x < 16; x++)
+ {
+ for (int y = 0; y < 16; y++)
+ {
+ if (DFHack::tileShape(cur->tiletype[x][y]) != DFHack::FLOOR)
+ continue;
+ if (DFHack::tileMaterial(cur->tiletype[x][y]) != DFHack::SOIL)
+ continue;
+ if (cur->designation[x][y].bits.subterranean)
+ continue;
+ if (cur->occupancy[x][y].bits.building)
+ continue;
- switch (rand() % 8)
- {
- // light grass
- case 0: cur->tiletype[x][y] = 0x015C; break;
- case 1: cur->tiletype[x][y] = 0x015D; break;
- case 2: cur->tiletype[x][y] = 0x015E; break;
- case 3: cur->tiletype[x][y] = 0x015F; break;
- // dark grass
- case 4: cur->tiletype[x][y] = 0x018E; break;
- case 5: cur->tiletype[x][y] = 0x018F; break;
- case 6: cur->tiletype[x][y] = 0x0190; break;
- case 7: cur->tiletype[x][y] = 0x0191; break;
- }
- count++;
- }
- }
- }
+ switch (rand() % 8)
+ {
+ // light grass
+ case 0: cur->tiletype[x][y] = 0x015C; break;
+ case 1: cur->tiletype[x][y] = 0x015D; break;
+ case 2: cur->tiletype[x][y] = 0x015E; break;
+ case 3: cur->tiletype[x][y] = 0x015F; break;
+ // dark grass
+ case 4: cur->tiletype[x][y] = 0x018E; break;
+ case 5: cur->tiletype[x][y] = 0x018F; break;
+ case 6: cur->tiletype[x][y] = 0x0190; break;
+ case 7: cur->tiletype[x][y] = 0x0191; break;
+ }
+ count++;
+ }
+ }
+ }
- if (count)
- c->con.print("Regrew %d tiles of grass.\n", count);
- return CR_OK;
+ if (count)
+ c->con.print("Regrew %d tiles of grass.\n", count);
+ return CR_OK;
}
DFhackCExport const char *plugin_name ( void )
{
- return "regrass";
+ return "regrass";
}
DFhackCExport command_result plugin_init (Core *c, std::vector<PluginCommand> &commands)
{
- commands.clear();
- commands.push_back(PluginCommand("regrass", "Regrows all surface grass, restoring outdoor plant growth for pre-0.31.19 worlds.", df_regrass));
- return CR_OK;
+ commands.clear();
+ commands.push_back(PluginCommand("regrass", "Regrows all surface grass, restoring outdoor plant growth for pre-0.31.19 worlds.", df_regrass));
+ return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( Core * c )
{
- return CR_OK;
-}
+ return CR_OK;
+} \ No newline at end of file