Browse Source

End turn autosave support + making it default

Dydzio 2 years ago
parent
commit
ad66acdd79

+ 4 - 1
client/CPlayerInterface.cpp

@@ -235,7 +235,10 @@ void CPlayerInterface::yourTurn()
 		GH.curInt = this;
 
 		NotificationHandler::notify("Your turn");
-		performAutosave();
+		if(settings["general"]["startTurnAutosave"].Bool())
+		{
+			performAutosave();
+		}
 
 		if (CSH->howManyPlayerInterfaces() > 1) //hot seat message
 		{

+ 1 - 2
client/CPlayerInterface.h

@@ -205,6 +205,7 @@ public: // public interface for use by client via LOCPLINT access
 	void tryDigging(const CGHeroInstance *h);
 	void showShipyardDialogOrProblemPopup(const IShipyard *obj); //obj may be town or shipyard;
 	void proposeLoadingGame();
+	void performAutosave();
 
 	///returns true if all events are processed internally
 	bool capturedAllEvents();
@@ -236,8 +237,6 @@ private:
 	void doMoveHero(const CGHeroInstance *h, CGPath path);
 	void setMovementStatus(bool value);
 
-	/// Performs autosave, if needed according to settings
-	void performAutosave();
 };
 
 /// Provides global access to instance of interface of currently active player

+ 6 - 0
client/adventureMap/AdventureMapInterface.cpp

@@ -418,6 +418,12 @@ void AdventureMapInterface::hotkeyEndingTurn()
 
 	LOCPLINT->makingTurn = false;
 	LOCPLINT->cb->endTurn();
+
+	if(!settings["general"]["startTurnAutosave"].Bool())
+	{
+		LOCPLINT->performAutosave();
+	}
+
 	mapAudio->onPlayerTurnEnded();
 }
 

+ 6 - 1
config/schemas/settings.json

@@ -37,7 +37,8 @@
 				"longTouchTimeMilliseconds",
 				"autosaveCountLimit",
 				"useSavePrefix",
-				"savePrefix"
+				"savePrefix",
+				"startTurnAutosave"
 			],
 			"properties" : {
 				"playerName" : {
@@ -121,6 +122,10 @@
 				"savePrefix" : {
 					"type": "string",
 					"default": ""
+				},
+				"startTurnAutosave" : {
+					"type": "boolean",
+					"default": false
 				}
 			}
 		},