mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
save before each battle. The launcher UI adds 'Save before battle' by replacing original 'Network port' button because insertion new button meaning to move all row index by 1. Also 'network port' seems fitting to be category of 'Network' which is near end of all buttons and it saves a lot modifications.
This commit is contained in:
parent
6dc6cc4cbf
commit
7d9c212543
@ -42,7 +42,8 @@
|
|||||||
"savePrefix",
|
"savePrefix",
|
||||||
"startTurnAutosave",
|
"startTurnAutosave",
|
||||||
"enableUiEnhancements",
|
"enableUiEnhancements",
|
||||||
"audioMuteFocus"
|
"audioMuteFocus",
|
||||||
|
"saveBeforeBattle"
|
||||||
],
|
],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"playerName" : {
|
"playerName" : {
|
||||||
@ -146,6 +147,10 @@
|
|||||||
"audioMuteFocus" : {
|
"audioMuteFocus" : {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
"saveBeforeBattle" : {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -214,6 +214,8 @@ void CSettingsView::loadToggleButtonSettings()
|
|||||||
setCheckbuttonState(ui->buttonRelativeCursorMode, settings["general"]["userRelativePointer"].Bool());
|
setCheckbuttonState(ui->buttonRelativeCursorMode, settings["general"]["userRelativePointer"].Bool());
|
||||||
setCheckbuttonState(ui->buttonHapticFeedback, settings["general"]["hapticFeedback"].Bool());
|
setCheckbuttonState(ui->buttonHapticFeedback, settings["general"]["hapticFeedback"].Bool());
|
||||||
|
|
||||||
|
setCheckbuttonState(ui->buttonSaveBeforeBattle, settings["general"]["saveBeforeBattle"].Bool());
|
||||||
|
|
||||||
std::string cursorType = settings["video"]["cursor"].String();
|
std::string cursorType = settings["video"]["cursor"].String();
|
||||||
int cursorTypeIndex = vstd::find_pos(cursorTypesList, cursorType);
|
int cursorTypeIndex = vstd::find_pos(cursorTypesList, cursorType);
|
||||||
setCheckbuttonState(ui->buttonCursorType, cursorTypeIndex);
|
setCheckbuttonState(ui->buttonCursorType, cursorTypeIndex);
|
||||||
@ -472,6 +474,13 @@ void CSettingsView::on_buttonAutoSave_toggled(bool value)
|
|||||||
updateCheckbuttonText(ui->buttonAutoSave);
|
updateCheckbuttonText(ui->buttonAutoSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingsView::on_buttonSaveBeforeBattle_toggled(bool value)
|
||||||
|
{
|
||||||
|
Settings node = settings.write["general"]["saveBeforeBattle"];
|
||||||
|
node->Bool() = value;
|
||||||
|
updateCheckbuttonText(ui->buttonSaveBeforeBattle);
|
||||||
|
}
|
||||||
|
|
||||||
void CSettingsView::on_comboBoxLanguage_currentIndexChanged(int index)
|
void CSettingsView::on_comboBoxLanguage_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
Settings node = settings.write["general"]["language"];
|
Settings node = settings.write["general"]["language"];
|
||||||
|
@ -50,6 +50,7 @@ private slots:
|
|||||||
void on_buttonAutoCheck_toggled(bool value);
|
void on_buttonAutoCheck_toggled(bool value);
|
||||||
void on_comboBoxDisplayIndex_currentIndexChanged(int index);
|
void on_comboBoxDisplayIndex_currentIndexChanged(int index);
|
||||||
void on_buttonAutoSave_toggled(bool value);
|
void on_buttonAutoSave_toggled(bool value);
|
||||||
|
void on_buttonSaveBeforeBattle_toggled(bool value);
|
||||||
void on_comboBoxLanguage_currentIndexChanged(int index);
|
void on_comboBoxLanguage_currentIndexChanged(int index);
|
||||||
void on_buttonCursorType_toggled(bool value);
|
void on_buttonCursorType_toggled(bool value);
|
||||||
void on_pushButtonTranslation_clicked();
|
void on_pushButtonTranslation_clicked();
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="60" column="0">
|
<item row="61" column="0">
|
||||||
<widget class="QLabel" name="labelModsValidation">
|
<widget class="QLabel" name="labelModsValidation">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mods Validation</string>
|
<string>Mods Validation</string>
|
||||||
@ -301,7 +301,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="60" column="5">
|
<item row="61" column="5">
|
||||||
<widget class="QToolButton" name="buttonValidationFull">
|
<widget class="QToolButton" name="buttonValidationFull">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -507,7 +507,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1" colspan="5">
|
<item row="59" column="1" colspan="5">
|
||||||
<widget class="QSpinBox" name="spinBoxNetworkPort">
|
<widget class="QSpinBox" name="spinBoxNetworkPort">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1024</number>
|
<number>1024</number>
|
||||||
@ -667,7 +667,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="60" column="1" colspan="2">
|
<item row="61" column="1" colspan="2">
|
||||||
<widget class="QToolButton" name="buttonValidationOff">
|
<widget class="QToolButton" name="buttonValidationOff">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -707,7 +707,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="59" column="0">
|
||||||
<widget class="QLabel" name="labelNetworkPort">
|
<widget class="QLabel" name="labelNetworkPort">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Network port</string>
|
<string>Network port</string>
|
||||||
@ -1133,7 +1133,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="59" column="0">
|
<item row="60" column="0">
|
||||||
<widget class="QLabel" name="labelMiscellaneous">
|
<widget class="QLabel" name="labelMiscellaneous">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
@ -1424,7 +1424,7 @@ Fullscreen Exclusive Mode - game will cover entirety of your screen and will use
|
|||||||
<item row="12" column="1" colspan="5">
|
<item row="12" column="1" colspan="5">
|
||||||
<widget class="QComboBox" name="comboBoxResolution"/>
|
<widget class="QComboBox" name="comboBoxResolution"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="60" column="3" colspan="2">
|
<item row="61" column="3" colspan="2">
|
||||||
<widget class="QToolButton" name="buttonValidationBasic">
|
<widget class="QToolButton" name="buttonValidationBasic">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -1449,6 +1449,29 @@ Fullscreen Exclusive Mode - game will cover entirety of your screen and will use
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="labelSaveBeforeBattle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save before battle</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" colspan="5">
|
||||||
|
<widget class="QToolButton" name="buttonSaveBeforeBattle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1009,6 +1009,11 @@ Fullscreen Exclusive Mode - game will cover entirety of your screen and will use
|
|||||||
<source>Autosave</source>
|
<source>Autosave</source>
|
||||||
<translation>自动存档</translation>
|
<translation>自动存档</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../settingsView/csettingsview_moc.ui" line="1455"/>
|
||||||
|
<source>Save before battle</source>
|
||||||
|
<translation>战斗前存档</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../settingsView/csettingsview_moc.ui" line="764"/>
|
<location filename="../settingsView/csettingsview_moc.ui" line="764"/>
|
||||||
<source>VSync</source>
|
<source>VSync</source>
|
||||||
|
@ -4276,10 +4276,21 @@ void CGameHandler::newObject(CGObjectInstance * object, PlayerColor initiator)
|
|||||||
|
|
||||||
void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, const BattleLayout & layout, const CGTownInstance *town)
|
void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, const BattleLayout & layout, const CGTownInstance *town)
|
||||||
{
|
{
|
||||||
|
if (settings["general"]["saveBeforeBattle"].Bool())
|
||||||
|
{
|
||||||
|
logGlobal->debug("gameHandler save before battle.");
|
||||||
|
save("Saves/BATTLE");
|
||||||
|
}
|
||||||
battles->startBattle(army1, army2, tile, hero1, hero2, layout, town);
|
battles->startBattle(army1, army2, tile, hero1, hero2, layout, town);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance *army2 )
|
void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance *army2 )
|
||||||
{
|
{
|
||||||
|
if (settings["general"]["saveBeforeBattle"].Bool())
|
||||||
|
{
|
||||||
|
logGlobal->debug("gameHandler save before battle.");
|
||||||
|
save("Saves/BATTLE");
|
||||||
|
}
|
||||||
|
|
||||||
battles->startBattle(army1, army2);
|
battles->startBattle(army1, army2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user