-
-
Notifications
You must be signed in to change notification settings - Fork 107
Add spawnini and spawnmap dropdown support #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously, dropdown selections could only append to spawnmap.ini and if a spawnini setting was to be written, it was whatever value there was set. Now, there is support for this: [Example] OptionName=Crates ; ← this is what your dropdown will display SpawnIniOption=Crates ; ← the key under [Settings] in spawnmap.ini SpawnIniOptionValues=False,True,True,True ItemLabels=Disabled,Enabled - Default,Enabled - Extra,Enabled - Extreme DefaultIndex=0 DataWriteMode=STRING Items=INI\Game Options\Crates\Disabled.ini,INI\Game Options\Crates\Enabled.ini,INI\Game Options\Crates\Increased.ini,INI\Game Options\Crates\Super Increased.ini Picking Disabled, or the first selection, will write Crates=False to spawn.ini while also appending spawnmap.ini respective to the ini file in the ItemsLabel list. Picking Enabled - Default, or any of the others, will write Crates=True to spawn.ini while also appending spawnmap.ini respective to the ini file in the ItemsLabel list.
Nightly build for this pull request:
|
public void ApplySpawnIniCode(IniFile spawnIni) | ||
{ | ||
if (dataWriteMode == DropDownDataWriteMode.MAPCODE || SelectedIndex < 0 || SelectedIndex >= Items.Count) | ||
if (SelectedIndex < 0 || SelectedIndex >= Items.Count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure to remove this check, instead of checking dataWriteMode == DropDownDataWriteMode.MAPCODE || dataWriteMode == DropDownDataWriteMode.SPAWN_SPAWNMAP
? I haven't looked into details so no matter either choice is selected, could you provide some explanations on this line?
Accidently deleted
@@ -124,12 +138,20 @@ public void ApplySpawnIniCode(IniFile spawnIni) | |||
case DropDownDataWriteMode.INDEX: | |||
spawnIni.SetIntValue("Settings", spawnIniOption, SelectedIndex); | |||
break; | |||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your PR seems to break the default case. Move your SPAWN_SPAWNMAP
right after the INDEX
case and before the default case. Keep the default
and STRING
cases untouched
string customIniPath; | ||
customIniPath = Items[SelectedIndex].Tag.ToString(); | ||
if ((dataWriteMode != DropDownDataWriteMode.MAPCODE && | ||
dataWriteMode != DropDownDataWriteMode.SPAWN_SPAWNMAP) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if adding dataWriteMode != DropDownDataWriteMode.SPAWN_SPAWNMAP)
works as intended.
Needs an answer to the following question: on the condition dataWriteMode == DropDownDataWriteMode.SPAWN_SPAWNMAP
, should MapCodeHelper.ApplyMapCode
be called or not?
/// The dropdown value is filename of a mapcode INI file, which will be applied to the map.
/// Nothing is written to spawn INI.
/// </summary>
MAPCODE,
/// <summary>
/// The dropdown will support spawninioption values and spawninivalues being set based on their index.
/// Also writes ini file content to spawnmap.ini based on the index selected.
/// </summary>
SPAWN_SPAWNMAP,
From the XML comment here it seems to indicate only in the MAPCODE
case we need to call MapCodeHelper.ApplyMapCode()
. Not very sure on this one.
Honestly I've kind of forgotten about this. Closing for now. |
Introduces new
DataWriteMode
ofSPAWN_SPAWNMAP
This new
DataWriteMode
will keep backwards compatability by not interfering with otherDataWriteMode
functionality.Allows dropdowns in
GameLobbyDropDown.cs
to have:Example below is now possible: