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

Class PointComp

plugins/diggingInvaders/diggingInvaders.cpp:176–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174df::coord getRoot(df::coord point, unordered_map<df::coord, df::coord>& rootMap);
175
176class PointComp {
177public:
178 unordered_map<df::coord, cost_t, PointHash> *pointCost;
179 PointComp(unordered_map<df::coord, cost_t, PointHash> *p): pointCost(p) {
180
181 }
182
183 int32_t operator()(df::coord p1, df::coord p2) const {
184 if ( p1 == p2 ) return 0;
185 auto i1 = pointCost->find(p1);
186 auto i2 = pointCost->find(p2);
187 if ( i1 == pointCost->end() && i2 == pointCost->end() )
188 return p1 < p2;
189 if ( i1 == pointCost->end() )
190 return true;
191 if ( i2 == pointCost->end() )
192 return false;
193 cost_t c1 = (*i1).second;
194 cost_t c2 = (*i2).second;
195 if ( c1 != c2 )
196 return c1 < c2;
197 return p1 < p2;
198 }
199};
200
201//bool important(df::coord pos, map<df::coord, set<Edge> >& edges, df::coord prev, set<df::coord>& importantPoints, set<Edge>& importantEdges);
202

Callers 1

clearDijkstraFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected