diff options
author | Max Horn | 2003-01-12 21:53:25 +0000 |
---|---|---|
committer | Max Horn | 2003-01-12 21:53:25 +0000 |
commit | 1f88542417b58ce2e71708217f17ebcc7de78c20 (patch) | |
tree | 539c840e8ea97a50bbf0de9571ccebb4ecb599bb /scumm/object.cpp | |
parent | 454fc651c05c7a416e935462910b45699ea29948 (diff) | |
download | scummvm-rg350-1f88542417b58ce2e71708217f17ebcc7de78c20.tar.gz scummvm-rg350-1f88542417b58ce2e71708217f17ebcc7de78c20.tar.bz2 scummvm-rg350-1f88542417b58ce2e71708217f17ebcc7de78c20.zip |
don't lock/unlock if resource was already locked
svn-id: r6439
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r-- | scumm/object.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index d50db53477..2419e2581a 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -1656,6 +1656,7 @@ void Scumm::loadFlObject(uint object, uint room) ObjectData *od; byte *flob; uint32 obcd_size, obim_size, flob_size; + bool isRoomLocked, isRoomScriptsLocked; // Don't load an already loaded object if (whereIsObject(object) != WIO_NOT_FOUND) @@ -1690,8 +1691,11 @@ void Scumm::loadFlObject(uint object, uint room) // Lock room/roomScripts for the given room. They contains the OBCD/OBIM // data, and a call to createResource might expire them, hence we lock them. - lock(rtRoom, room); - if (_features & GF_AFTER_V8) + isRoomLocked = res.flags[rtRoom][room] & RF_LOCK; + isRoomScriptsLocked = res.flags[rtRoomScripts][room] & RF_LOCK; + if (!isRoomLocked) + lock(rtRoom, room); + if (_features & GF_AFTER_V8 && !isRoomScriptsLocked) lock(rtRoomScripts, room); // Allocate slot & memory for floating object @@ -1708,8 +1712,9 @@ void Scumm::loadFlObject(uint object, uint room) memcpy(flob + 8 + obcd_size, foir.obim, obim_size); // Unlock room/roomScripts - unlock(rtRoom, room); - if (_features & GF_AFTER_V8) + if (!isRoomLocked) + unlock(rtRoom, room); + if (_features & GF_AFTER_V8 && !isRoomScriptsLocked) unlock(rtRoomScripts, room); // Setup local object flags |