Just breaking stuff
This commit is contained in:
10
archive/dawnplatformergame/save/CMakeLists.txt
Normal file
10
archive/dawnplatformergame/save/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
DawnGameSaveManager.cpp
|
||||
)
|
28
archive/dawnplatformergame/save/DawnGameSaveManager.cpp
Normal file
28
archive/dawnplatformergame/save/DawnGameSaveManager.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "DawnGameSaveManager.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) {
|
||||
}
|
||||
|
||||
bool_t DawnGameSaveManager::validateSave(struct SaveFile raw) {
|
||||
if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true;
|
||||
this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DawnGameSaveManager::setExample(int32_t val) {
|
||||
savedata_t value;
|
||||
value.i32 = val;
|
||||
this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value);
|
||||
}
|
||||
|
||||
int32_t DawnGameSaveManager::getExample() {
|
||||
return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32;
|
||||
}
|
22
archive/dawnplatformergame/save/DawnGameSaveManager.hpp
Normal file
22
archive/dawnplatformergame/save/DawnGameSaveManager.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "save/SaveManager.hpp"
|
||||
|
||||
#define POKER_SAVE_KEY_EXAMPLE "poker.example"
|
||||
|
||||
namespace Dawn {
|
||||
class DawnGameSaveManager : public SaveManager {
|
||||
protected:
|
||||
virtual bool_t validateSave(struct SaveFile raw) override;
|
||||
|
||||
public:
|
||||
DawnGameSaveManager(DawnGame *game);
|
||||
|
||||
void setExample(int32_t value);
|
||||
int32_t getExample();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user