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

Function parse_priority

plugins/dig.cpp:606–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604};
605
606int32_t parse_priority(color_ostream &out, vector<string> &parameters)
607{
608 int32_t default_priority = game->main_interface.designation.priority;
609
610 for (auto it = parameters.begin(); it != parameters.end(); ++it)
611 {
612 const string &s = *it;
613 if (s.substr(0, 2) == "p=" || s.substr(0, 2) == "-p")
614 {
615 if (s.size() >= 3)
616 {
617 auto priority = int32_t(1000 * atof(s.c_str() + 2));
618 parameters.erase(it);
619 return priority;
620 }
621 else if (it + 1 != parameters.end())
622 {
623 auto priority = int32_t(1000 * atof((*(it + 1)).c_str()));
624 parameters.erase(it, it + 2);
625 return priority;
626 }
627 else
628 {
629 out.printerr("invalid priority specified; reverting to {}\n", default_priority);
630 break;
631 }
632 }
633 }
634
635 return default_priority;
636}
637
638string forward_priority(color_ostream &out, vector<string> &parameters)
639{

Callers 6

forward_priorityFunction · 0.85
digcircleFunction · 0.85
digexpFunction · 0.85
digvFunction · 0.85
diglFunction · 0.85
digtypeFunction · 0.85

Calls 5

c_strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected