mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
trains in one game (instead of the 240 which was the current value). Default max allowed vehicles per type is changed: Trains: 500 (old 80) Road: 500 (old 80) Ships: 200 (old 40) Aicraft: 300 (old 50) (Tnx to Celestar and Darkvater for checking the patch)
This commit is contained in:
parent
7be92db76f
commit
97728357e4
|
@ -156,7 +156,7 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
{
|
||||
int32 value;
|
||||
Vehicle *vl[3], *v, *u, *w;
|
||||
byte unit_num;
|
||||
UnitID unit_num;
|
||||
uint tile = TILE_FROM_XY(x,y);
|
||||
const AircraftVehicleInfo *avi = AircraftVehInfo(p1);
|
||||
Engine *e;
|
||||
|
|
|
@ -113,7 +113,7 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
{
|
||||
int32 cost;
|
||||
Vehicle *v;
|
||||
byte unit_num;
|
||||
UnitID unit_num;
|
||||
uint tile = TILE_FROM_XY(x,y);
|
||||
Engine *e;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "saveload.h"
|
||||
|
||||
enum {
|
||||
SAVEGAME_MAJOR_VERSION = 7,
|
||||
SAVEGAME_MAJOR_VERSION = 8,
|
||||
SAVEGAME_MINOR_VERSION = 0,
|
||||
|
||||
SAVEGAME_LOADABLE_VERSION = (SAVEGAME_MAJOR_VERSION << 8) + SAVEGAME_MINOR_VERSION
|
||||
|
|
|
@ -867,10 +867,10 @@ const SettingDesc patch_settings[] = {
|
|||
{"forbid_90_deg", SDT_BOOL, (void*)false, &_patches.forbid_90_deg, NULL},
|
||||
{"improved_load", SDT_BOOL, (void*)false, &_patches.improved_load, NULL},
|
||||
|
||||
{"max_trains", SDT_UINT8, (void*)80, &_patches.max_trains, NULL},
|
||||
{"max_roadveh", SDT_UINT8, (void*)80, &_patches.max_roadveh, NULL},
|
||||
{"max_aircraft", SDT_UINT8, (void*)40, &_patches.max_aircraft, NULL},
|
||||
{"max_ships", SDT_UINT8, (void*)50, &_patches.max_ships, NULL},
|
||||
{"max_trains", SDT_UINT16, (void*)500, &_patches.max_trains, NULL},
|
||||
{"max_roadveh", SDT_UINT16, (void*)500, &_patches.max_roadveh, NULL},
|
||||
{"max_aircraft", SDT_UINT16, (void*)200, &_patches.max_aircraft, NULL},
|
||||
{"max_ships", SDT_UINT16, (void*)300, &_patches.max_ships, NULL},
|
||||
|
||||
{"servint_ispercent", SDT_BOOL, (void*)false, &_patches.servint_ispercent, NULL},
|
||||
{"servint_trains", SDT_UINT16, (void*)150, &_patches.servint_trains, NULL},
|
||||
|
|
|
@ -661,10 +661,10 @@ static const PatchEntry _patches_vehicles[] = {
|
|||
{PE_INT16, PF_PLAYERBASED, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, "autorenew_months", &_patches.autorenew_months, -12, 12, 1, NULL},
|
||||
{PE_CURRENCY, PF_PLAYERBASED, STR_CONFIG_PATCHES_AUTORENEW_MONEY,"autorenew_money", &_patches.autorenew_money, 0, 2000000, 100000, NULL},
|
||||
|
||||
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_TRAINS, "max_trains", &_patches.max_trains, 0,240, 10, NULL},
|
||||
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, "max_roadveh", &_patches.max_roadveh, 0,240, 10, NULL},
|
||||
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, "max_aircraft", &_patches.max_aircraft, 0,240, 10, NULL},
|
||||
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_SHIPS, "max_ships", &_patches.max_ships, 0,240, 10, NULL},
|
||||
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_TRAINS, "max_trains", &_patches.max_trains, 0,5000, 50, NULL},
|
||||
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, "max_roadveh", &_patches.max_roadveh, 0,5000, 50, NULL},
|
||||
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, "max_aircraft", &_patches.max_aircraft, 0,5000, 50, NULL},
|
||||
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_SHIPS, "max_ships", &_patches.max_ships, 0,5000, 50, NULL},
|
||||
|
||||
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVINT_ISPERCENT,"servint_isperfect",&_patches.servint_ispercent, 0, 0, 0, &CheckInterval},
|
||||
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_TRAINS, "servint_trains", &_patches.servint_trains, 5,800, 5, &InValidateDetailsWindow},
|
||||
|
|
|
@ -873,7 +873,7 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
{
|
||||
int32 value;
|
||||
Vehicle *v;
|
||||
uint unit_num;
|
||||
UnitID unit_num;
|
||||
uint tile = TILE_FROM_XY(x,y);
|
||||
Engine *e;
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
const RailVehicleInfo *rvi;
|
||||
int value,dir;
|
||||
Vehicle *v, *u;
|
||||
byte unit_num;
|
||||
UnitID unit_num;
|
||||
Engine *e;
|
||||
uint tile = TILE_FROM_XY(x,y);
|
||||
|
||||
|
@ -774,7 +774,7 @@ int32 CmdMoveRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
// moving a loco to a new line?, then we need to assign a unitnumber.
|
||||
if (dst == NULL && src->subtype != TS_Front_Engine && is_loco) {
|
||||
uint unit_num = GetFreeUnitNumber(VEH_Train);
|
||||
UnitID unit_num = GetFreeUnitNumber(VEH_Train);
|
||||
if (unit_num > _patches.max_trains)
|
||||
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
|
||||
|
||||
|
|
10
variables.h
10
variables.h
|
@ -11,6 +11,8 @@
|
|||
# define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
typedef uint16 UnitID; //! All unitnumber stuff is of this type (or anyway, should be)
|
||||
|
||||
// Prices and also the fractional part.
|
||||
VARDEF Prices _price;
|
||||
VARDEF uint16 _price_frac[NUM_PRICES];
|
||||
|
@ -135,10 +137,10 @@ typedef struct Patches {
|
|||
uint8 toolbar_pos; // position of toolbars, 0=left, 1=center, 2=right
|
||||
uint8 window_snap_radius; // Windows snap at each other if closer than this
|
||||
|
||||
byte max_trains; //max trains in game per player (these are 8bit because the unitnumber field can't hold more)
|
||||
byte max_roadveh; //max trucks in game per player
|
||||
byte max_aircraft; //max planes in game per player
|
||||
byte max_ships; //max ships in game per player
|
||||
UnitID max_trains; //max trains in game per player (these are 16bit because the unitnumber field can't hold more)
|
||||
UnitID max_roadveh; //max trucks in game per player
|
||||
UnitID max_aircraft; //max planes in game per player
|
||||
UnitID max_ships; //max ships in game per player
|
||||
|
||||
bool servint_ispercent; // service intervals are in percents
|
||||
uint16 servint_trains; // service interval for trains
|
||||
|
|
|
@ -1762,9 +1762,9 @@ uint32 VehicleEnterTile(Vehicle *v, uint tile, int x, int y)
|
|||
return result;
|
||||
}
|
||||
|
||||
uint GetFreeUnitNumber(byte type)
|
||||
UnitID GetFreeUnitNumber(byte type)
|
||||
{
|
||||
uint unit_num = 0;
|
||||
UnitID unit_num = 0;
|
||||
Vehicle *u;
|
||||
|
||||
restart:
|
||||
|
@ -1784,7 +1784,8 @@ const byte _common_veh_desc[] = {
|
|||
|
||||
SLE_REF(Vehicle,next, REF_VEHICLE_OLD),
|
||||
SLE_VAR(Vehicle,string_id, SLE_STRINGID),
|
||||
SLE_VAR(Vehicle,unitnumber, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle,unitnumber, SLE_FILE_U8 | SLE_VAR_U16, 0, 7),
|
||||
SLE_CONDVAR(Vehicle,unitnumber, SLE_UINT16, 8, 255),
|
||||
SLE_VAR(Vehicle,owner, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle,tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
||||
SLE_CONDVAR(Vehicle,tile, SLE_UINT32, 6, 255),
|
||||
|
|
|
@ -100,7 +100,7 @@ struct Vehicle {
|
|||
|
||||
StringID string_id; // Displayed string
|
||||
|
||||
byte unitnumber; // unit number, for display purposes only
|
||||
UnitID unitnumber; // unit number, for display purposes only
|
||||
byte owner; // which player owns the vehicle?
|
||||
|
||||
TileIndex tile; // Current tile index
|
||||
|
@ -331,7 +331,7 @@ bool IsAircraftHangarTile(TileIndex tile);
|
|||
void ShowAircraftViewWindow(Vehicle *v);
|
||||
|
||||
bool IsShipDepotTile(TileIndex tile);
|
||||
uint GetFreeUnitNumber(byte type);
|
||||
UnitID GetFreeUnitNumber(byte type);
|
||||
|
||||
int LoadUnloadVehicle(Vehicle *v);
|
||||
int GetDepotByTile(uint tile);
|
||||
|
|
Loading…
Reference in New Issue