Mark new methodmap natives as optional (#867)

The `TopMenu` methodmap natives weren't marked as optional if the extension was optional like the other normal natives.

The `Regex` natives weren't marked as optional at all before if the regex extension was included optionally.

This makes the error message cleaner in case topmenus aren't loaded.
```
adminmenu.smx (Admin Menu): Required extension "TopMenus" file("topmenus.ext") not running
basebans.smx (Basic Ban Commands): Native "TopMenu.Display" was not found
```
This commit is contained in:
peace-maker 2018-08-06 21:11:01 +02:00 committed by Asher Baker
parent 3511d2a44d
commit 7e3b1c395b
2 changed files with 28 additions and 0 deletions

View File

@ -273,3 +273,19 @@ public Extension __ext_regex =
required = 0,
#endif
};
#if !defined REQUIRE_EXTENSIONS
public void __ext_regex_SetNTVOptional()
{
MarkNativeAsOptional("CompileRegex");
MarkNativeAsOptional("MatchRegex");
MarkNativeAsOptional("GetRegexSubString");
MarkNativeAsOptional("Regex.Regex");
MarkNativeAsOptional("Regex.Match");
MarkNativeAsOptional("Regex.MatchAll");
MarkNativeAsOptional("Regex.GetSubString");
MarkNativeAsOptional("Regex.MatchCount");
MarkNativeAsOptional("Regex.CaptureCount");
MarkNativeAsOptional("Regex.MatchOffset");
}
#endif

View File

@ -430,5 +430,17 @@ public void __ext_topmenus_SetNTVOptional()
MarkNativeAsOptional("DisplayTopMenuCategory");
MarkNativeAsOptional("FindTopMenuCategory");
MarkNativeAsOptional("SetTopMenuTitleCaching");
MarkNativeAsOptional("TopMenu.TopMenu");
MarkNativeAsOptional("TopMenu.FromHandle");
MarkNativeAsOptional("TopMenu.LoadConfig");
MarkNativeAsOptional("TopMenu.AddCategory");
MarkNativeAsOptional("TopMenu.AddItem");
MarkNativeAsOptional("TopMenu.GetInfoString");
MarkNativeAsOptional("TopMenu.GetObjName");
MarkNativeAsOptional("TopMenu.Remove");
MarkNativeAsOptional("TopMenu.Display");
MarkNativeAsOptional("TopMenu.DisplayCategory");
MarkNativeAsOptional("TopMenu.FindCategory");
MarkNativeAsOptional("TopMenu.CacheTitles.set");
}
#endif