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

Method add_and_follow

plugins/spectate.cpp:197–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195 }
196
197 void add_and_follow(color_ostream &out, df::unit *unit) {
198 // if we're currently following a unit, add it to the history if it's not already there
199 if (plotinfo->follow_unit > -1 && plotinfo->follow_unit != get_cur_unit_id()) {
200 DEBUG(cycle,out).print("currently following unit {} that is not in history; adding\n", plotinfo->follow_unit);
201 add_to_history(out, plotinfo->follow_unit);
202 }
203
204 int32_t id = unit->id;
205 add_to_history(out, id);
206 DEBUG(cycle,out).print("now following unit {}: {}\n", id, DF2CONSOLE(Units::getReadableName(unit)));
207 Gui::revealInDwarfmodeMap(Units::getPosition(unit), false, World::ReadPauseState());
208 plotinfo->follow_item = -1;
209 plotinfo->follow_unit = id;
210 }
211
212 void scan_back(color_ostream &out) {
213 if (history.empty() || offset >= history.size()-1) {

Callers 1

follow_a_dwarfFunction · 0.80

Calls 2

revealInDwarfmodeMapFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected