use sr
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled

This commit is contained in:
Green Sky 2024-10-25 13:57:14 +02:00
parent 050c7f3be1
commit 117e40dc9e
No known key found for this signature in database
2 changed files with 16 additions and 10 deletions

View File

@ -19,7 +19,9 @@ void Factorio::sendToLinked(const std::string& message) {
Factorio::Factorio(ConfigModelI& conf, Contact3Registry& cr, RegistryMessageModelI& rmm, FactorioLogParser& flp) : Factorio::Factorio(ConfigModelI& conf, Contact3Registry& cr, RegistryMessageModelI& rmm, FactorioLogParser& flp) :
_cr(cr), _cr(cr),
_rmm(rmm), _rmm(rmm),
_flp(flp) _rmm_sr(_rmm.newSubRef(this)),
_flp(flp),
_flp_sr(_flp.newSubRef(this))
{ {
// config // config
for (const auto&& [contact_id, enabled] : conf.entries_bool("Factorio", "link_to_contact")) { for (const auto&& [contact_id, enabled] : conf.entries_bool("Factorio", "link_to_contact")) {
@ -46,16 +48,18 @@ Factorio::Factorio(ConfigModelI& conf, Contact3Registry& cr, RegistryMessageMode
_linked_contacts.push_back(h); _linked_contacts.push_back(h);
} }
_rmm.subscribe(this, RegistryMessageModel_Event::message_construct); _rmm_sr.subscribe(RegistryMessageModel_Event::message_construct);
_flp.subscribe(this, FactorioLogParser_Event::join); _flp_sr
_flp.subscribe(this, FactorioLogParser_Event::leave); .subscribe(FactorioLogParser_Event::join)
_flp.subscribe(this, FactorioLogParser_Event::chat); .subscribe(FactorioLogParser_Event::leave)
_flp.subscribe(this, FactorioLogParser_Event::died); .subscribe(FactorioLogParser_Event::chat)
_flp.subscribe(this, FactorioLogParser_Event::evolution); .subscribe(FactorioLogParser_Event::died)
_flp.subscribe(this, FactorioLogParser_Event::research_started); .subscribe(FactorioLogParser_Event::evolution)
_flp.subscribe(this, FactorioLogParser_Event::research_finished); .subscribe(FactorioLogParser_Event::research_started)
_flp.subscribe(this, FactorioLogParser_Event::research_cancelled); .subscribe(FactorioLogParser_Event::research_finished)
.subscribe(FactorioLogParser_Event::research_cancelled)
;
} }
Factorio::~Factorio(void) { Factorio::~Factorio(void) {

View File

@ -12,7 +12,9 @@ struct ConfigModelI;
class Factorio : public RegistryMessageModelEventI, public FactorioLogParserEventI { class Factorio : public RegistryMessageModelEventI, public FactorioLogParserEventI {
Contact3Registry& _cr; Contact3Registry& _cr;
RegistryMessageModelI& _rmm; RegistryMessageModelI& _rmm;
RegistryMessageModelI::SubscriptionReference _rmm_sr;
FactorioLogParser& _flp; FactorioLogParser& _flp;
FactorioLogParser::SubscriptionReference _flp_sr;
std::vector<Contact3Handle> _linked_contacts; std::vector<Contact3Handle> _linked_contacts;