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

Function adjust_activities

plugins/timestream.cpp:496–672  ·  view source on GitHub ↗

behavior ascertained from in-game observation

Source from the content-addressed store, hash-verified

494
495// behavior ascertained from in-game observation
496static void adjust_activities(color_ostream &out, int32_t timeskip) {
497 for (auto act : world->activities.all) {
498 for (auto ev : act->events) {
499 switch (ev->getType()) {
500 using namespace df::enums::activity_event_type;
501 case NONE:
502 break;
503
504 case TrainingSession:
505 // no counters
506 break;
507
508 case CombatTraining:
509 // has organize_counter at a non-zero value, but it doesn't seem to move
510 break;
511
512 case SkillDemonstration:
513 if (auto sd_ev = virtual_cast<df::activity_event_skill_demonstrationst>(ev)) {
514 // can be negative or positive, but always counts towards 0
515 if (sd_ev->organize_counter < 0)
516 sd_ev->organize_counter = std::min(-1, sd_ev->organize_counter + timeskip);
517 else
518 decrement_counter(sd_ev, &df::activity_event_skill_demonstrationst::organize_counter, timeskip);
519 decrement_counter(sd_ev, &df::activity_event_skill_demonstrationst::train_countdown, timeskip);
520 break;
521 }
522
523 case IndividualSkillDrill:
524 // only counts down on season ticks, nothing to do here
525 break;
526
527 case Sparring:
528 if (auto s_ev = virtual_cast<df::activity_event_sparringst>(ev)) {
529 decrement_counter(s_ev, &df::activity_event_sparringst::countdown, timeskip * 2);
530 break;
531 }
532
533 case RangedPractice:
534 // countdown appears to never move from 0
535 if (auto rp_ev = virtual_cast<df::activity_event_ranged_practicest>(ev)) {
536 decrement_counter(rp_ev, &df::activity_event_ranged_practicest::countdown, timeskip);
537 break;
538 }
539
540 case Harassment:
541 {
542 DEBUG(cycle,out).print("activity_event_harassmentst ready for analysis\n");
543 break;
544 }
545
546 case Conversation:
547 if (auto c_ev = virtual_cast<df::activity_event_conversationst>(ev)) {
548 increment_counter(c_ev, &df::activity_event_conversationst::pause, timeskip);
549 break;
550 }
551
552 case Conflict:
553 if (auto c_ev = virtual_cast<df::activity_event_conflictst>(ev)) {

Callers 1

do_cycleFunction · 0.85

Calls 4

decrement_counterFunction · 0.85
increment_counterFunction · 0.85
getTypeMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected