-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Events methods to namespace #4692
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need assistance with these points. What decision should I make?
}; | ||
namespace tfs::events { | ||
|
||
bool load(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to change this for each events::x, as it gives us better control over each type. However, this approach will result in repeated code and reading the same file multiple times. I suggest this because I plan to add global events
and move events
to the namespace.
like
tfs::events::global::startup();
tfs::events::global::shutdown();
tfs::events::global::save();
@@ -260,8 +259,7 @@ ReturnValue Combat::canDoCombat(Creature* caster, Tile* tile, bool aggressive) | |||
if (aggressive && tile->hasFlag(TILESTATE_PROTECTIONZONE)) { | |||
return RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE; | |||
} | |||
|
|||
return g_events->eventCreatureOnAreaCombat(caster, tile, aggressive); | |||
return tfs::events::creature::onAreaCombat(caster, tile, aggressive); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still unsure whether to use tfs::events
or tfs::game::events
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tfs::events
@ranisalt to what extent is it good to use namespace to handle all singletons? |
Singletons are I like this post on how singletons are an awful idea in general. Namespaces don't solve it, but they make it less bad. |
Pull Request Prelude
Changes Proposed