Stop storing preferences and legacy flags in the saved game

- Nuke global preference variables (they're now fetched with get_xxx_pref whenever needed)
- Nuke magic SDFs that store preferences and other info
- The only preferences now stored in the saved game are those related to difficulty
- play_sound no longer takes an option repeat parameter, but instead takes a delay which will be used if sounds are disabled
- SDF array increased to 350x50
- When saving a legacy scenario, a dialog is shown to remind you to update and to allow you to clear the legacy flag
This commit is contained in:
2015-10-06 18:01:35 -04:00
parent 906016b98d
commit d19880a463
28 changed files with 191 additions and 251 deletions

View File

@@ -14,8 +14,7 @@
#include "graphtool.hpp"
#include "restypes.hpp"
#include "mathutil.hpp"
extern bool play_sounds;
#include "prefs.hpp"
void cControl::setText(std::string l){
lbl = l;
@@ -210,7 +209,7 @@ bool cControl::handleClick(location){
depressed = frame.contains(e.mouseMove.x, e.mouseMove.y);
}
}
if(play_sounds) {
if(get_bool_pref("PlaySounds", true)) {
if(typeid(this) == typeid(cLed*))
play_sound(34);
else play_sound(37);

View File

@@ -23,13 +23,13 @@ using namespace ticpp;
#include "winutil.hpp"
#include "mathutil.hpp"
#include "cursors.hpp"
#include "prefs.hpp"
// TODO: Would be nice if I could avoid depending on mainPtr
extern sf::RenderWindow mainPtr;
extern cursor_type current_cursor;
extern sf::Texture bg_gworld;
extern bool play_sounds;
const short cDialog::BG_DARK = 5, cDialog::BG_LIGHT = 16;
short cDialog::defaultBackground = cDialog::BG_DARK;
cDialog* cDialog::topWindow = nullptr;
@@ -715,7 +715,7 @@ void cDialog::process_keystroke(cKey keyHit){
if(iter->second->isVisible() && iter->second->isClickable() && iter->second->getAttachedKey() == keyHit){
iter->second->setActive(true);
draw();
if(play_sounds) {
if(get_bool_pref("PlaySounds", true)) {
if(typeid(iter->second) == typeid(cLed*))
play_sound(34);
else play_sound(37);