Why must event handlers be listed in MAPINFO?
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 184
- Joined: Tue Aug 30, 2016 4:47 pm
Why must event handlers be listed in MAPINFO?
Why do ZScript event handlers have to be listed in MAPINFO under [Add]EventHandlers? The VM knows all defined classes at startup, so why not automatically instantiate all non-abstract event handler classes?
-
- Lead GZDoom+Raze Developer
- Posts: 49223
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Why must event handlers be listed in MAPINFO?
Because you may not want that? Imagine an event handler library where you can pick what you need and ignore the rest.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Why must event handlers be listed in MAPINFO?
But this is the same as exclude event handler from "#include path" in main/root zscript file.
-
- Lead GZDoom+Raze Developer
- Posts: 49223
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Why must event handlers be listed in MAPINFO?
Not if the root file is in the library.
-
- Posts: 13914
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Why must event handlers be listed in MAPINFO?
I am going to have to agree with Graf here, but here is why:
I may, at some point, wish to disable certain handlers. I would rather do that in a more centralized location, without having to search for it in my code. It kind of gives a "control room" effect to the whole mod, which means I don't have to go far to figure out what I need.
Plus, I can't speak for the VM or the compiler, but I would imagine it's a bit cleaner in the code back-end to not have to add to the handler stack automatically.
I may, at some point, wish to disable certain handlers. I would rather do that in a more centralized location, without having to search for it in my code. It kind of gives a "control room" effect to the whole mod, which means I don't have to go far to figure out what I need.
Plus, I can't speak for the VM or the compiler, but I would imagine it's a bit cleaner in the code back-end to not have to add to the handler stack automatically.