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

Function add_bucket

plugins/spectate.cpp:482–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482static void add_bucket(const vector<df::unit*> &bucket, vector<df::unit*> &units, vector<float> &intervals, vector<float> &weights, float weight) {
483 if (bucket.empty())
484 return;
485 if (config.prefer_new_arrivals) {
486 vector<df::unit*> new_bucket, old_bucket;
487 for (auto unit : bucket) {
488 if (recent_units.contains(unit->id))
489 new_bucket.push_back(unit);
490 else
491 old_bucket.push_back(unit);
492 }
493 add_bucket_to_vectors(new_bucket, units, intervals, weights, weight * RECENT_UNIT_MULTIPLIER);
494 add_bucket_to_vectors(old_bucket, units, intervals, weights, weight);
495 } else {
496 add_bucket_to_vectors(bucket, units, intervals, weights, weight);
497 }
498}
499
500#define DUMP_BUCKET(name) \
501 DEBUG(cycle,out).print("bucket: " #name ", size: {}\n", name.size()); \

Callers 1

follow_a_dwarfFunction · 0.85

Calls 3

add_bucket_to_vectorsFunction · 0.85
containsMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected