src/station_cmd.cpp
changeset 8258 9fa31acb07bc
parent 8254 1496654ca5e7
child 8264 b1e85998c7d3
equal deleted inserted replaced
8257:3151fdbc73f9 8258:9fa31acb07bc
  2623 
  2623 
  2624 	if (!CheckOwnership(st->owner)) return CMD_ERROR;
  2624 	if (!CheckOwnership(st->owner)) return CMD_ERROR;
  2625 
  2625 
  2626 	if (!IsUniqueStationName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
  2626 	if (!IsUniqueStationName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
  2627 
  2627 
  2628 	StringID str = AllocateName(_cmd_text, 6);
       
  2629 	if (str == 0) return CMD_ERROR;
       
  2630 
       
  2631 	if (flags & DC_EXEC) {
  2628 	if (flags & DC_EXEC) {
  2632 		StringID old_str = st->string_id;
  2629 		free(st->name);
  2633 
  2630 		st->name = strdup(_cmd_text);
  2634 		st->string_id = str;
  2631 
  2635 		UpdateStationVirtCoord(st);
  2632 		UpdateStationVirtCoord(st);
  2636 		DeleteName(old_str);
       
  2637 		ResortStationLists();
  2633 		ResortStationLists();
  2638 		MarkWholeScreenDirty();
  2634 		MarkWholeScreenDirty();
  2639 	} else {
       
  2640 		DeleteName(str);
       
  2641 	}
  2635 	}
  2642 
  2636 
  2643 	return CommandCost();
  2637 	return CommandCost();
  2644 }
  2638 }
  2645 
  2639 
  3044 
  3038 
  3045 	/* alpha_order was stored here in savegame format 0 - 3 */
  3039 	/* alpha_order was stored here in savegame format 0 - 3 */
  3046 	SLE_CONDNULL(1, 0, 3),
  3040 	SLE_CONDNULL(1, 0, 3),
  3047 
  3041 
  3048 	    SLE_VAR(Station, string_id,                  SLE_STRINGID),
  3042 	    SLE_VAR(Station, string_id,                  SLE_STRINGID),
       
  3043 	SLE_CONDSTR(Station, name,                       SLE_STR, 0,                 84, SL_MAX_VERSION),
  3049 	    SLE_VAR(Station, had_vehicle_of_type,        SLE_UINT16),
  3044 	    SLE_VAR(Station, had_vehicle_of_type,        SLE_UINT16),
  3050 
  3045 
  3051 	    SLE_VAR(Station, time_since_load,            SLE_UINT8),
  3046 	    SLE_VAR(Station, time_since_load,            SLE_UINT8),
  3052 	    SLE_VAR(Station, time_since_unload,          SLE_UINT8),
  3047 	    SLE_VAR(Station, time_since_unload,          SLE_UINT8),
  3053 	    SLE_VAR(Station, delete_ctr,                 SLE_UINT8),
  3048 	    SLE_VAR(Station, delete_ctr,                 SLE_UINT8),