Closed robojumper closed 4 years ago
Isn't the normal procedure not the change the signature of functions in vanilla classes? Is UIScreenStack
a special case?
@pledbrook Optional parameters can be added without problems if we don't expect the function to be overridden in mod subclasses.
So should that be the approach I take in the pull request, i.e. of just adding an option argument to the existing methods? I'm guessing that no one would or should subclass UIScreenStack
, but I don't know that for sure.
UIScreenStack
has a number of functions, most notablyGetScreen
, that deal with classes but do not account for subclasses.This causes a number of bugs and general weirdness in a lot of base game code and makes interoperability with mods even worse.
Even though changing it to account for subclasses is changing the behavior of the function and may introduce some bugs, we would still remove a huge number of bugs. Additionally, I have never seen code that relies on the current behavior of
GetScreen
(non-constructed examples welcome!)I would suggest adding an optional boolean parameter (
true
by default) that controls whether subclasses are considered. One can still avoid a dependency on the Highlander by doing something likeGetScreen(class'UIArmory_Promotion').class == class'UIArmory_Promotion'
if subclasses are not desired.