[Scummvm-cvs-logs] scummvm master -> 594be43d793545b3404c4d9adedd89992af4e160

dreammaster dreammaster at scummvm.org
Tue Nov 17 02:55:16 CET 2015


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f8b36bf855 LURE: Simplify StringList class
594be43d79 LURE: Fix spelling of Observar in Spanish version


Commit: f8b36bf8551c374616b88773b3b03e8c73092c8d
    https://github.com/scummvm/scummvm/commit/f8b36bf8551c374616b88773b3b03e8c73092c8d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-11-16T20:48:01-05:00

Commit Message:
LURE: Simplify StringList class

Changed paths:
    engines/lure/res_struct.cpp
    engines/lure/res_struct.h



diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index 5a4761c..73efc3a 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 count = 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 < count; ++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
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 9190912..72cfa2f 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -28,6 +28,7 @@
 #include "common/list.h"
 #include "common/file.h"
 #include "common/ptr.h"
+#include "common/str-array.h"
 #include "common/textconsole.h"
 
 namespace Lure {
@@ -850,19 +851,15 @@ enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTOR
 
 class StringList {
 private:
-	MemoryBlock *_data;
-	int _numEntries;
-	char **_entries;
+	Common::StringArray _entries;
 public:
-	StringList() { _numEntries = 0; }
-	~StringList() { clear(); }
+	StringList() {}
 
 	void load(MemoryBlock *data);
 	void clear();
-	int count() { return _numEntries; }
+	int count() { return _entries.size(); }
 	const char *getString(int index) {
-		if ((index < 0) || (index >= _numEntries)) error("Invalid index specified to String List");
-		return _entries[index];
+		return _entries[index].c_str();
 	}
 	const char *getString(Action action) { return getString((int) action - 1); }
 	const char *getString(StringEnum sEnum) { return getString((int) sEnum); }


Commit: 594be43d793545b3404c4d9adedd89992af4e160
    https://github.com/scummvm/scummvm/commit/594be43d793545b3404c4d9adedd89992af4e160
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-11-16T20:54:17-05:00

Commit Message:
LURE: Fix spelling of Observar in Spanish version

Changed paths:
    engines/lure/res.cpp
    engines/lure/res_struct.h



diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 6b27054..7a79f48 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -44,6 +44,10 @@ Resources::Resources() : _rnd(LureEngine::getReference().rnd()) {
 	MemoryBlock *mb = Disk::getReference().getEntry(STRING_LIST_RESOURCE_ID);
 	_stringList.load(mb);
 	delete mb;
+
+	// WORKAROUND: In Spanish the look "Obsevar" should be "Observar"
+	if (!Common::String(_stringList.getString(LOOK)).compareTo("Obsevar"))
+		_stringList.setString(LOOK, "Observar");
 }
 
 Resources::~Resources() {
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 72cfa2f..685c55a 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -863,6 +863,7 @@ public:
 	}
 	const char *getString(Action action) { return getString((int) action - 1); }
 	const char *getString(StringEnum sEnum) { return getString((int) sEnum); }
+	void setString(Action action, const Common::String &s) { _entries[(int)action - 1] = s; }
 };
 
 // The following class holds the field list used by the script engine as






More information about the Scummvm-git-logs mailing list