[Scummvm-cvs-logs] scummvm master -> d3d2f6060e8e1fe4ca9c202cd7bef9717dc198d1

urukgit urukgit at users.noreply.github.com
Fri Dec 20 09:23:23 CET 2013


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

Summary:
d3d2f6060e AVALANACHE: Minor bug fix and coding convention fix.


Commit: d3d2f6060e8e1fe4ca9c202cd7bef9717dc198d1
    https://github.com/scummvm/scummvm/commit/d3d2f6060e8e1fe4ca9c202cd7bef9717dc198d1
Author: uruk (koppirnyo at gmail.com)
Date: 2013-12-20T00:22:45-08:00

Commit Message:
AVALANACHE: Minor bug fix and coding convention fix.

Changed paths:
    engines/avalanche/nim.cpp



diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp
index c0ada30..7e3382a 100644
--- a/engines/avalanche/nim.cpp
+++ b/engines/avalanche/nim.cpp
@@ -258,7 +258,10 @@ void Nim::takeSome() {
 		do {
 			sr = _stones[_row];
 			if (sr == 0) {
-				_row = _row % 2 + 1;
+				if (_row == 2)
+					_row = 0;
+				else
+					_row++;
 				_number = 1;
 			}
 		} while (sr == 0);
@@ -393,53 +396,53 @@ void Nim::dogFood() {
 		}
 		return;
 	case 3: {
-				// Ho hum... this'll be difficult!
-				// There are three possible courses of action when we have 3 lines left:
-				// 1) Look for 2 equal lines, then take the odd one out.
-				// 2) Look for A.P.s, and capitalise on them.
-				// 3) Go any old where.
-				const byte other[3][2] = { { 2, 3 }, { 1, 3 }, { 1, 2 } };
-
-				for (int i = 0; i < 3; i++) { // Look for 2 equal lines.
-					if (_stones[other[i][0]] == _stones[other[i][1]]) {
-						_row = i; // This row.
-						_number = _stones[i]; // All of 'em.
-						return;
-					}
-				}
+		// Ho hum... this'll be difficult!
+		// There are three possible courses of action when we have 3 lines left:
+		// 1) Look for 2 equal lines, then take the odd one out.
+		// 2) Look for A.P.s, and capitalise on them.
+		// 3) Go any old where.
+		const byte other[3][2] = { { 2, 3 }, { 1, 3 }, { 1, 2 } };
+
+		for (int i = 0; i < 3; i++) { // Look for 2 equal lines.
+			if (_stones[other[i][0]] == _stones[other[i][1]]) {
+				_row = i; // This row.
+				_number = _stones[i]; // All of 'em.
+				return;
+			}
+		}
 
-				bool sorted;
-				do {
-					sorted = true;
-					for (int i = 0; i < 2; i++) {
-						if (sr[i] > sr[i + 1]) {
-							byte temp = sr[i + 1];
-							sr[i + 1] = sr[i];
-							sr[i] = temp;
-
-							temp = _r[i + 1];
-							_r[i + 1] = _r[i];
-							_r[i] = temp;
-
-							sorted = false;
-						}
-					}
-				} while (!sorted);
-
-				// Now we look for A.P.s...
-				for (int i = 0; i < 3; i++) {
-					findAp(i, 1); // There are 3 "1"s.
-					if (_lmo)
-						return; // Cut - out.
+		bool sorted;
+		do {
+			sorted = true;
+			for (int i = 0; i < 2; i++) {
+				if (sr[i] > sr[i + 1]) {
+					byte temp = sr[i + 1];
+					sr[i + 1] = sr[i];
+					sr[i] = temp;
+
+					temp = _r[i + 1];
+					_r[i + 1] = _r[i];
+					_r[i] = temp;
+
+					sorted = false;
 				}
-				findAp(1, 2); // Only "2" possible.
-				if (_lmo)
-					return;
+			}
+		} while (!sorted);
 
-				// A.P.search must have failed - use the default move.
-				_row = _r[2];
-				_number = 1;
-				return;
+		// Now we look for A.P.s...
+		for (int i = 0; i < 3; i++) {
+			findAp(i, 1); // There are 3 "1"s.
+			if (_lmo)
+				return; // Cut - out.
+		}
+		findAp(1, 2); // Only "2" possible.
+		if (_lmo)
+			return;
+
+		// A.P.search must have failed - use the default move.
+		_row = _r[2];
+		_number = 1;
+		return;
 	}
 	default:
 		break;






More information about the Scummvm-git-logs mailing list