shithub: cstory

Download patch

ref: 3a837a109082ddff8363aa01a8cbc3fe23c66a5d
parent: 4766172c3b7307198ed3f8f580011c5e3e8f3937
author: Gabriel Ravier <gabravier@gmail.com>
date: Tue Sep 17 07:04:30 EDT 2019

Commented some code

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>

--- a/src/ArmsItem.cpp
+++ b/src/ArmsItem.cpp
@@ -42,10 +42,10 @@
 	while (i < ARMS_MAX)
 	{
 		if (gArmsData[i].code == code)
-			break;
+			break; // Found identical
 
 		if (gArmsData[i].code == 0)
-			break;
+			break; // Found free slot
 
 		++i;
 	}
@@ -55,6 +55,7 @@
 
 	if (gArmsData[i].code == 0)
 	{
+		// Initialize new weapon
 		memset(&gArmsData[i], 0, sizeof(ARMS));
 		gArmsData[i].level = 1;
 	}
@@ -77,12 +78,12 @@
 	int i;
 	for (i = 0; i < ARMS_MAX; ++i)
 		if (gArmsData[i].code == code)
-			break;
+			break; // Found
 
 #ifdef FIX_BUGS
 	if (i == ARMS_MAX)
 #else
-	if (i == ITEM_MAX) // Oops
+	if (i == ITEM_MAX) // Wrong
 #endif
 		return FALSE; // Not found
 
@@ -103,14 +104,15 @@
 	while (i < ARMS_MAX)
 	{
 		if (gArmsData[i].code == code1)
-			break;
+			break;	// Found
 
 		++i;
 	}
 
 	if (i == ARMS_MAX)
-		return FALSE;
+		return FALSE;	// Not found
 
+	// Initialize new weapon replacing old one, but adding the maximum ammunition to that of the old weapon.
 	gArmsData[i].level = 1;
 	gArmsData[i].code = code2;
 	gArmsData[i].max_num += max_num;
@@ -126,16 +128,16 @@
 	while (i < ITEM_MAX)
 	{
 		if (gItemData[i].code == code)
-			break; // Really, this could just return as the following code won't do anything meaningful in this case
+			break; // Found identical. Really, this could just return as the following code won't do anything meaningful in this case
 
 		if (gItemData[i].code == 0)
-			break;
+			break; // Found free slot
 
 		++i;
 	}
 
 	if (i == ITEM_MAX)
-		return FALSE;
+		return FALSE; // Not found
 
 	gItemData[i].code = code;