Skip to content

Example of dexode::eventbus::perk::PassEverythingPerk wrong #36

@geiseri

Description

@geiseri

This is more of a concrete example of the desired operation for #6.

https://wandbox.org/permlink/YUaGMcgiwgtdRHE6

The issue is I obviously am misunderstanding something. If I run the example with line 131 as the following

UIWallet wallet{subordinate}; 

I get the output:

Start
Gold:0
Shop button is:1
Gold:0
Shop button is:1
Shop button is:0
0
Finish

I would expect to see:

Start
Gold:0
Shop button is:1
Gold:100
Shop button is:1
Shop button is:0
0
Finish

Am I misunderstanding the operation of dexode::eventbus::perk::PassEverythingPerk in that on line 126:

subordinate->addPerk(std::make_unique<dexode::eventbus::perk::PassEverythingPerk>(eventBus)).registerPrePostpone(&dexode::eventbus::perk::PassEverythingPerk::onPrePostponeEvent);

Should cause subordinate to get all the events from eventBus forwarded to it. Then when subordinate->process(); is called it will process the event listeners on that bus.

NOTE: I am assuming my understanding is flawed, but correcting the misunderstanding to reflect the intent will "close" this issue. I will then make a PR with the corrected example. Feel free to change the issue title to something more appropriate.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions