[Scummvm-git-logs] scummvm master -> 45771e098c00536eabd09b1c82b55df9e6e1f8c5

dreammaster paulfgilbert at gmail.com
Tue May 12 03:32:39 UTC 2020


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:
5f00f35354 ULTIMA4: Switch music over to use .mp3 files
45771e098c ULTIMA4: Better handling of LF in vendor scripts


Commit: 5f00f3535458adeb36c5e7dd0f44e78310e1ba20
    https://github.com/scummvm/scummvm/commit/5f00f3535458adeb36c5e7dd0f44e78310e1ba20
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-11T18:42:12-07:00

Commit Message:
ULTIMA4: Switch music over to use .mp3 files

The engine doesn't support the .it files xu4 used,
but luckily xu4 already included mp3 versions as well

Changed paths:
    devtools/create_ultima/files/ultima4/conf/music.xml


diff --git a/devtools/create_ultima/files/ultima4/conf/music.xml b/devtools/create_ultima/files/ultima4/conf/music.xml
index b97496c6b8..1bb0a4210c 100644
--- a/devtools/create_ultima/files/ultima4/conf/music.xml
+++ b/devtools/create_ultima/files/ultima4/conf/music.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
 <music>
-    <track file="wander4.it"/>
-    <track file="towne_2.it"/>
-    <track file="shrine.it"/>
-    <track file="merch.it"/>
-    <track file="rulebrit.it"/>
-    <track file="Fanfare_Of_Lord_British.mid"/>
-    <track file="dungeon.it"/>
-    <track file="combat4.it"/>
-    <track file="castle.it"/>
+    <track file="Wanderer.mp3"/>
+    <track file="Towns.mp3"/>
+    <track file="Shrines.mp3"/>
+    <track file="Shopping.mp3"/>
+    <track file="Rule_Britannia.mp3"/>
+    <track file="Fanfare_Of_Lord_British.mp3"/>
+    <track file="dungeon.mp3"/>
+    <track file="combat.mp3"/>
+    <track file="castles.mp3"/>
 </music>


Commit: 45771e098c00536eabd09b1c82b55df9e6e1f8c5
    https://github.com/scummvm/scummvm/commit/45771e098c00536eabd09b1c82b55df9e6e1f8c5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-11T20:32:20-07:00

Commit Message:
ULTIMA4: Better handling of LF in vendor scripts

Changed paths:
    engines/ultima/shared/conf/xml_node.cpp


diff --git a/engines/ultima/shared/conf/xml_node.cpp b/engines/ultima/shared/conf/xml_node.cpp
index f489e643e7..5d358d6eff 100644
--- a/engines/ultima/shared/conf/xml_node.cpp
+++ b/engines/ultima/shared/conf/xml_node.cpp
@@ -521,32 +521,28 @@ void XMLNode::freeDoc() {
 }
 
 void XMLNode::trim(Common::String &s) {
-	// Flag whether there's whitespaces at start and/or end
-	bool hasPrefixSpaces = !s.empty() && Common::isSpace(s[0]);
-	bool hasSuffixSpaces = !s.empty() && Common::isSpace(s.lastChar());
-
-	// Remove the spaces
-	while (!s.empty() && Common::isSpace(s[0]))
-		s.deleteChar(0);
-	while (!s.empty() && Common::isSpace(s.lastChar()))
-		s.deleteLastChar();
-
-	// Scan for any newlines, and if found, remove any whitespaces after them.
-	// This will properly handle indented XML
-	uint index = 0;
-	while ((index = s.findFirstOf('\n', index + 1)) != Common::String::npos) {
-		while (index < (s.size() - 1) && s[index + 1] != '\r' && s[index + 1] != '\n'
-			&& Common::isSpace(s[index + 1]))
-			s.deleteChar(index + 1);
-		if (index > 0 && s[index - 1] == '\r')
-			s.deleteChar(--index);
+	// Convert any CRLF to just LF
+	size_t pos;
+	while ((pos = s.find("\r\n")) != Common::String::npos)
+		s.deleteChar(pos);
+
+	// Then check if the string is entirely whitespace
+	bool hasContent = false;
+	for (uint idx = 0; idx < s.size() && !hasContent; ++idx)
+		hasContent = !Common::isSpace(s[idx]);
+
+	if (!hasContent) {
+		s = "";
+		return;
 	}
 
-	if (!s.empty()) {
-		if (hasPrefixSpaces)
-			s = " " + s;
-		if (hasSuffixSpaces)
-			s += " ";
+	// Remove any spaces from the very start of the string and following
+	// any linefeeds. This handles any indented text within the xml
+	for (size_t startPos = 0; startPos != Common::String::npos;
+			startPos = s.findFirstOf('\n', startPos + 1)) {
+		pos = (startPos == 0) ? 0 : startPos + 1;
+		while (pos < s.size() && s[pos] == ' ')
+			s.deleteChar(pos);
 	}
 }
 




More information about the Scummvm-git-logs mailing list