(svn r10316) -Codechange: (consistently) use index to refer to group names. Also the group string_id is irrelevant unless it is a custom name, so don't 'waste' a savegame string id.
authorpeter1138
Mon, 25 Jun 2007 07:33:40 +0000
changeset 7547 d13aad2aabd9
parent 7546 68de3f9d0809
child 7548 6139cecdb002
(svn r10316) -Codechange: (consistently) use index to refer to group names. Also the group string_id is irrelevant unless it is a custom name, so don't 'waste' a savegame string id.
src/group_cmd.cpp
src/group_gui.cpp
src/lang/english.txt
src/strings.cpp
--- a/src/group_cmd.cpp	Mon Jun 25 04:41:10 2007 +0000
+++ b/src/group_cmd.cpp	Mon Jun 25 07:33:40 2007 +0000
@@ -103,7 +103,7 @@
 
 	if (flags & DC_EXEC) {
 		g->owner = _current_player;
-		g->string_id = STR_SV_GROUP_NAME;
+		g->string_id = STR_EMPTY;
 		g->replace_protection = false;
 		g->vehicle_type = vt;
 
--- a/src/group_gui.cpp	Mon Jun 25 04:41:10 2007 +0000
+++ b/src/group_gui.cpp	Mon Jun 25 07:33:40 2007 +0000
@@ -78,13 +78,13 @@
 	if (ga != last_group[0]) {
 		last_group[0] = ga;
 		SetDParam(0, ga->index);
-		GetString(last_name[0], ga->string_id, lastof(last_name[0]));
+		GetString(last_name[0], STR_GROUP_NAME, lastof(last_name[0]));
 	}
 
 	if (gb != last_group[1]) {
 		last_group[1] = gb;
 		SetDParam(0, gb->index);
-		GetString(last_name[1], gb->string_id, lastof(last_name[1]));
+		GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1]));
 	}
 
 	r = strcmp(last_name[0], last_name[1]); // sort by name
@@ -420,7 +420,7 @@
 
 				/* draw the selected group in white, else we draw it in black */
 				SetDParam(0, g->index);
-				DrawString(10, y1, STR_SV_GROUP_NAME, (gv->group_sel == g->index) ? 12 : 16);
+				DrawString(10, y1, STR_GROUP_NAME, (gv->group_sel == g->index) ? 12 : 16);
 
 				/* draw the number of vehicles of the group */
 				SetDParam(0, g->num_vehicle);
@@ -567,7 +567,7 @@
 					const Group *g = GetGroup(gv->group_sel);
 
 					SetDParam(0, g->index);
-					ShowQueryString(g->string_id, STR_GROUP_RENAME_CAPTION, 31, 150, w, CS_ALPHANUMERAL);
+					ShowQueryString(STR_GROUP_NAME, STR_GROUP_RENAME_CAPTION, 31, 150, w, CS_ALPHANUMERAL);
 				}	break;
 
 
--- a/src/lang/english.txt	Mon Jun 25 04:41:10 2007 +0000
+++ b/src/lang/english.txt	Mon Jun 25 07:33:40 2007 +0000
@@ -2083,8 +2083,6 @@
 STR_SV_STNAME_HELIPORT                                          :{STRING1} Heliport
 STR_SV_STNAME_FOREST                                            :{STRING1} Forest
 
-STR_SV_GROUP_NAME                                               :{GROUP}
-
 ############ end of savegame specific region!
 
 ##id 0x6800
@@ -3340,6 +3338,7 @@
 STR_PROFIT_GOOD_THIS_YEAR_BAD_LAST_YEAR                         :{TINYFONT}{BLACK}Profit this year: {GREEN}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
 STR_PROFIT_BAD_THIS_YEAR_BAD_LAST_YEAR                          :{TINYFONT}{BLACK}Profit this year: {RED}{CURRENCY} {BLACK}(last year: {RED}{CURRENCY}{BLACK})
 
+STR_GROUP_NAME                                                  :{GROUP}
 STR_VEHICLE_NAME                                                :{VEHICLE}
 
 ########
--- a/src/strings.cpp	Mon Jun 25 04:41:10 2007 +0000
+++ b/src/strings.cpp	Mon Jun 25 07:33:40 2007 +0000
@@ -857,7 +857,7 @@
 				assert(IsValidGroup(g));
 
 				args[0] = g->index;
-				buff = GetStringWithArgs(buff, (g->string_id == STR_SV_GROUP_NAME) ? (StringID)STR_GROUP_NAME_FORMAT : g->string_id, args, last);
+				buff = GetStringWithArgs(buff, IsCustomName(g->string_id) ? g->string_id : (StringID)STR_GROUP_NAME_FORMAT, args, last);
 
 				break;
 			}