Add OnMapInit forward and deprecate OnLevelInit

The change in behaviour to the OnLevelInit forward params isn't obvious
when compiling a plugin, deprecate it to make it a lot more obvious that
something has changed.

Some plugins rely just on the timing of OnLevelInit rather than doing
anything with the entity lump, for these plugins offer a new OnMapInit
forward that is implemented in core rather than sdkhooks. If / when we
offer a new entity lump manipulation API in the future this'll be the
forward where it can be used to make changes.
This commit is contained in:
Asher Baker
2021-07-17 20:52:51 +01:00
parent 70c9a6528a
commit 7f2fdf3fe1
3 changed files with 29 additions and 8 deletions
+1
View File
@@ -382,6 +382,7 @@ forward Action OnGetGameDescription(char gameDesc[64]);
* @param mapEntities Unused, always empty
* @return Unused, return value is ignored
*/
#pragma deprecated Use OnMapInit() instead
forward Action OnLevelInit(const char[] mapName, char mapEntities[2097152]);
/**
+7 -3
View File
@@ -182,10 +182,14 @@ forward void OnPluginPauseChange(bool pause);
forward void OnGameFrame();
/**
* Called when the map is loaded.
* Called when the map starts loading.
*
* @note This used to be OnServerLoad(), which is now deprecated.
* Plugins still using the old forward will work.
* @param mapName Name of the map
*/
forward void OnMapInit(const char[] mapName);
/**
* Called when the map is loaded.
*/
forward void OnMapStart();