src/group_gui.cpp
branchnoai
changeset 9629 66dde6412125
parent 9624 b71483f2330f
child 9631 8a2d1c2ceb88
equal deleted inserted replaced
9628:b5c2449616b5 9629:66dde6412125
    76 	int r;
    76 	int r;
    77 
    77 
    78 	if (ga != last_group[0]) {
    78 	if (ga != last_group[0]) {
    79 		last_group[0] = ga;
    79 		last_group[0] = ga;
    80 		SetDParam(0, ga->index);
    80 		SetDParam(0, ga->index);
    81 		GetString(last_name[0], ga->string_id, lastof(last_name[0]));
    81 		GetString(last_name[0], STR_GROUP_NAME, lastof(last_name[0]));
    82 	}
    82 	}
    83 
    83 
    84 	if (gb != last_group[1]) {
    84 	if (gb != last_group[1]) {
    85 		last_group[1] = gb;
    85 		last_group[1] = gb;
    86 		SetDParam(0, gb->index);
    86 		SetDParam(0, gb->index);
    87 		GetString(last_name[1], gb->string_id, lastof(last_name[1]));
    87 		GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1]));
    88 	}
    88 	}
    89 
    89 
    90 	r = strcmp(last_name[0], last_name[1]); // sort by name
    90 	r = strcmp(last_name[0], last_name[1]); // sort by name
    91 
    91 
    92 	if (r == 0) return ga->index - gb->index;
    92 	if (r == 0) return ga->index - gb->index;
   342 					WIDGET_LIST_END);
   342 					WIDGET_LIST_END);
   343 
   343 
   344 			/* If selected_group == DEFAULT_GROUP, draw the standard caption
   344 			/* If selected_group == DEFAULT_GROUP, draw the standard caption
   345 			   We list all vehicles */
   345 			   We list all vehicles */
   346 			if (IsDefaultGroupID(gv->group_sel)) {
   346 			if (IsDefaultGroupID(gv->group_sel)) {
   347 				SetDParam(0, p->name_1);
   347 				SetDParam(0, p->index);
   348 				SetDParam(1, p->name_2);
   348 				SetDParam(1, gv->l.list_length);
   349 				SetDParam(2, gv->l.list_length);
       
   350 
   349 
   351 				switch (gv->vehicle_type) {
   350 				switch (gv->vehicle_type) {
   352 					case VEH_TRAIN:
   351 					case VEH_TRAIN:
   353 						w->widget[GRP_WIDGET_CAPTION].data = STR_881B_TRAINS;
   352 						w->widget[GRP_WIDGET_CAPTION].data = STR_881B_TRAINS;
   354 						w->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_TRAIN;
   353 						w->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_TRAIN;
   418 
   417 
   419 				y1 += PLY_WND_PRC__SIZE_OF_ROW_TINY;
   418 				y1 += PLY_WND_PRC__SIZE_OF_ROW_TINY;
   420 
   419 
   421 				/* draw the selected group in white, else we draw it in black */
   420 				/* draw the selected group in white, else we draw it in black */
   422 				SetDParam(0, g->index);
   421 				SetDParam(0, g->index);
   423 				DrawString(10, y1, STR_SV_GROUP_NAME, (gv->group_sel == g->index) ? 12 : 16);
   422 				DrawString(10, y1, STR_GROUP_NAME, (gv->group_sel == g->index) ? 12 : 16);
   424 
   423 
   425 				/* draw the number of vehicles of the group */
   424 				/* draw the number of vehicles of the group */
   426 				SetDParam(0, g->num_vehicle);
   425 				SetDParam(0, g->num_vehicle);
   427 				DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (gv->group_sel == g->index) ? 12 : 16);
   426 				DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (gv->group_sel == g->index) ? 12 : 16);
   428 			}
   427 			}
   565 					assert(!IsDefaultGroupID(gv->group_sel));
   564 					assert(!IsDefaultGroupID(gv->group_sel));
   566 
   565 
   567 					const Group *g = GetGroup(gv->group_sel);
   566 					const Group *g = GetGroup(gv->group_sel);
   568 
   567 
   569 					SetDParam(0, g->index);
   568 					SetDParam(0, g->index);
   570 					ShowQueryString(g->string_id, STR_GROUP_RENAME_CAPTION, 31, 150, w, CS_ALPHANUMERAL);
   569 					ShowQueryString(STR_GROUP_NAME, STR_GROUP_RENAME_CAPTION, 31, 150, w, CS_ALPHANUMERAL);
   571 				}	break;
   570 				}	break;
   572 
   571 
   573 
   572 
   574 				case GRP_WIDGET_AVAILABLE_VEHICLES:
   573 				case GRP_WIDGET_AVAILABLE_VEHICLES:
   575 					ShowBuildVehicleWindow(0, gv->vehicle_type);
   574 					ShowBuildVehicleWindow(0, gv->vehicle_type);