summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/load_save_command.dart
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/core/commands/load_save_command.dart')
-rw-r--r--server/lib/core/commands/load_save_command.dart22
1 files changed, 22 insertions, 0 deletions
diff --git a/server/lib/core/commands/load_save_command.dart b/server/lib/core/commands/load_save_command.dart
new file mode 100644
index 0000000..56bd22e
--- /dev/null
+++ b/server/lib/core/commands/load_save_command.dart
@@ -0,0 +1,22 @@
+import '../state/game_state.dart';
+import 'command_l10n.dart';
+
+class LoadSaveCommand extends Command {
+ String saveName;
+ String saveData;
+ final GameState _gameState;
+
+ LoadSaveCommand(this.saveName, this.saveData, {required GameState gameState})
+ : _gameState = gameState;
+
+ @override
+ void execute() {
+ _gameState.loadFromData(saveData);
+ _gameState.save();
+ }
+
+ @override
+ String describe() {
+ return commandL10n.cmdLoadGame(saveName);
+ }
+}