aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/res_struct.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2008-01-10 09:22:46 +0000
committerPaul Gilbert2008-01-10 09:22:46 +0000
commitfee6362147b5132a624b0d061460241a9a5ed055 (patch)
tree80204ce5cb3656319b012a1b3171965ae2af5455 /engines/lure/res_struct.cpp
parent1886d498ed877264cad22da9fa36f3794cff666c (diff)
downloadscummvm-rg350-fee6362147b5132a624b0d061460241a9a5ed055.tar.gz
scummvm-rg350-fee6362147b5132a624b0d061460241a9a5ed055.tar.bz2
scummvm-rg350-fee6362147b5132a624b0d061460241a9a5ed055.zip
Bugfix for incorrect data being saved for the current NPC the barmen are serving
svn-id: r30365
Diffstat (limited to 'engines/lure/res_struct.cpp')
-rw-r--r--engines/lure/res_struct.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index ffcb6fa8be..4a39f2db20 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -1162,7 +1162,8 @@ BarEntry &BarmanLists::getDetails(uint16 roomNumber) {
void BarmanLists::saveToStream(Common::WriteStream *stream) {
for (int index = 0; index < 2; ++index) {
- uint16 value = (_barList[index].currentCustomer - &_barList[index].customers[0]) / sizeof(BarEntry);
+ uint16 value = (_barList[index].currentCustomer == NULL) ? 0 :
+ (_barList[index].currentCustomer - &_barList[index].customers[0]) / sizeof(BarEntry) + 1;
stream->writeUint16LE(value);
for (int ctr = 0; ctr < NUM_SERVE_CUSTOMERS; ++ctr) {
stream->writeUint16LE(_barList[index].customers[ctr].hotspotId);
@@ -1174,7 +1175,7 @@ void BarmanLists::saveToStream(Common::WriteStream *stream) {
void BarmanLists::loadFromStream(Common::ReadStream *stream) {
for (int index = 0; index < 2; ++index) {
int16 value = stream->readUint16LE();
- _barList[index].currentCustomer = (value == 0) ? NULL : &_barList[index].customers[value];
+ _barList[index].currentCustomer = (value == 0) ? NULL : &_barList[index].customers[value - 1];
for (int ctr = 0; ctr < NUM_SERVE_CUSTOMERS; ++ctr) {
_barList[index].customers[ctr].hotspotId = stream->readUint16LE();