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

Function follow

plugins/follow.cpp:135–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135command_result follow (color_ostream &out, std::vector <std::string> & parameters)
136{
137 if (!parameters.empty())
138 return CR_WRONG_USAGE;
139
140 if (followedUnit)
141 {
142 out.print("No longer following previously selected unit.\n");
143 followedUnit = 0;
144 }
145 followedUnit = Gui::getSelectedUnit(out);
146 if (followedUnit)
147 {
148 is_enabled = true;
149 std::ostringstream ss;
150 ss << "Unpause to begin following " << world->raws.creatures.all[followedUnit->race]->name[0];
151 if (followedUnit->name.has_name) ss << " " << followedUnit->name.first_name;
152 ss << ". Simply manually move the view to break the following.\n";
153 out.print("{}", ss.str());
154 }
155 else followedUnit = 0;
156 is_enabled = (followedUnit != NULL);
157 return CR_OK;
158}

Callers

nothing calls this directly

Calls 4

getSelectedUnitFunction · 0.85
emptyMethod · 0.45
printMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected