MCPcopy Create free account
hub / github.com/DFHack/dfhack / spotclean

Function spotclean

plugins/cleaners.cpp:170–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170command_result spotclean (color_ostream &out, vector <string> & parameters)
171{
172 if (cursor->x < 0)
173 {
174 out.printerr("The cursor is not active.\n");
175 return CR_WRONG_USAGE;
176 }
177 if (!Maps::IsValid())
178 {
179 out.printerr("Map is not available.\n");
180 return CR_FAILURE;
181 }
182 df::map_block *block = Maps::getTileBlock(cursor->x, cursor->y, cursor->z);
183 if (block == NULL)
184 {
185 out.printerr("Invalid map block selected!\n");
186 return CR_FAILURE;
187 }
188
189 for (auto evt : block->block_events)
190 {
191 if (evt->getType() != block_square_event_type::material_spatter)
192 continue;
193 // type verified - recast to subclass
194 df::block_square_event_material_spatterst *spatter = (df::block_square_event_material_spatterst *)evt;
195 clean_mud_safely(spatter, block->map_pos, df::coord(cursor->x % 16, cursor->y % 16, 0));
196 }
197 return CR_OK;
198}
199
200command_result clean (color_ostream &out, vector <string> & parameters)
201{

Callers

nothing calls this directly

Calls 3

getTileBlockFunction · 0.85
clean_mud_safelyFunction · 0.85
getTypeMethod · 0.80

Tested by

no test coverage detected