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

40 lines
1.2 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:
ChannelJobs jobs;
ChannelManager()= default;
protected:
public:
ChannelGroups groups = ChannelGroups(jobs);
static ChannelManager& Get(){
static ChannelManager instance;
return instance;
}
2022-11-06 12:53:46 -07:00
void build_groups() { groups.scan(); debug(); }
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);
bool manage_one(const Group &group, const df::coord &map_pos, bool set_marker_mode = false, bool marker_mode = false);
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_groups();
groups.debug_map();
2022-11-06 01:12:35 -06:00
}
};