rpms/warzone2100/F-9 warzone2100_fixsave.patch, NONE, 1.1 warzone2100.spec, 1.19, 1.20

Karol Trzcionka karlik at fedoraproject.org
Sun Nov 16 10:16:54 UTC 2008


Author: karlik

Update of /cvs/pkgs/rpms/warzone2100/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13597

Modified Files:
	warzone2100.spec 
Added Files:
	warzone2100_fixsave.patch 
Log Message:
- Fix game-crash while saving and loading (svn revision 6283)
- Update License tag



warzone2100_fixsave.patch:

--- NEW FILE warzone2100_fixsave.patch ---
--- ./src/multiplay.h	2008/11/13 22:42:02	6282
+++ ./src/multiplay.h	2008/11/13 22:42:05	6283
@@ -118,9 +118,9 @@
 extern WZ_DECL_WARN_UNUSED_RESULT DROID_TEMPLATE	*IdToTemplate(UDWORD tempId,UDWORD player);
 extern WZ_DECL_WARN_UNUSED_RESULT DROID_TEMPLATE	*NameToTemplate(const char *sName,UDWORD player);
 
-extern char *getPlayerName	(UDWORD player);
+extern const char* getPlayerName(unsigned int player);
 extern BOOL setPlayerName		(UDWORD player, const char *sName);
-extern char *getPlayerColourName(SDWORD player);
+extern const char* getPlayerColourName(unsigned int player);
 extern BOOL isHumanPlayer		(UDWORD player);				//to tell if the player is a computer or not.
 extern BOOL myResponsibility	(UDWORD player);
 extern BOOL responsibleFor		(UDWORD player, UDWORD playerinquestion);
--- ./src/multiplay.c	2008/11/13 22:42:02	6282
+++ ./src/multiplay.c	2008/11/13 22:42:05	6283
@@ -80,7 +80,6 @@
 
 BOOL						bSendingMap					= false;	// map broadcasting.
 
-char						tempString[12];
 char						beaconReceiveMsg[MAX_PLAYERS][MAX_CONSOLE_STRING_LENGTH];	//beacon msg for each player
 char								playerName[MAX_PLAYERS][MAX_STR_LENGTH];	//Array to store all player names (humans and AIs)
 BOOL						bPlayerReadyGUI[MAX_PLAYERS] = {false};
@@ -433,7 +432,7 @@
 
 // ////////////////////////////////////////////////////////////////////////////
 // return a players name.
-char *getPlayerName(UDWORD player)
+const char* getPlayerName(unsigned int player)
 {
 	UDWORD i;
 
@@ -455,7 +454,7 @@
 				return getPlayerColourName(player);
 			}
 
-			return (char*)&NetPlay.players[i].name;
+			return NetPlay.players[i].name;
 		}
 	}
 
@@ -1903,35 +1902,28 @@
 	return addBeaconBlip(locX, locY, receiver, sender, beaconReceiveMsg[sender]);
 }
 
-static const char* playerColors[] =
+const char* getPlayerColourName(unsigned int player)
 {
-	N_("Green"),
-	N_("Orange"),
-	N_("Grey"),
-	N_("Black"),
-	N_("Red"),
-	N_("Blue"),
-	N_("Pink"),
-	N_("Cyan")
-};
-
-char *getPlayerColourName(SDWORD player)
-{
-	static const unsigned int end = sizeof(playerColors) / sizeof(const char*);
+	static const char* playerColors[] =
+	{
+		N_("Green"),
+		N_("Orange"),
+		N_("Grey"),
+		N_("Black"),
+		N_("Red"),
+		N_("Blue"),
+		N_("Pink"),
+		N_("Cyan")
+	};
 
-	ASSERT(player < end,
-	       "getPlayerColourName: player number (%d) exceeds maximum (%d)\n", player, end - 1);
+	ASSERT(player < ARRAY_SIZE(playerColors), "player number (%d) exceeds maximum (%zu)", player, ARRAY_SIZE(playerColors));
 
-	if (player < end)
-	{
-		strcpy(tempString, _(playerColors[ getPlayerColour(player) ]));
-	}
-	else
+	if (player >= ARRAY_SIZE(playerColors))
 	{
-		tempString[0] = '0';
+		return "";
 	}
 
-	return tempString;
+	return gettext(playerColors[getPlayerColour(player)]);
 }
 
 /*
--- ./src/scriptfuncs.c	2008/11/13 22:42:02	6282
+++ ./src/scriptfuncs.c	2008/11/13 22:42:05	6283
@@ -5919,7 +5919,10 @@
 		return false;
 	}
 
-	scrFunctionResult.v.sval = getPlayerColourName(player);
+	/* Casting away constness because stackPushResult doesn't modify it's
+	 * value (i.e. in this case it's not const correct).
+	 */
+	scrFunctionResult.v.sval = (char*)getPlayerColourName(player);
 	if (!stackPushResult(VAL_STRING, &scrFunctionResult))
 	{
 		debug(LOG_ERROR, "scrGetPlayerColourName(): failed to push result");
@@ -10745,7 +10748,10 @@
 		return false;
 	}
 
-	scrFunctionResult.v.sval = getPlayerName((UDWORD)player);
+	/* Casting away constness because stackPushResult doesn't modify it's
+	 * value (i.e. in this case it's not const correct).
+	 */
+	scrFunctionResult.v.sval = (char*)getPlayerName((UDWORD)player);
 	if (!stackPushResult(VAL_STRING, &scrFunctionResult))
 	{
 		debug(LOG_ERROR, "scrGetPlayerName(): failed to push result");
@@ -10791,7 +10797,7 @@
 	{
 		/* check name */
 		//debug(LOG_SCRIPT, "checking  (%s,%s)",getPlayerName(playerIndex), playerName);
-		if (strncasecmp(getPlayerName(playerIndex),playerName, 255) == 0)
+		if (strncasecmp(getPlayerName(playerIndex), playerName, 255) == 0)
 		{
 			//debug(LOG_SCRIPT, "matched, returning %d", playerIndex);
 			return playerIndex;
@@ -10799,7 +10805,7 @@
 
 		/* check color */
 		//debug(LOG_SCRIPT, "checking (%s,%s)",getPlayerColourName(playerIndex), playerName);
-		if (strncasecmp(getPlayerColourName(playerIndex),playerName, 255) == 0)
+		if (strncasecmp(getPlayerColourName(playerIndex), playerName, 255) == 0)
 		{
 			//debug(LOG_SCRIPT, "matched, returning %d", playerIndex);
 			return playerIndex;


Index: warzone2100.spec
===================================================================
RCS file: /cvs/pkgs/rpms/warzone2100/F-9/warzone2100.spec,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- warzone2100.spec	4 Oct 2008 15:09:06 -0000	1.19
+++ warzone2100.spec	16 Nov 2008 10:16:24 -0000	1.20
@@ -1,12 +1,13 @@
 Name:           warzone2100
 Version:        2.1.0
-Release:        0.6.beta5%{?dist}
+Release:        0.7.beta5%{?dist}
 Summary:        Innovative 3D real-time strategy
 
 Group:          Amusements/Games
-License:        GPLv2+
+License:        GPLv2+ and CC-BY-SA
 URL:            http://wz2100.net/
 Source0:        http://download.gna.org/warzone/releases/2.0/%{name}-2.1_beta5.tar.bz2
+Patch0:         warzone2100_fixsave.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: physfs-devel SDL_net-devel openal-devel bison flex zip
@@ -25,9 +26,10 @@
 
 %prep
 %setup -q -n %{name}-2.1_beta5
+%patch0
 
 %build
-%configure --disable-mp3 --with-distributor="Fedora"
+%configure --disable-rpath --with-distributor="Fedora"
 make %{_smp_mflags}
 
 %install
@@ -50,9 +52,12 @@
 %{_datadir}/icons/warzone*
 %{_datadir}/applications/fedora-%{name}.desktop
 %{_datadir}/warzone2100
-%doc AUTHORS ChangeLog COPYING COPYING.README
+%doc AUTHORS ChangeLog COPYING COPYING.NONGPL COPYING.README
 
 %changelog
+* Sun Nov 16 2008 Karol Trzcionka <karlikt at gmail.com> - 2.1.0-0.7.beta5
+- Fix game-crash while saving and loading (svn revision 6283)
+- Update License tag
 * Sat Oct 04 2008 Karol Trzcionka <karlikt at gmail.com> - 2.1.0-0.6.beta5
 - Update to v2.1.0-beta5
 * Tue Apr 22 2008 Karol Trzcionka <karlikt at gmail.com> - 2.1.0-0.5.beta2




More information about the scm-commits mailing list