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

Method scan_forward

plugins/spectate.cpp:226–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224 }
225
226 void scan_forward(color_ostream &out) {
227 if (history.empty() || offset == 0) {
228 DEBUG(cycle,out).print("already at most recent unit; following new unit\n");
229 follow_a_dwarf(out);
230 return;
231 }
232
233 --offset;
234 int unit_id = get_cur_unit_id();
235 DEBUG(cycle,out).print("scanning forward to unit {} at offset {}\n", unit_id, offset);
236 if (auto unit = df::unit::find(unit_id))
237 Gui::revealInDwarfmodeMap(Units::getPosition(unit), false, World::ReadPauseState());
238 plotinfo->follow_item = -1;
239 plotinfo->follow_unit = unit_id;
240 }
241
242 int32_t get_cur_unit_id() {
243 if (offset >= history.size())

Callers 1

spectate_followNextFunction · 0.80

Calls 5

follow_a_dwarfFunction · 0.85
revealInDwarfmodeMapFunction · 0.85
findFunction · 0.50
emptyMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected