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);
|
2022-12-08 12:21:17 -07:00
|
|
|
ChannelJobs jobs;
|
2022-11-06 01:12:35 -06:00
|
|
|
|
|
|
|
static ChannelManager& Get(){
|
|
|
|
static ChannelManager instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2022-11-28 18:10:55 -07:00
|
|
|
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);
|
2022-12-08 15:59:09 -07:00
|
|
|
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);
|
2022-11-08 21:01:30 -07:00
|
|
|
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");
|
2022-11-21 13:39:26 -07:00
|
|
|
groups.debug_map();
|
2022-12-08 12:21:17 -07:00
|
|
|
groups.debug_groups();
|
2022-11-06 01:12:35 -06:00
|
|
|
}
|
|
|
|
};
|