aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/saves.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-02 11:29:15 -1000
committerPaul Gilbert2015-01-02 11:29:15 -1000
commitbef5dbdc0a8640e3d51af5f1ef9ceb92ab930900 (patch)
treeb668d9bbb8eecd2b0f59dd38a61f868cdcf5bc96 /engines/xeen/saves.cpp
parentfeacce66b92f17c655d70ec2cc233fc63feb517c (diff)
downloadscummvm-rg350-bef5dbdc0a8640e3d51af5f1ef9ceb92ab930900.tar.gz
scummvm-rg350-bef5dbdc0a8640e3d51af5f1ef9ceb92ab930900.tar.bz2
scummvm-rg350-bef5dbdc0a8640e3d51af5f1ef9ceb92ab930900.zip
XEEN: Replaced conditions array with named field structure
Diffstat (limited to 'engines/xeen/saves.cpp')
-rw-r--r--engines/xeen/saves.cpp44
1 files changed, 41 insertions, 3 deletions
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp
index 771affc6bc..b3f1b4c71e 100644
--- a/engines/xeen/saves.cpp
+++ b/engines/xeen/saves.cpp
@@ -171,6 +171,46 @@ void Party::synchronize(Common::Serializer &s) {
/*------------------------------------------------------------------------*/
+Conditions::Conditions() {
+ _cursed = 0;
+ _heartBroken = 0;
+ _weak = 0;
+ _poisoned = 0;
+ _diseased = 0;
+ _insane = 0;
+ _inLove = 0;
+ _drunk = 0;
+ _asleep = 0;
+ _depressed = 0;
+ _confused = 0;
+ _paralyzed = 0;
+ _unconscious = 0;
+ _dead = 0;
+ _stoned = 0;
+ _eradicated = 0;
+}
+
+void Conditions::synchronize(Common::Serializer &s) {
+ s.syncAsByte(_cursed);
+ s.syncAsByte(_heartBroken);
+ s.syncAsByte(_weak);
+ s.syncAsByte(_poisoned);
+ s.syncAsByte(_diseased);
+ s.syncAsByte(_insane);
+ s.syncAsByte(_inLove);
+ s.syncAsByte(_drunk);
+ s.syncAsByte(_asleep);
+ s.syncAsByte(_depressed);
+ s.syncAsByte(_confused);
+ s.syncAsByte(_paralyzed);
+ s.syncAsByte(_unconscious);
+ s.syncAsByte(_dead);
+ s.syncAsByte(_stoned);
+ s.syncAsByte(_eradicated);
+}
+
+/*------------------------------------------------------------------------*/
+
PlayerStruct::PlayerStruct() {
_sex = MALE;
_race = HUMAN;
@@ -187,7 +227,6 @@ PlayerStruct::PlayerStruct() {
_currentSpell = 0;
_quickOption = 0;
_lloydSide = 0;
- Common::fill(&_conditions[0], &_conditions[16], 0);
_townUnknown = 0;
_unknown2 = 0;
_currentHp = 0;
@@ -253,8 +292,7 @@ void PlayerStruct::synchronize(Common::Serializer &s) {
_energyResistence.synchronize(s);
_magicResistence.synchronize(s);
- for (int i = 0; i < 16; ++i)
- s.syncAsByte(_conditions[i]);
+ _conditions.synchronize(s);
s.syncAsUint16LE(_townUnknown);
s.syncAsByte(_unknown2);