Skip to content

Events System

UndeadStar edited this page Mar 31, 2022 · 1 revision

Note: at the time this is written, files including the events system are not yet uploaded, and it is still a WIP (Work In Progress). It should logically work as described below though. If not, I will update this wiki entry accordingly at the time.

The events system is a new addition of GPTP 6.100.
It is not native to Starcraft, and must be enabled in definitions.h by uncommenting #define EVENTS_SYSTEM.
Due to this file being at the core of GPTP, it will require rebuilding the whole project on next compilation.

Events are spread in various files throughout the project, and the list of their identifiers can be found in Events.h.
To use them, you register a function you created to handle the event in initialize.cppProbably will change before release through the RegisterEvent function, that take an event id and your function as parameters.
Once that's done, when the event is reached in other files, it will call your function automatically.

Your function called by the event should take a single argument of type std::vector<int*>, and have a boolean return type.
The argument is an array of pointers, and the amount and identify of the elements is described in Events.h.
The return value is used by events that can cancel the normal Starcraft behavior. If true is returned by at least 1 of the registered event functions in that case, then only the registered event functions will be executed, not the default behavior of Starcraft.

The objective of the events system is to allow certain changes to be concentrated in a user file, rather than being spread over all the files of the project. The actual project files are still required though as their changes is what allow the events to be used.

Clone this wiki locally