Changeset - r12010:5513d8f8e97d
[Not reviewed]
src/ai/ai_info.cpp
Show inline comments
 
@@ -106,8 +106,8 @@ AIInfo::~AIInfo()
 
{
 
	/* Free all allocated strings */
 
	for (AIConfigItemList::iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
 
		free((char *)(*it).name);
 
		free((char *)(*it).description);
 
		free((void*)(*it).name);
 
		free((void*)(*it).description);
 
		if (it->labels != NULL) {
 
			for (LabelMapping::iterator it2 = (*it).labels->Begin(); it2 != (*it).labels->End(); it2++) {
 
				free(it2->second);
src/ai/api/ai_vehicle.cpp
Show inline comments
 
@@ -45,11 +45,11 @@
 
		case VEH_ROAD: {
 
			uint total_length = 0;
 
			for (const Vehicle *u = v; u != NULL; u = u->Next()) {
 
				total_length += ((RoadVehicle*)u)->rcache.cached_veh_length;
 
				total_length += ((const RoadVehicle *)u)->rcache.cached_veh_length;
 
			}
 
			return total_length;
 
		}
 
		case VEH_TRAIN: return ((Train *)v)->tcache.cached_total_length;
 
		case VEH_TRAIN: return ((const Train *)v)->tcache.cached_total_length;
 
		default: return -1;
 
	}
 
}
 
@@ -85,11 +85,11 @@
 
	EnforcePrecondition(false, ::Vehicle::Get(source_vehicle_id)->type == VEH_TRAIN);
 
	EnforcePrecondition(false, dest_vehicle_id == -1 || ::Vehicle::Get(dest_vehicle_id)->type == VEH_TRAIN);
 

	
 
	const Train *v = (Train *)::Vehicle::Get(source_vehicle_id);
 
	const Train *v = (const Train *)::Vehicle::Get(source_vehicle_id);
 
	while (source_wagon-- > 0) v = GetNextUnit(v);
 
	const Train *w = NULL;
 
	if (dest_vehicle_id != -1) {
 
		w = (Train *)::Vehicle::Get(dest_vehicle_id);
 
		w = (const Train *)::Vehicle::Get(dest_vehicle_id);
 
		while (dest_wagon-- > 0) w = GetNextUnit(w);
 
	}
 

	
 
@@ -136,7 +136,7 @@
 
	EnforcePrecondition(false, IsValidVehicle(vehicle_id) && wagon < GetNumWagons(vehicle_id));
 
	EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN);
 

	
 
	const Train *v = (Train *)::Vehicle::Get(vehicle_id);
 
	const Train *v = (const Train *)::Vehicle::Get(vehicle_id);
 
	while (wagon-- > 0) v = GetNextUnit(v);
 

	
 
	return AIObject::DoCommand(0, v->index, sell_attached_wagons ? 1 : 0, CMD_SELL_RAIL_WAGON);
 
@@ -243,7 +243,7 @@
 

	
 
	const Vehicle *v = ::Vehicle::Get(vehicle_id);
 
	if (v->type == VEH_TRAIN) {
 
		while (wagon-- > 0) v = GetNextUnit((Train *)v);
 
		while (wagon-- > 0) v = GetNextUnit((const Train *)v);
 
	}
 
	return v->engine_type;
 
}
 
@@ -281,7 +281,7 @@
 

	
 
	const Vehicle *v = ::Vehicle::Get(vehicle_id);
 
	if (v->type == VEH_TRAIN) {
 
		while (wagon-- > 0) v = GetNextUnit((Train *)v);
 
		while (wagon-- > 0) v = GetNextUnit((const Train *)v);
 
	}
 
	return v->age;
 
}
src/aircraft_gui.cpp
Show inline comments
 
@@ -67,7 +67,7 @@ void DrawAircraftImage(const Vehicle *v,
 
	SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
 
	DrawSprite(v->GetImage(DIR_W), pal, x + 25, y + 10);
 
	if (v->subtype == AIR_HELICOPTER) {
 
		Aircraft *a = (Aircraft *)v;
 
		const Aircraft *a = (const Aircraft *)v;
 
		SpriteID rotor_sprite = GetCustomRotorSprite(a, true);
 
		if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
 
		DrawSprite(rotor_sprite, PAL_NONE, x + 25, y + 5);
src/articulated_vehicles.cpp
Show inline comments
 
@@ -208,7 +208,7 @@ bool IsArticulatedVehicleCarryingDiffere
 

	
 
		switch (v->type) {
 
			case VEH_TRAIN:
 
				v = (EngineHasArticPart((Train *)v) ? GetNextArticPart((Train *)v) : NULL);
 
				v = (EngineHasArticPart((const Train *)v) ? GetNextArticPart((const Train *)v) : NULL);
 
				break;
 

	
 
			case VEH_ROAD:
 
@@ -256,7 +256,7 @@ void CheckConsistencyOfArticulatedVehicl
 

	
 
		switch (v->type) {
 
			case VEH_TRAIN:
 
				v = (EngineHasArticPart((Train *)v) ? GetNextArticPart((Train *)v) : NULL);
 
				v = (EngineHasArticPart((const Train *)v) ? GetNextArticPart((const Train *)v) : NULL);
 
				break;
 

	
 
			case VEH_ROAD:
src/depot_gui.cpp
Show inline comments
 
@@ -272,7 +272,7 @@ struct DepotWindow : Window {
 
				DrawTrainImage(v, x + 21, sprite_y, this->sel, this->hscroll.cap + 4, this->hscroll.pos);
 

	
 
				/* Number of wagons relative to a standard length wagon (rounded up) */
 
				SetDParam(0, (((Train *)v)->tcache.cached_total_length + 7) / 8);
 
				SetDParam(0, (((const Train *)v)->tcache.cached_total_length + 7) / 8);
 
				DrawString(this->widget[DEPOT_WIDGET_MATRIX].left, this->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING, SA_RIGHT); // Draw the counter
 
				break;
 

	
 
@@ -328,7 +328,7 @@ struct DepotWindow : Window {
 
			hnum = 8;
 
			for (uint num = 0; num < this->vehicle_list.Length(); num++) {
 
				const Vehicle *v = this->vehicle_list[num];
 
				hnum = max(hnum, ((Train *)v)->tcache.cached_total_length);
 
				hnum = max(hnum, ((const Train *)v)->tcache.cached_total_length);
 
			}
 
			/* Always have 1 empty row, so people can change the setting of the train */
 
			SetVScrollCount(w, this->vehicle_list.Length() + this->wagon_list.Length() + 1);
 
@@ -450,7 +450,7 @@ struct DepotWindow : Window {
 
				x += skip;
 

	
 
				/* find the vehicle in this row that was clicked */
 
				while (v != NULL && (x -= ((Train *)v)->tcache.cached_veh_length) >= 0) v = v->Next();
 
				while (v != NULL && (x -= ((const Train *)v)->tcache.cached_veh_length) >= 0) v = v->Next();
 

	
 
				/* if an articulated part was selected, find its parent */
 
				while (v != NULL && IsArticulatedPart(v)) v = v->Previous();
 
@@ -514,11 +514,11 @@ struct DepotWindow : Window {
 

	
 
					switch (v->type) {
 
						case VEH_TRAIN:
 
							_cursor.short_vehicle_offset = 16 - ((Train *)v)->tcache.cached_veh_length * 2;
 
							_cursor.short_vehicle_offset = 16 - ((const Train *)v)->tcache.cached_veh_length * 2;
 
							break;
 

	
 
						case VEH_ROAD:
 
							_cursor.short_vehicle_offset = 16 - ((RoadVehicle *)v)->rcache.cached_veh_length * 2;
 
							_cursor.short_vehicle_offset = 16 - ((const RoadVehicle *)v)->rcache.cached_veh_length * 2;
 
							break;
 

	
 
						default:
src/driver.cpp
Show inline comments
 
@@ -56,7 +56,7 @@ int GetDriverParamInt(const char * const
 
 * @param name the driver to select.
 
 * @post Sets the driver so GetCurrentDriver() returns it too.
 
 */
 
const Driver *DriverFactoryBase::SelectDriver(const char *name, Driver::Type type)
 
Driver *DriverFactoryBase::SelectDriver(const char *name, Driver::Type type)
 
{
 
	if (GetDrivers().size() == 0) return NULL;
 

	
src/driver.h
Show inline comments
 
@@ -80,7 +80,7 @@ public:
 
		}
 
	}
 

	
 
	static const Driver *SelectDriver(const char *name, Driver::Type type);
 
	static Driver *SelectDriver(const char *name, Driver::Type type);
 
	static char *GetDriversInfo(char *p, const char *last);
 

	
 
	/**
src/fileio.cpp
Show inline comments
 
@@ -862,7 +862,7 @@ void DetermineBasePaths(const char *exe)
 
#endif
 

	
 
	/* Change the working directory to that one of the executable */
 
	ChangeWorkingDirectory((char*)exe);
 
	ChangeWorkingDirectory(exe);
 
	if (getcwd(tmp, MAX_PATH) == NULL) *tmp = '\0';
 
	AppendPathSeparator(tmp, MAX_PATH);
 
	_searchpaths[SP_BINARY_DIR] = strdup(tmp);
src/gfxinit.cpp
Show inline comments
 
@@ -378,8 +378,7 @@ static bool FillGraphicsSetDetails(Graph
 
		}
 

	
 
		const char *filename = item->value;
 
		file->filename = MallocT<char>(strlen(filename) + strlen(path) + 1);
 
		sprintf((char*)file->filename, "%s%s", path, filename);
 
		file->filename = str_fmt("%s%s", path, filename);
 

	
 
		/* Then find the MD5 checksum */
 
		item = md5s->GetItem(filename, false);
src/newgrf.cpp
Show inline comments
 
@@ -2247,7 +2247,7 @@ static ChangeInfoResult IndustriesChange
 
				IndustryTileTable **tile_table = CallocT<IndustryTileTable*>(indsp->num_table); // Table with tiles to compose an industry
 
				IndustryTileTable *itt = CallocT<IndustryTileTable>(defsize); // Temporary array to read the tile layouts from the GRF
 
				int size;
 
				IndustryTileTable *copy_from;
 
				const IndustryTileTable *copy_from;
 

	
 
				for (byte j = 0; j < indsp->num_table; j++) {
 
					for (int k = 0;; k++) {
 
@@ -2258,7 +2258,7 @@ static ChangeInfoResult IndustriesChange
 
							IndustryType type = grf_load_byte(&buf);  // industry holding required layout
 
							byte laynbr = grf_load_byte(&buf);        // layout number to borrow
 

	
 
							copy_from = (IndustryTileTable*)_origin_industry_specs[type].table[laynbr];
 
							copy_from = _origin_industry_specs[type].table[laynbr];
 
							for (size = 1;; size++) {
 
								if (copy_from[size - 1].ti.x == -0x80 && copy_from[size - 1].ti.y == 0) break;
 
							}
 
@@ -5455,11 +5455,11 @@ static void ResetCustomIndustries()
 
						for (int j = 0; j < ind->num_table; j++) {
 
							/* remove the individual layouts */
 
							if (ind->table[j] != NULL) {
 
								free((IndustryTileTable*)ind->table[j]);
 
								free((void*)ind->table[j]);
 
							}
 
						}
 
						/* remove the layouts pointers */
 
						free((IndustryTileTable**)ind->table);
 
						free((void*)ind->table);
 
						ind->table = NULL;
 
					}
 

	
src/newgrf_engine.cpp
Show inline comments
 
@@ -434,9 +434,9 @@ static uint8 LiveryHelper(EngineID engin
 
		if (!Company::IsValidID(_current_company)) return 0;
 
		l = GetEngineLivery(engine, _current_company, INVALID_ENGINE, NULL);
 
	} else if (v->type == VEH_TRAIN) {
 
		l = GetEngineLivery(v->engine_type, v->owner, ((Train *)v)->tcache.first_engine, v);
 
		l = GetEngineLivery(v->engine_type, v->owner, ((const Train *)v)->tcache.first_engine, v);
 
	} else if (v->type == VEH_ROAD) {
 
		l = GetEngineLivery(v->engine_type, v->owner, ((RoadVehicle *)v)->rcache.first_engine, v);
 
		l = GetEngineLivery(v->engine_type, v->owner, ((const RoadVehicle *)v)->rcache.first_engine, v);
 
	} else {
 
		l = GetEngineLivery(v->engine_type, v->owner, INVALID_ENGINE, v);
 
	}
 
@@ -536,7 +536,7 @@ static uint32 VehicleGetVariable(const R
 
				memset(common_subtypes, 0, sizeof(common_subtypes));
 

	
 
				for (u = v; u != NULL; u = u->Next()) {
 
					if (v->type == VEH_TRAIN) user_def_data |= ((Train *)u)->tcache.user_def_data;
 
					if (v->type == VEH_TRAIN) user_def_data |= ((const Train *)u)->tcache.user_def_data;
 

	
 
					/* Skip empty engines */
 
					if (u->cargo_cap == 0) continue;
 
@@ -886,10 +886,10 @@ static const SpriteGroup *GetVehicleSpri
 
			/* We always use cached value, except for callbacks because the override spriteset
 
			 * to use may be different than the one cached. It happens for callback 0x15 (refit engine),
 
			 * as v->cargo_type is temporary changed to the new type */
 
			group = use_cache ? ((Train *)v)->tcache.cached_override : GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, ((Train *)v)->tcache.first_engine);
 
			group = use_cache ? ((const Train *)v)->tcache.cached_override : GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, ((const Train *)v)->tcache.first_engine);
 
			if (group != NULL) return group;
 
		} else if (v->type == VEH_ROAD) {
 
			group = GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, ((RoadVehicle *)v)->rcache.first_engine);
 
			group = GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, ((const RoadVehicle *)v)->rcache.first_engine);
 
			if (group != NULL) return group;
 
		}
 
	}
 
@@ -952,7 +952,7 @@ SpriteID GetRotorOverrideSprite(EngineID
 
bool UsesWagonOverride(const Vehicle *v)
 
{
 
	assert(v->type == VEH_TRAIN);
 
	return ((Train *)v)->tcache.cached_override != NULL;
 
	return ((const Train *)v)->tcache.cached_override != NULL;
 
}
 

	
 
/**
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -13,8 +13,8 @@ INSTANTIATE_POOL_METHODS(SpriteGroup)
 

	
 
RealSpriteGroup::~RealSpriteGroup()
 
{
 
	free((SpriteGroup**)this->loaded);
 
	free((SpriteGroup**)this->loading);
 
	free((void*)this->loaded);
 
	free((void*)this->loading);
 
}
 

	
 
DeterministicSpriteGroup::~DeterministicSpriteGroup()
 
@@ -25,7 +25,7 @@ DeterministicSpriteGroup::~Deterministic
 

	
 
RandomizedSpriteGroup::~RandomizedSpriteGroup()
 
{
 
	free((SpriteGroup**)this->groups);
 
	free((void*)this->groups);
 
}
 

	
 
TileLayoutSpriteGroup::~TileLayoutSpriteGroup()
src/npf.cpp
Show inline comments
 
@@ -425,7 +425,7 @@ static int32 NPFFindDepot(AyStar *as, Op
 
/** Find any safe and free tile. */
 
static int32 NPFFindSafeTile(AyStar *as, OpenListNode *current)
 
{
 
	const Train *v = (Train *)((NPFFindStationOrTileData*)as->user_target)->v;
 
	const Train *v = (const Train *)((NPFFindStationOrTileData*)as->user_target)->v;
 

	
 
	return
 
		IsSafeWaitingPosition(v, current->path.node.tile, current->path.node.direction, true, _settings_game.pf.forbid_90_deg) &&
 
@@ -506,7 +506,7 @@ static void NPFSaveTargetData(AyStar *as
 

	
 
	if (as->user_target != NULL && ((NPFFindStationOrTileData*)as->user_target)->reserve_path && as->user_data[NPF_TYPE] == TRANSPORT_RAIL) {
 
		/* Path reservation is requested. */
 
		const Train *v = (Train *)((NPFFindStationOrTileData*)as->user_target)->v;
 
		const Train *v = (const Train *)((NPFFindStationOrTileData*)as->user_target)->v;
 

	
 
		const PathNode *target = FindSafePosition(&current->path, v);
 
		ftd->node = target->node;
src/openttd.cpp
Show inline comments
 
@@ -206,7 +206,7 @@ struct MyGetOptData {
 
	int numleft;
 
	char **argv;
 
	const char *options;
 
	const char *cont;
 
	char *cont;
 

	
 
	MyGetOptData(int argc, char **argv, const char *options)
 
	{
 
@@ -220,9 +220,7 @@ struct MyGetOptData {
 

	
 
static int MyGetOpt(MyGetOptData *md)
 
{
 
	const char *s, *r, *t;
 

	
 
	s = md->cont;
 
	char *s = md->cont;
 
	if (s != NULL)
 
		goto md_continue_here;
 

	
 
@@ -234,12 +232,14 @@ static int MyGetOpt(MyGetOptData *md)
 
md_continue_here:;
 
			s++;
 
			if (*s != 0) {
 
				const char *r;
 
				/* Found argument, try to locate it in options. */
 
				if (*s == ':' || (r = strchr(md->options, *s)) == NULL) {
 
					/* ERROR! */
 
					return -2;
 
				}
 
				if (r[1] == ':') {
 
					char *t;
 
					/* Item wants an argument. Check if the argument follows, or if it comes as a separate arg. */
 
					if (!*(t = s + 1)) {
 
						/* It comes as a separate arg. Check if out of args? */
 
@@ -253,7 +253,7 @@ md_continue_here:;
 
							md->argv++;
 
						}
 
					}
 
					md->opt = (char*)t;
 
					md->opt = t;
 
					md->cont = NULL;
 
					return *s;
 
				}
src/roadveh_gui.cpp
Show inline comments
 
@@ -130,7 +130,7 @@ void DrawRoadVehImage(const Vehicle *v, 
 
	int highlight_w = 0;
 

	
 
	for (int dx = 0; v != NULL && dx < max_length ; v = v->Next()) {
 
		int width = ((RoadVehicle *)v)->rcache.cached_veh_length;
 
		int width = ((const RoadVehicle *)v)->rcache.cached_veh_length;
 

	
 
		if (dx + width > 0 && dx <= max_length) {
 
			SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
src/screenshot.cpp
Show inline comments
 
@@ -26,7 +26,7 @@ ScreenshotType current_screenshot_type;
 

	
 
/* called by the ScreenShot proc to generate screenshot lines. */
 
typedef void ScreenshotCallback(void *userdata, void *buf, uint y, uint pitch, uint n);
 
typedef bool ScreenshotHandlerProc(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette);
 
typedef bool ScreenshotHandlerProc(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette);
 

	
 
struct ScreenshotFormat {
 
	const char *name;
 
@@ -67,7 +67,7 @@ struct RgbQuad {
 
assert_compile(sizeof(RgbQuad) == 4);
 

	
 
/* generic .BMP writer */
 
static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
static bool MakeBmpImage(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
{
 
	BitmapFileHeader bfh;
 
	BitmapInfoHeader bih;
 
@@ -170,7 +170,7 @@ static void PNGAPI png_my_warning(png_st
 
	DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (char *)png_get_error_ptr(png_ptr));
 
}
 

	
 
static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
static bool MakePNGImage(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
{
 
	png_color rq[256];
 
	FILE *f;
 
@@ -186,7 +186,7 @@ static bool MakePNGImage(const char *nam
 
	f = fopen(name, "wb");
 
	if (f == NULL) return false;
 

	
 
	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (char *)name, png_my_error, png_my_warning);
 
	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, name, png_my_error, png_my_warning);
 

	
 
	if (png_ptr == NULL) {
 
		fclose(f);
 
@@ -299,7 +299,7 @@ struct PcxHeader {
 
};
 
assert_compile(sizeof(PcxHeader) == 128);
 

	
 
static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
static bool MakePCXImage(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
{
 
	FILE *f;
 
	uint maxlines;
src/settings.cpp
Show inline comments
 
@@ -214,7 +214,7 @@ static bool load_intlist(const char *str
 
static void make_intlist(char *buf, const char *last, const void *array, int nelems, VarType type)
 
{
 
	int i, v = 0;
 
	const byte *p = (const byte*)array;
 
	byte *p = (byte*)array;
 

	
 
	for (i = 0; i != nelems; i++) {
 
		switch (type) {
src/spritecache.cpp
Show inline comments
 
@@ -489,7 +489,7 @@ void *AllocSprite(size_t mem_req)
 
 * @param available available sprite type
 
 * @return fallback sprite
 
 * @note this function will do usererror() in the case the fallback sprite isn't available */
 
static const void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, SpriteCache *sc)
 
static void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, SpriteCache *sc)
 
{
 
	static const char *sprite_types[] = {
 
		"normal",        // ST_NORMAL
 
@@ -525,7 +525,7 @@ static const void *HandleInvalidSpriteRe
 
	}
 
}
 

	
 
const void *GetRawSprite(SpriteID sprite, SpriteType type)
 
void *GetRawSprite(SpriteID sprite, SpriteType type)
 
{
 
	assert(IsMapgenSpriteID(sprite) == (type == ST_MAPGEN));
 
	assert(type < ST_INVALID);
src/spritecache.h
Show inline comments
 
@@ -17,7 +17,7 @@ struct Sprite {
 

	
 
extern uint _sprite_cache_size;
 

	
 
const void *GetRawSprite(SpriteID sprite, SpriteType type);
 
void *GetRawSprite(SpriteID sprite, SpriteType type);
 
bool SpriteExists(SpriteID sprite);
 

	
 
static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type)
src/station_cmd.cpp
Show inline comments
 
@@ -1968,7 +1968,7 @@ static CommandCost RemoveAirport(Station
 
	FOR_ALL_VEHICLES(v) {
 
		if (!(v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) continue;
 

	
 
		Aircraft *a = (Aircraft *)v;
 
		const Aircraft *a = (const Aircraft *)v;
 
		if (a->targetairport == st->index && a->state != FLYING) return CMD_ERROR;
 
	}
 

	
src/string_func.h
Show inline comments
 
@@ -208,11 +208,11 @@ static inline bool IsUtf8Part(char c)
 
 * @note The function should not be used to determine the length of the previous
 
 * encoded char because it might be an invalid/corrupt start-sequence
 
 */
 
static inline char *Utf8PrevChar(const char *s)
 
static inline char *Utf8PrevChar(char *s)
 
{
 
	const char *ret = s;
 
	char *ret = s;
 
	while (IsUtf8Part(*--ret)) {}
 
	return (char*)ret;
 
	return ret;
 
}
 

	
 

	
src/strings.cpp
Show inline comments
 
@@ -40,9 +40,9 @@ uint64 _decode_parameters[20];
 

	
 
static char *StationGetSpecialString(char *buff, int x, const char *last);
 
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char *last);
 
static char *GetSpecialNameString(char *buff, int ind, const int64 *argv, const char *last);
 
static char *GetSpecialNameString(char *buff, int ind, int64 *argv, const char *last);
 

	
 
static char *FormatString(char *buff, const char *str, const int64 *argv, uint casei, const char *last);
 
static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, const char *last);
 

	
 
struct LanguagePack : public LanguagePackHeader {
 
	char data[VARARRAY_SIZE]; // list of strings
 
@@ -55,22 +55,22 @@ static uint _langtab_start[32]; // Offse
 

	
 

	
 
/** Read an int64 from the argv array. */
 
static inline int64 GetInt64(const int64 **argv)
 
static inline int64 GetInt64(int64 **argv)
 
{
 
	assert(argv);
 
	return *(*argv)++;
 
}
 

	
 
/** Read an int32 from the argv array. */
 
static inline int32 GetInt32(const int64 **argv)
 
static inline int32 GetInt32(int64 **argv)
 
{
 
	return (int32)GetInt64(argv);
 
}
 

	
 
/** Read an array from the argv array. */
 
static inline const int64 *GetArgvPtr(const int64 **argv, int n)
 
static inline int64 *GetArgvPtr(int64 **argv, int n)
 
{
 
	const int64 *result;
 
	int64 *result;
 
	assert(*argv);
 
	result = *argv;
 
	(*argv) += n;
 
@@ -98,7 +98,7 @@ const char *GetStringPtr(StringID string
 
 * @param last
 
 * @return a formatted string of char
 
 */
 
static char *GetStringWithArgs(char *buffr, uint string, const int64 *argv, const char *last)
 
static char *GetStringWithArgs(char *buffr, uint string, int64 *argv, const char *last)
 
{
 
	if (GB(string, 0, 16) == 0) return GetStringWithArgs(buffr, STR_UNDEFINED, argv, last);
 

	
 
@@ -517,16 +517,16 @@ uint ConvertDisplaySpeedToSpeed(uint spe
 
	return ((speed << units[_settings_game.locale.units].s_s) + units[_settings_game.locale.units].s_m / 2) / units[_settings_game.locale.units].s_m;
 
}
 

	
 
static char *FormatString(char *buff, const char *str, const int64 *argv, uint casei, const char *last)
 
static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, const char *last)
 
{
 
	WChar b;
 
	const int64 *argv_orig = argv;
 
	int64 *argv_orig = argv;
 
	uint modifier = 0;
 

	
 
	while ((b = Utf8Consume(&str)) != '\0') {
 
		if (SCC_NEWGRF_FIRST <= b && b <= SCC_NEWGRF_LAST) {
 
			/* We need to pass some stuff as it might be modified; oh boy. */
 
			b = RemapNewGRFStringControlCode(b, &buff, &str, (int64*)argv);
 
			b = RemapNewGRFStringControlCode(b, &buff, &str, argv);
 
			if (b == 0) continue;
 
		}
 

	
 
@@ -1177,7 +1177,7 @@ static char *GenPresidentName(char *buff
 
	return buff;
 
}
 

	
 
static char *GetSpecialNameString(char *buff, int ind, const int64 *argv, const char *last)
 
static char *GetSpecialNameString(char *buff, int ind, int64 *argv, const char *last)
 
{
 
	switch (ind) {
 
		case 1: // not used
src/train_cmd.cpp
Show inline comments
 
@@ -189,7 +189,7 @@ void CheckTrainsLengths()
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_TRAIN && v->First() == v && !(v->vehstatus & VS_CRASHED)) {
 
			for (const Train *u = (Train *)v, *w = (Train *)v->Next(); w != NULL; u = w, w = w->Next()) {
 
			for (const Train *u = (const Train *)v, *w = (const Train *)v->Next(); w != NULL; u = w, w = w->Next()) {
 
				if (u->track != TRACK_BIT_DEPOT) {
 
					if ((w->track != TRACK_BIT_DEPOT &&
 
							max(abs(u->x_pos - w->x_pos), abs(u->y_pos - w->y_pos)) != u->tcache.cached_veh_length) ||
 
@@ -732,7 +732,7 @@ static void NormalizeTrainVehInDepot(con
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_TRAIN && IsFreeWagon(v) &&
 
				v->tile == u->tile &&
 
				((Train *)v)->track == TRACK_BIT_DEPOT) {
 
				((const Train *)v)->track == TRACK_BIT_DEPOT) {
 
			if (CmdFailed(DoCommand(0, v->index | (u->index << 16), 1, DC_EXEC,
 
					CMD_MOVE_RAIL_VEHICLE)))
 
				break;
 
@@ -3572,8 +3572,8 @@ static Vehicle *FindTrainCollideEnum(Veh
 
		 * As there might be more than two trains involved, we have to do that for all vehicles */
 
		const Vehicle *u;
 
		FOR_ALL_VEHICLES(u) {
 
			if (u->type == VEH_TRAIN && HASBITS(u->vehstatus, VS_CRASHED) && (((Train *)u)->track & TRACK_BIT_DEPOT) == TRACK_BIT_NONE) {
 
				TrackBits trackbits = ((Train *)u)->track;
 
			if (u->type == VEH_TRAIN && HASBITS(u->vehstatus, VS_CRASHED) && (((const Train *)u)->track & TRACK_BIT_DEPOT) == TRACK_BIT_NONE) {
 
				TrackBits trackbits = ((const Train *)u)->track;
 
				if ((trackbits & TRACK_BIT_WORMHOLE) == TRACK_BIT_WORMHOLE) {
 
					/* Vehicle is inside a wormhole, v->track contains no useful value then. */
 
					trackbits |= DiagDirToDiagTrackBits(GetTunnelBridgeDirection(u->tile));
src/train_gui.cpp
Show inline comments
 
@@ -28,7 +28,7 @@ void CcBuildWagon(bool success, TileInde
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_TRAIN && IsFrontEngine(v) &&
 
				v->tile == tile &&
 
				((Train *)v)->track == TRACK_BIT_DEPOT) {
 
				((const Train *)v)->track == TRACK_BIT_DEPOT) {
 
			if (found != NULL) return; // must be exactly one.
 
			found = v;
 
		}
 
@@ -81,7 +81,7 @@ void DrawTrainImage(const Vehicle *v, in
 
	_cur_dpi = &tmp_dpi;
 

	
 
	do {
 
		int width = ((Train *)v)->tcache.cached_veh_length;
 
		int width = ((const Train *)v)->tcache.cached_veh_length;
 

	
 
		if (dx + width > 0) {
 
			if (dx <= count) {
 
@@ -228,7 +228,7 @@ void DrawTrainDetails(const Vehicle *v, 
 
				do {
 
					SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
 
					DrawSprite(u->GetImage(DIR_W), pal, x + WagonLengthToPixels(4 + dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
 
					dx += ((Train *)u)->tcache.cached_veh_length;
 
					dx += ((const Train *)u)->tcache.cached_veh_length;
 
					u = u->Next();
 
				} while (u != NULL && IsArticulatedPart(u) && u->cargo_cap == 0);
 

	
src/vehicle.cpp
Show inline comments
 
@@ -1424,9 +1424,9 @@ SpriteID GetEnginePalette(EngineID engin
 
SpriteID GetVehiclePalette(const Vehicle *v)
 
{
 
	if (v->type == VEH_TRAIN) {
 
		return GetEngineColourMap(v->engine_type, v->owner, ((Train *)v)->tcache.first_engine, v);
 
		return GetEngineColourMap(v->engine_type, v->owner, ((const Train *)v)->tcache.first_engine, v);
 
	} else if (v->type == VEH_ROAD) {
 
		return GetEngineColourMap(v->engine_type, v->owner, ((RoadVehicle *)v)->rcache.first_engine, v);
 
		return GetEngineColourMap(v->engine_type, v->owner, ((const RoadVehicle *)v)->rcache.first_engine, v);
 
	}
 

	
 
	return GetEngineColourMap(v->engine_type, v->owner, INVALID_ENGINE, v);
 
@@ -1742,7 +1742,7 @@ bool CanVehicleUseStation(EngineID engin
 
 */
 
bool CanVehicleUseStation(const Vehicle *v, const Station *st)
 
{
 
	if (v->type == VEH_ROAD) return st->GetPrimaryRoadStop((RoadVehicle *)v) != NULL;
 
	if (v->type == VEH_ROAD) return st->GetPrimaryRoadStop((const RoadVehicle *)v) != NULL;
 

	
 
	return CanVehicleUseStation(v->engine_type, st);
 
}
src/vehicle_cmd.cpp
Show inline comments
 
@@ -152,7 +152,7 @@ CommandCost CmdMassStartStopVehicle(Tile
 

	
 
		if (!vehicle_list_window) {
 
			if (vehicle_type == VEH_TRAIN) {
 
				if (CheckTrainInDepot((Train *)v, false) == -1) continue;
 
				if (CheckTrainInDepot((const Train *)v, false) == -1) continue;
 
			} else {
 
				if (!(v->vehstatus & VS_HIDDEN)) continue;
 
			}
 
@@ -229,7 +229,7 @@ CommandCost CmdDepotMassAutoReplace(Tile
 
	bool did_something = false;
 

	
 
	for (uint i = 0; i < list.Length(); i++) {
 
		Vehicle *v = (Vehicle*)list[i];
 
		const Vehicle *v = list[i];
 

	
 
		/* Ensure that the vehicle completely in the depot */
 
		if (!v->IsInDepot()) continue;
src/vehicle_gui.cpp
Show inline comments
 
@@ -641,8 +641,8 @@ static int CDECL VehicleLengthSorter(con
 

	
 
		case VEH_ROAD: {
 
			const RoadVehicle *u;
 
			for (u = (RoadVehicle *)*a; u != NULL; u = u->Next()) r += u->rcache.cached_veh_length;
 
			for (u = (RoadVehicle *)*b; u != NULL; u = u->Next()) r -= u->rcache.cached_veh_length;
 
			for (u = (const RoadVehicle *)*a; u != NULL; u = u->Next()) r += u->rcache.cached_veh_length;
 
			for (u = (const RoadVehicle *)*b; u != NULL; u = u->Next()) r -= u->rcache.cached_veh_length;
 
		} break;
 

	
 
		default: NOT_REACHED();
 
@@ -1466,10 +1466,10 @@ struct VehicleDetailsWindow : Window {
 
		switch (v->type) {
 
			case VEH_TRAIN:
 
				SetDParam(2, v->GetDisplayMaxSpeed());
 
				SetDParam(1, ((Train *)v)->tcache.cached_power);
 
				SetDParam(0, ((Train *)v)->tcache.cached_weight);
 
				SetDParam(3, ((Train *)v)->tcache.cached_max_te / 1000);
 
				DrawString(2, this->width - 2, 25, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && ((Train *)v)->railtype != RAILTYPE_MAGLEV) ?
 
				SetDParam(1, ((const Train *)v)->tcache.cached_power);
 
				SetDParam(0, ((const Train *)v)->tcache.cached_weight);
 
				SetDParam(3, ((const Train *)v)->tcache.cached_max_te / 1000);
 
				DrawString(2, this->width - 2, 25, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && ((const Train *)v)->railtype != RAILTYPE_MAGLEV) ?
 
					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :
 
					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED);
 
				break;
 
@@ -1937,7 +1937,7 @@ struct VehicleViewWindow : Window {
 
		} else if (v->vehstatus & VS_STOPPED) {
 
			if (v->type == VEH_TRAIN) {
 
				if (v->cur_speed == 0) {
 
					if (((Train *)v)->tcache.cached_power == 0) {
 
					if (((const Train *)v)->tcache.cached_power == 0) {
 
						str = STR_TRAIN_NO_POWER;
 
					} else {
 
						str = STR_VEHICLE_STATUS_STOPPED;
 
@@ -1949,7 +1949,7 @@ struct VehicleViewWindow : Window {
 
			} else { // no train
 
				str = STR_VEHICLE_STATUS_STOPPED;
 
			}
 
		} else if (v->type == VEH_TRAIN && HasBit(((Train *)v)->flags, VRF_TRAIN_STUCK)) {
 
		} else if (v->type == VEH_TRAIN && HasBit(((const Train *)v)->flags, VRF_TRAIN_STUCK)) {
 
			str = STR_TRAIN_STUCK;
 
		} else { // vehicle is in a "normal" state, show current order
 
			switch (v->current_order.GetType()) {
src/vehiclelist.cpp
Show inline comments
 
@@ -29,7 +29,7 @@ void BuildDepotVehicleList(VehicleType t
 
		switch (type) {
 
			case VEH_TRAIN:
 
				if (IsArticulatedPart(v) || IsRearDualheaded(v)) continue;
 
				if (((Train *)v)->track != TRACK_BIT_DEPOT) continue;
 
				if (((const Train *)v)->track != TRACK_BIT_DEPOT) continue;
 
				if (wagons != NULL && IsFreeWagon(v->First())) {
 
					if (individual_wagons || IsFreeWagon(v)) *wagons->Append() = v;
 
					continue;
src/yapf/follow_track.hpp
Show inline comments
 
@@ -55,7 +55,7 @@ struct CFollowTrackT
 
	{
 
		assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN));
 
		m_veh = v;
 
		Init(v != NULL ? v->owner : INVALID_OWNER, railtype_override == INVALID_RAILTYPES ? ((Train *)v)->compatible_railtypes : railtype_override, pPerf);
 
		Init(v != NULL ? v->owner : INVALID_OWNER, railtype_override == INVALID_RAILTYPES ? ((const Train *)v)->compatible_railtypes : railtype_override, pPerf);
 
	}
 

	
 
	FORCEINLINE void Init(Owner o, RailTypes railtype_override, CPerformanceTimer *pPerf)
 
@@ -76,7 +76,7 @@ struct CFollowTrackT
 
	FORCEINLINE static TransportType TT() {return Ttr_type_;}
 
	FORCEINLINE static bool IsWaterTT() {return TT() == TRANSPORT_WATER;}
 
	FORCEINLINE static bool IsRailTT() {return TT() == TRANSPORT_RAIL;}
 
	FORCEINLINE bool IsTram() {return IsRoadTT() && HasBit(((RoadVehicle *)m_veh)->compatible_roadtypes, ROADTYPE_TRAM);}
 
	FORCEINLINE bool IsTram() {return IsRoadTT() && HasBit(((const RoadVehicle *)m_veh)->compatible_roadtypes, ROADTYPE_TRAM);}
 
	FORCEINLINE static bool IsRoadTT() {return TT() == TRANSPORT_ROAD;}
 
	FORCEINLINE static bool Allow90degTurns() {return T90deg_turns_allowed_;}
 
	FORCEINLINE static bool DoTrackMasking() {return IsRailTT() && Tmask_reserved_tracks;}
 
@@ -106,7 +106,7 @@ struct CFollowTrackT
 
		m_old_tile = old_tile;
 
		m_old_td = old_td;
 
		m_err = EC_NONE;
 
		assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), m_veh ? ((RoadVehicle *)m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
 
		assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), m_veh ? ((const RoadVehicle *)m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
 
		       (IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR)); // Disable the assertion for single tram bits
 
		m_exitdir = TrackdirToExitdir(m_old_td);
 
		if (ForcedReverse()) return true;
 
@@ -207,7 +207,7 @@ protected:
 
		if (IsRailTT() && IsPlainRailTile(m_new_tile)) {
 
			m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101);
 
		} else {
 
			m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh != NULL ? ((RoadVehicle *)m_veh)->compatible_roadtypes : 0));
 
			m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh != NULL ? ((const RoadVehicle *)m_veh)->compatible_roadtypes : 0));
 

	
 
			if (IsTram() && m_new_td_bits == 0) {
 
				/* GetTileTrackStatus() returns 0 for single tram bits.
src/yapf/yapf_costrail.hpp
Show inline comments
 
@@ -247,8 +247,8 @@ public:
 
		const Vehicle *v = Yapf().GetVehicle();
 
		assert(v != NULL);
 
		assert(v->type == VEH_TRAIN);
 
		assert(((Train *)v)->tcache.cached_total_length != 0);
 
		int missing_platform_length = (((Train *)v)->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length;
 
		assert(((const Train *)v)->tcache.cached_total_length != 0);
 
		int missing_platform_length = (((const Train *)v)->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length;
 
		if (missing_platform_length < 0) {
 
			/* apply penalty for longer platform than needed */
 
			cost += Yapf().PfGetSettings().rail_longer_platform_penalty + Yapf().PfGetSettings().rail_longer_platform_per_tile_penalty * -missing_platform_length;
src/yapf/yapf_destrail.hpp
Show inline comments
 
@@ -13,8 +13,8 @@ protected:
 
public:
 
	void SetDestination(const Vehicle *v, bool override_rail_type = false)
 
	{
 
		m_compatible_railtypes = ((Train *)v)->compatible_railtypes;
 
		if (override_rail_type) m_compatible_railtypes |= GetRailTypeInfo(((Train *)v)->railtype)->compatible_railtypes;
 
		m_compatible_railtypes = ((const Train *)v)->compatible_railtypes;
 
		if (override_rail_type) m_compatible_railtypes |= GetRailTypeInfo(((const Train *)v)->railtype)->compatible_railtypes;
 
	}
 

	
 
	bool IsCompatibleRailType(RailType rt)
 
@@ -91,8 +91,8 @@ public:
 
	FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td)
 
	{
 
		return
 
			IsSafeWaitingPosition((Train *)Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) &&
 
			IsWaitingPositionFree((Train *)Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns());
 
			IsSafeWaitingPosition((const Train *)Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) &&
 
			IsWaitingPositionFree((const Train *)Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns());
 
	}
 

	
 
	/** Called by YAPF to calculate cost estimate. Calculates distance to the destination
src/yapf/yapf_rail.cpp
Show inline comments
 
@@ -54,7 +54,7 @@ private:
 

	
 
	bool FindSafePositionProc(TileIndex tile, Trackdir td)
 
	{
 
		if (IsSafeWaitingPosition((Train *)Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns())) {
 
		if (IsSafeWaitingPosition((const Train *)Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns())) {
 
			m_res_dest = tile;
 
			m_res_dest_td = td;
 
			return false;   // Stop iterating segment
 
@@ -149,7 +149,7 @@ public:
 
		}
 

	
 
		/* Don't bother if the target is reserved. */
 
		if (!IsWaitingPositionFree((Train *)Yapf().GetVehicle(), m_res_dest, m_res_dest_td)) return false;
 
		if (!IsWaitingPositionFree((const Train *)Yapf().GetVehicle(), m_res_dest, m_res_dest_td)) return false;
 

	
 
		for (Node *node = m_res_node; node->m_parent != NULL; node = node->m_parent) {
 
			node->IterateTiles(Yapf().GetVehicle(), Yapf(), *this, &CYapfReserveTrack<Types>::ReserveSingleTrack);
 
@@ -411,7 +411,7 @@ public:
 
		if (target != NULL) target->tile = INVALID_TILE;
 

	
 
		/* set origin and destination nodes */
 
		PBSTileInfo origin = FollowTrainReservation((Train *)v);
 
		PBSTileInfo origin = FollowTrainReservation((const Train *)v);
 
		Yapf().SetOrigin(origin.tile, origin.trackdir, INVALID_TILE, INVALID_TRACKDIR, 1, true);
 
		Yapf().SetDestination(v);
 

	
 
@@ -536,9 +536,9 @@ Trackdir YapfChooseRailTrack(const Vehic
 

	
 
bool YapfCheckReverseTrain(const Vehicle *vt)
 
{
 
	Train *v = (Train *)vt;
 
	const Train *v = (const Train *)vt;
 
	/* last wagon */
 
	const Train *last_veh = (Train *)GetLastVehicleInChain(v);
 
	const Train *last_veh = (const Train *)GetLastVehicleInChain(v);
 

	
 
	/* get trackdirs of both ends */
 
	Trackdir td = v->GetVehicleTrackdir();
 
@@ -602,7 +602,7 @@ bool YapfFindNearestRailDepotTwoWay(cons
 

	
 
	const Vehicle *last_veh = GetLastVehicleInChain(v);
 

	
 
	PBSTileInfo origin = FollowTrainReservation((Train *)v);
 
	PBSTileInfo origin = FollowTrainReservation((const Train *)v);
 
	TileIndex last_tile = last_veh->tile;
 
	Trackdir td_rev = ReverseTrackdir(last_veh->GetVehicleTrackdir());
 

	
src/yapf/yapf_road.cpp
Show inline comments
 
@@ -299,13 +299,13 @@ public:
 
		/* our source tile will be the next vehicle tile (should be the given one) */
 
		TileIndex src_tile = tile;
 
		/* get available trackdirs on the start tile */
 
		TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes));
 
		TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ((const RoadVehicle *)v)->compatible_roadtypes));
 
		/* select reachable trackdirs only */
 
		src_trackdirs &= DiagdirReachesTrackdirs(enterdir);
 

	
 
		/* get available trackdirs on the destination tile */
 
		TileIndex dest_tile = v->dest_tile;
 
		TrackdirBits dest_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(dest_tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes));
 
		TrackdirBits dest_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(dest_tile, TRANSPORT_ROAD, ((const RoadVehicle *)v)->compatible_roadtypes));
 

	
 
		/* set origin and destination nodes */
 
		Yapf().SetOrigin(src_tile, src_trackdirs);
 
@@ -349,7 +349,7 @@ public:
 

	
 
		/* set destination tile, trackdir
 
		 *   get available trackdirs on the destination tile */
 
		TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes));
 
		TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, ((const RoadVehicle *)v)->compatible_roadtypes));
 
		Yapf().SetDestination(dst_tile, dst_td_bits);
 

	
 
		/* if path not found - return distance = UINT_MAX */
 
@@ -374,7 +374,7 @@ public:
 
		/* set origin (tile, trackdir) */
 
		TileIndex src_tile = v->tile;
 
		Trackdir src_td = v->GetVehicleTrackdir();
 
		if ((TrackStatusToTrackdirBits(GetTileTrackStatus(src_tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes)) & TrackdirToTrackdirBits(src_td)) == 0) {
 
		if ((TrackStatusToTrackdirBits(GetTileTrackStatus(src_tile, TRANSPORT_ROAD, ((const RoadVehicle *)v)->compatible_roadtypes)) & TrackdirToTrackdirBits(src_td)) == 0) {
 
			/* sometimes the roadveh is not on the road (it resides on non-existing track)
 
			 * how should we handle that situation? */
 
			return false;
 
@@ -471,7 +471,7 @@ Depot *YapfFindNearestRoadDepot(const Ve
 
{
 
	TileIndex tile = v->tile;
 
	Trackdir trackdir = v->GetVehicleTrackdir();
 
	if ((TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes)) & TrackdirToTrackdirBits(trackdir)) == 0) {
 
	if ((TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ((const RoadVehicle *)v)->compatible_roadtypes)) & TrackdirToTrackdirBits(trackdir)) == 0) {
 
		return NULL;
 
	}
 

	
0 comments (0 inline, 0 general)