@@ -17,6 +17,7 @@ using std::vector;
1717using std::string;
1818using namespace DFHack ;
1919using namespace DFHack ::Simple;
20+ using namespace df ::enums;
2021
2122using df::global::world;
2223using df::global::cursor;
@@ -40,20 +41,20 @@ command_result cleanmap (Core * c, bool snow, bool mud)
4041 for (int j = 0 ; j < block->block_events .size (); j++)
4142 {
4243 df::block_square_event *evt = block->block_events [j];
43- if (evt->getType () != df:: block_square_event_type::material_spatter)
44+ if (evt->getType () != block_square_event_type::material_spatter)
4445 continue ;
4546 // type verified - recast to subclass
4647 df::block_square_event_material_spatterst *spatter = (df::block_square_event_material_spatterst *)evt;
4748
4849 // filter snow
4950 if (!snow
50- && spatter->mat_type == df:: builtin_mats::WATER
51- && spatter->mat_state == df:: matter_state::Powder)
51+ && spatter->mat_type == builtin_mats::WATER
52+ && spatter->mat_state == matter_state::Powder)
5253 continue ;
5354 // filter mud
5455 if (!mud
55- && spatter->mat_type == df:: builtin_mats::MUD
56- && spatter->mat_state == df:: matter_state::Solid)
56+ && spatter->mat_type == builtin_mats::MUD
57+ && spatter->mat_state == matter_state::Solid)
5758 continue ;
5859
5960 delete evt;
@@ -119,7 +120,7 @@ DFhackCExport command_result spotclean (Core * c, vector <string> & parameters)
119120 if (cursor->x == -30000 )
120121 {
121122 c->con .printerr (" The cursor is not active.\n " );
122- return CR_FAILURE ;
123+ return CR_WRONG_USAGE ;
123124 }
124125 df::map_block *block = Maps::getBlockAbs (cursor->x , cursor->y , cursor->z );
125126 if (block == NULL )
@@ -131,7 +132,7 @@ DFhackCExport command_result spotclean (Core * c, vector <string> & parameters)
131132 for (int i = 0 ; i < block->block_events .size (); i++)
132133 {
133134 df::block_square_event *evt = block->block_events [i];
134- if (evt->getType () != df:: block_square_event_type::material_spatter)
135+ if (evt->getType () != block_square_event_type::material_spatter)
135136 continue ;
136137 // type verified - recast to subclass
137138 df::block_square_event_material_spatterst *spatter = (df::block_square_event_material_spatterst *)evt;
@@ -189,14 +190,13 @@ DFhackCExport command_result clean (Core * c, vector <string> & parameters)
189190 );
190191 return CR_OK;
191192 }
192- c-> Suspend ( );
193+ CoreSuspender suspend (c );
193194 if (map)
194195 cleanmap (c,snow,mud);
195196 if (units)
196197 cleanunits (c);
197198 if (items)
198199 cleanitems (c);
199- c->Resume ();
200200 return CR_OK;
201201}
202202
0 commit comments