src/station_cmd.cpp
branchNewGRF_ports
changeset 6733 240d846d5149
parent 6732 ca1b466db422
child 6734 6e4db2fda167
equal deleted inserted replaced
6732:ca1b466db422 6733:240d846d5149
  2875 			if (st->speclist[i].grfid == 0) continue;
  2875 			if (st->speclist[i].grfid == 0) continue;
  2876 
  2876 
  2877 			st->speclist[i].spec = GetCustomStationSpecByGrf(st->speclist[i].grfid, st->speclist[i].localidx);
  2877 			st->speclist[i].spec = GetCustomStationSpecByGrf(st->speclist[i].grfid, st->speclist[i].localidx);
  2878 		}
  2878 		}
  2879 
  2879 
       
  2880 		for (uint i = 0; i < st->num_fsmportsspecs; i++) {
       
  2881 			if (st->fsmportsspeclist[i].grfid == 0) continue;
       
  2882 
       
  2883 			st->fsmportsspeclist[i].spec = GetCustomFSMportsSpecByGrf(st->fsmportsspeclist[i].grfid, st->fsmportsspeclist[i].localidx);
       
  2884 		}
       
  2885 
  2880 		for (CargoID c = 0; c < NUM_CARGO; c++) st->goods[c].cargo.InvalidateCache();
  2886 		for (CargoID c = 0; c < NUM_CARGO; c++) st->goods[c].cargo.InvalidateCache();
  2881 	}
  2887 	}
  2882 }
  2888 }
  2883 
  2889 
  2884 
  2890 
  2963 
  2969 
  2964 	/* Used by newstations for graphic variations */
  2970 	/* Used by newstations for graphic variations */
  2965 	SLE_CONDVAR(Station, random_bits,                SLE_UINT16,                 27, SL_MAX_VERSION),
  2971 	SLE_CONDVAR(Station, random_bits,                SLE_UINT16,                 27, SL_MAX_VERSION),
  2966 	SLE_CONDVAR(Station, waiting_triggers,           SLE_UINT8,                  27, SL_MAX_VERSION),
  2972 	SLE_CONDVAR(Station, waiting_triggers,           SLE_UINT8,                  27, SL_MAX_VERSION),
  2967 	SLE_CONDVAR(Station, num_specs,                  SLE_UINT8,                  27, SL_MAX_VERSION),
  2973 	SLE_CONDVAR(Station, num_specs,                  SLE_UINT8,                  27, SL_MAX_VERSION),
       
  2974 	SLE_CONDVAR(Station, num_fsmportsspecs,          SLE_UINT8,                  73, SL_MAX_VERSION),
  2968 
  2975 
  2969 	SLE_CONDLST(Station, loading_vehicles,           REF_VEHICLE,                57, SL_MAX_VERSION),
  2976 	SLE_CONDLST(Station, loading_vehicles,           REF_VEHICLE,                57, SL_MAX_VERSION),
  2970 
  2977 
  2971 	// reserve extra space in savegame here. (currently 32 bytes)
  2978 	// reserve extra space in savegame here. (currently 32 bytes)
  2972 	SLE_CONDNULL(32, 2, SL_MAX_VERSION),
  2979 	SLE_CONDNULL(32, 2, SL_MAX_VERSION),
  3000 };
  3007 };
  3001 
  3008 
  3002 static const SaveLoad _station_speclist_desc[] = {
  3009 static const SaveLoad _station_speclist_desc[] = {
  3003 	SLE_CONDVAR(StationSpecList, grfid,    SLE_UINT32, 27, SL_MAX_VERSION),
  3010 	SLE_CONDVAR(StationSpecList, grfid,    SLE_UINT32, 27, SL_MAX_VERSION),
  3004 	SLE_CONDVAR(StationSpecList, localidx, SLE_UINT8,  27, SL_MAX_VERSION),
  3011 	SLE_CONDVAR(StationSpecList, localidx, SLE_UINT8,  27, SL_MAX_VERSION),
       
  3012 
       
  3013 	SLE_END()
       
  3014 };
       
  3015 
       
  3016 static const SaveLoad _fsmports_speclist_desc[] = {
       
  3017 	SLE_CONDVAR(FSMportsSpecList, grfid,    SLE_UINT32, 73, SL_MAX_VERSION),
       
  3018 	SLE_CONDVAR(FSMportsSpecList, localidx, SLE_UINT8,  73, SL_MAX_VERSION),
  3005 
  3019 
  3006 	SLE_END()
  3020 	SLE_END()
  3007 };
  3021 };
  3008 
  3022 
  3009 
  3023 
  3042 		if (st->speclist == NULL) st->speclist = CallocT<StationSpecList>(st->num_specs);
  3056 		if (st->speclist == NULL) st->speclist = CallocT<StationSpecList>(st->num_specs);
  3043 		for (uint i = 0; i < st->num_specs; i++) {
  3057 		for (uint i = 0; i < st->num_specs; i++) {
  3044 			SlObject(&st->speclist[i], _station_speclist_desc);
  3058 			SlObject(&st->speclist[i], _station_speclist_desc);
  3045 		}
  3059 		}
  3046 	}
  3060 	}
       
  3061 
       
  3062 	if (st->num_fsmportsspecs != 0) {
       
  3063 		/* Allocate fsmspeclist memory when loading a game */
       
  3064 		if (st->fsmportsspeclist == NULL) st->fsmportsspeclist = CallocT<FSMportsSpecList>(st->num_fsmportsspecs);
       
  3065 		for (uint i = 0; i < st->num_fsmportsspecs; i++) {
       
  3066 			SlObject(&st->fsmportsspeclist[i], _fsmports_speclist_desc);
       
  3067 		}
       
  3068 	}
  3047 }
  3069 }
  3048 
  3070 
  3049 static void Save_STNS()
  3071 static void Save_STNS()
  3050 {
  3072 {
  3051 	Station *st;
  3073 	Station *st;