Changeset - r24445:3cdfd9b40e1a
[Not reviewed]
master
0 3 0
stormcone - 4 years ago 2020-09-13 21:24:46
48624099+stormcone@users.noreply.github.com
Feature: Show group name as part of the default vehicle name.

Only if the vehicle is member of a group and does not have a user defined name.
3 files changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/group_cmd.cpp
Show inline comments
 
@@ -453,12 +453,14 @@ CommandCost CmdAlterGroup(TileIndex tile
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type, 1);
 
		InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).Pack());
 
		InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
 
		InvalidateWindowClassesData(WC_VEHICLE_VIEW);
 
		InvalidateWindowClassesData(WC_VEHICLE_DETAILS);
 
	}
 

	
 
	return CommandCost();
 
}
 

	
 

	
 
@@ -542,12 +544,14 @@ CommandCost CmdAddVehicleGroup(TileIndex
 
		/* Update the Replace Vehicle Windows */
 
		SetWindowDirty(WC_REPLACE_VEHICLE, v->type);
 
		SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
 
		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 
		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 
		InvalidateWindowData(GetWindowClassForVehicleType(v->type), VehicleListIdentifier(VL_GROUP_LIST, v->type, _current_company).Pack());
 
		InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
 
		InvalidateWindowData(WC_VEHICLE_DETAILS, v->index);
 
	}
 

	
 
	return CommandCost();
 
}
 

	
 
/**
src/lang/english.txt
Show inline comments
 
@@ -5034,12 +5034,13 @@ STR_FORMAT_DATE_LONG                    
 
STR_FORMAT_DATE_ISO                                             :{2:NUM}-{1:RAW_STRING}-{0:RAW_STRING}
 

	
 
STR_FORMAT_BUOY_NAME                                            :{TOWN} Buoy
 
STR_FORMAT_BUOY_NAME_SERIAL                                     :{TOWN} Buoy #{COMMA}
 
STR_FORMAT_COMPANY_NUM                                          :(Company {COMMA})
 
STR_FORMAT_GROUP_NAME                                           :Group {COMMA}
 
STR_FORMAT_GROUP_VEHICLE_NAME                                   :{GROUP} #{COMMA}
 
STR_FORMAT_INDUSTRY_NAME                                        :{TOWN} {STRING}
 
STR_FORMAT_WAYPOINT_NAME                                        :{TOWN} Waypoint
 
STR_FORMAT_WAYPOINT_NAME_SERIAL                                 :{TOWN} Waypoint #{COMMA}
 

	
 
STR_FORMAT_DEPOT_NAME_TRAIN                                     :{TOWN} Train Depot
 
STR_FORMAT_DEPOT_NAME_TRAIN_SERIAL                              :{TOWN} Train Depot #{COMMA}
src/strings.cpp
Show inline comments
 
@@ -1464,12 +1464,17 @@ static char *FormatString(char *buff, co
 
				if (v == nullptr) break;
 

	
 
				if (!v->name.empty()) {
 
					int64 args_array[] = {(int64)(size_t)v->name.c_str()};
 
					StringParameters tmp_params(args_array);
 
					buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
 
				} else if (v->group_id != DEFAULT_GROUP) {
 
					/* The vehicle has no name, but is member of a group, so print group name */
 
					int64 args_array[] = {v->group_id, v->unitnumber};
 
					StringParameters tmp_params(args_array);
 
					buff = GetStringWithArgs(buff, STR_FORMAT_GROUP_VEHICLE_NAME, &tmp_params, last);
 
				} else {
 
					int64 args_array[] = {v->unitnumber};
 
					StringParameters tmp_params(args_array);
 

	
 
					StringID str;
 
					switch (v->type) {
0 comments (0 inline, 0 general)