diff options
Diffstat (limited to 'engines/lure/res_struct.cpp')
-rw-r--r-- | engines/lure/res_struct.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 5a4761c87b..ec1a546d05 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -1217,26 +1217,19 @@ void BarmanLists::loadFromStream(Common::ReadStream *stream) { // String list resource class void StringList::load(MemoryBlock *data) { - _data = Memory::allocate(data->size()); - _data->copyFrom(data); + // Get the number of entries + uint numEntries = READ_LE_UINT16(data->data()); - _numEntries = READ_LE_UINT16(_data->data()); - char *p = (char *) _data->data() + sizeof(uint16); - - _entries = (char **) Memory::alloc(_numEntries * sizeof(char *)); - - for (int index = 0; index < _numEntries; ++index) { - _entries[index] = p; + // Iterate through loading the strings one at a time + const char *p = (const char *)data->data() + sizeof(uint16); + for (uint index = 0; index < numEntries; ++index) { + _entries.push_back(p); p += strlen(p) + 1; } } void StringList::clear() { - if (_numEntries != 0) { - Memory::dealloc(_entries); - delete _data; - _numEntries = 0; - } + _entries.clear(); } // Field list and miscellaneous variables |