dfhack/plugins/channel-safely/include/channel-manager.h

40 lines
1.3 KiB
C

2022-11-06 01:12:35 -06:00
#pragma once
#include <PluginManager.h>
#include <modules/World.h>
#include <modules/Maps.h>
#include <modules/Job.h>
#include <df/map_block.h>
#include "channel-groups.h"
#include "plugin.h"
using namespace DFHack;
// Uses GroupData to detect an unsafe work environment
class ChannelManager {
private:
ChannelManager()= default;
protected:
public:
ChannelGroups groups = ChannelGroups(jobs);
ChannelJobs jobs;
2022-11-06 01:12:35 -06:00
static ChannelManager& Get(){
static ChannelManager instance;
return instance;
}
void build_groups(bool full_scan = false) { groups.scan(full_scan); debug(); }
2022-11-06 12:53:46 -07:00
void destroy_groups() { groups.clear(); debug(); }
void manage_groups();
2022-11-06 01:12:35 -06:00
void manage_group(const df::coord &map_pos, bool set_marker_mode = false, bool marker_mode = false);
void manage_group(const Group &group, bool set_marker_mode = false, bool marker_mode = false) const;
bool manage_one(const df::coord &map_pos, bool set_marker_mode = false, bool marker_mode = false) const;
2022-11-06 01:12:35 -06:00
void mark_done(const df::coord &map_pos);
bool exists(const df::coord &map_pos) const { return groups.count(map_pos); }
2022-11-06 01:12:35 -06:00
void debug() {
2022-11-06 12:53:46 -07:00
DEBUG(groups).print(" DEBUGGING GROUPS:\n");
groups.debug_map();
groups.debug_groups();
2022-11-06 01:12:35 -06:00
}
};