-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #413, added methods TryMakeGenericType(s)
The methods `TryMakeGenericType`/`TryMakeGenericTypes` will attempt to construct a generic type for a given type/collection of types. In case of non-generic types, or generic types that were already constructed they'll be returned as-is. The method will attempt to find types that matches all generic constraints defined by the type itself, and if successful - call `Type.MakeGenericType` with the results. In case we encounter a generic type with constraints no types can match an error will be displayed (unless `ignoreErrors` argument will be passed and set to true). The only exception is abstract classes with no subclasses, for which no error will be shown (assuming here they are unused). The method was applied where needed. With RimWorld assembly itself, and majority of mods - this is going to do nothing. However, in case of mods that utilize generic types for the types that we end up patching - it should allow for those mods to properly work with Multiplayer without significantly breaking everything - for example, it should fix startup issues with Project Rimfactory. As for error handling - I'm not 100% sure here. Perhaps adding `Multiplayer.loadingErrors = true` if errors are encountered? I can make changes where needed. And finally - I've attempted to add XML documentation, as well as some comments to the code to explain it a bit more. However, I'm not completely satisfied with it... If there's any changes that should be made, let me know.
- Loading branch information
1 parent
7429f3a
commit 685b3e1
Showing
4 changed files
with
126 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters