--- code/stats/medals.orig	Sat May 14 12:41:06 2005
+++ code/stats/medals.cpp	Sat May 14 14:57:33 2005
@@ -375,13 +375,11 @@
 	reset_parse();
 
 	// parse in all the rank names
-	medal_stuff temp_medal;
 	Num_medals = 0;
 	required_string("#Medals");
 	while ( required_string_either("#End", "$Name:") )
 	{
-		//Clear this
-		temp_medal = medal_stuff();
+		medal_stuff temp_medal;
 
 		required_string("$Name:");
 		stuff_string( temp_medal.name, F_NAME, NULL );
@@ -819,3 +817,24 @@
 	gr_bitmap(Medal_coords[gr_screen.res][RANK_MEDAL_REGION][0], Medal_coords[gr_screen.res][RANK_MEDAL_REGION][1]);
 }
 
+void medal_stuff::clone(const medal_stuff &m) {
+	memcpy(name, m.name, NAME_LENGTH);
+	memcpy(bitmap, m.bitmap, NAME_LENGTH);
+        num_versions = m.num_versions;
+	kills_needed = m.kills_needed;
+	memcpy(voice_base, m.voice_base, MAX_FILENAME_LEN);
+	if (m.promotion_text)
+		promotion_text = vm_strdup(m.promotion_text);
+	else
+		promotion_text = NULL;
+}
+
+// assignment operator
+const medal_stuff &medal_stuff::operator=(const medal_stuff &m) {
+	if (this != &m) {
+		if (promotion_text)
+			vm_free(promotion_text);
+		clone(m);
+	}
+	return *this;
+}
--- code/stats/medals.horig	Sat May 14 14:05:49 2005
+++ code/stats/medals.h	Sat May 14 14:57:36 2005
@@ -100,14 +100,18 @@
 	char	bitmap[NAME_LENGTH];
 	int	num_versions;
 	int	kills_needed;
-	int i;
 
 	//If this is a badge (kills_needed > 1)
 	char voice_base[MAX_FILENAME_LEN];
 	char *promotion_text;
 
-	medal_stuff(){name[0]='\0';bitmap[0]='\0';num_versions=1;kills_needed=0;i=0;voice_base[0]='\0';promotion_text=NULL;}
-	~medal_stuff(){if(promotion_text != NULL){mprintf(("Freeing promo: %s\n",promotion_text));vm_free(promotion_text);}}
+	medal_stuff(){name[0]='\0';bitmap[0]='\0';num_versions=1;kills_needed=0;voice_base[0]='\0';promotion_text=NULL;}
+	medal_stuff(const medal_stuff &m) {clone(m);}
+	~medal_stuff(){if(promotion_text)vm_free(promotion_text);}
+	const medal_stuff &operator=(const medal_stuff &m);
+
+private:
+	void clone(const medal_stuff &m);
 } medal_stuff;
 /*
 typedef struct badge_stuff {
