Changeset - r17630:7d818445376d
[Not reviewed]
src/core/endian_type.hpp
Show inline comments
 
@@ -10,18 +10,22 @@
 
/** @file endian_type.hpp Definition of various endian-dependant macros. */
 

	
 
#ifndef ENDIAN_TYPE_HPP
 
#define ENDIAN_TYPE_HPP
 

	
 
#if defined(ARM) || defined(__arm__) || defined(__alpha__)
 
	/** The architecture requires aligned access. */
 
	#define OTTD_ALIGNMENT 1
 
#else
 
	/** The architecture does not require aligned access. */
 
	#define OTTD_ALIGNMENT 0
 
#endif
 

	
 
/** Little endian builds use this for TTD_ENDIAN. */
 
#define TTD_LITTLE_ENDIAN 0
 
/** Big endian builds use this for TTD_ENDIAN. */
 
#define TTD_BIG_ENDIAN 1
 

	
 
/* Windows has always LITTLE_ENDIAN */
 
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
 
	#define TTD_ENDIAN TTD_LITTLE_ENDIAN
 
#elif !defined(TESTING)
src/core/pool_func.hpp
Show inline comments
 
@@ -13,12 +13,16 @@
 
#define POOL_FUNC_HPP
 

	
 
#include "alloc_func.hpp"
 
#include "mem_func.hpp"
 
#include "pool_type.hpp"
 

	
 
/**
 
 * Helper for defining the method's signature.
 
 * @param type The return type of the method.
 
 */
 
#define DEFINE_POOL_METHOD(type) \
 
	template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type, bool Tcache, bool Tzero> \
 
	type Pool<Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero>
 

	
 
/**
 
 * Create a clean pool.
src/core/smallvec_type.hpp
Show inline comments
 
@@ -32,18 +32,26 @@ protected:
 
	uint items;    ///< The number of items stored
 
	uint capacity; ///< The available space for storing items
 

	
 
public:
 
	SmallVector() : data(NULL), items(0), capacity(0) { }
 

	
 
	/**
 
	 * Copy constructor.
 
	 * @param other The other vector to copy.
 
	 */
 
	template <uint X>
 
	SmallVector(const SmallVector<T, X> &other) : data(NULL), items(0), capacity(0)
 
	{
 
		MemCpyT<T>(this->Append(other.Length()), other.Begin(), other.Length());
 
	}
 

	
 
	/**
 
	 * Assignment.
 
	 * @param other The new vector that.
 
	 */
 
	template <uint X>
 
	SmallVector &operator=(const SmallVector<T, X> &other)
 
	{
 
		this->Reset();
 
		MemCpyT<T>(this->Append(other.Length()), other.Begin(), other.Length());
 
		return *this;
 
@@ -315,9 +323,9 @@ public:
 
		}
 

	
 
		this->items = 0;
 
	}
 
};
 

	
 
typedef AutoFreeSmallVector<char*, 4> StringList;
 
typedef AutoFreeSmallVector<char*, 4> StringList; ///< Type for a list of strings.
 

	
 
#endif /* SMALLVEC_TYPE_HPP */
src/core/string_compare_type.hpp
Show inline comments
 
@@ -9,13 +9,20 @@
 

	
 
/** @file string_compare_type.hpp Comparator class for "const char *" so it can be used as a key for std::map */
 

	
 
#ifndef STRING_COMPARE_TYPE_HPP
 
#define STRING_COMPARE_TYPE_HPP
 

	
 
/** Comparator for strings. */
 
struct StringCompare {
 
	/**
 
	 * Compare two strings.
 
	 * @param a The first string.
 
	 * @param b The second string.
 
	 * @return True is the first string is deemed "lower" than the second string.
 
	 */
 
	bool operator () (const char *a, const char *b) const
 
	{
 
		return strcmp(a, b) < 0;
 
	}
 
};
 

	
src/currency.cpp
Show inline comments
 
@@ -19,12 +19,13 @@
 
#include "table/strings.h"
 

	
 
	/*   exchange rate    prefix                         symbol_pos
 
	 *   |  separator        |           postfix             |
 
	 *   |   |   Euro year   |              |                | name
 
	 *   |   |    |          |              |                |  | */
 
/** The original currency specifications. */
 
static const CurrencySpec origin_currency_specs[NUM_CURRENCY] = {
 
	{    1, "", CF_NOEURO, "\xC2\xA3",     "",              0, STR_GAME_OPTIONS_CURRENCY_GBP    }, ///< british pounds
 
	{    2, "", CF_NOEURO, "$",            "",              0, STR_GAME_OPTIONS_CURRENCY_USD    }, ///< us dollars
 
	{    2, "", CF_ISEURO, "\xE2\x82\xAC", "",              0, STR_GAME_OPTIONS_CURRENCY_EUR    }, ///< Euro
 
	{  220, "", CF_NOEURO, "\xC2\xA5",     "",              0, STR_GAME_OPTIONS_CURRENCY_YEN    }, ///< yen
 
	{   20, "", 2002,      "",             NBSP"S.",        1, STR_GAME_OPTIONS_CURRENCY_ATS    }, ///< austrian schilling
 
@@ -51,13 +52,13 @@ static const CurrencySpec origin_currenc
 
	{   52, "", 2009,      "",             NBSP"Sk",        1, STR_GAME_OPTIONS_CURRENCY_SKK    }, ///< slovak koruna
 
	{    4, "", CF_NOEURO, "R$"NBSP,       "",              0, STR_GAME_OPTIONS_CURRENCY_BRL    }, ///< brazil real
 
	{   20, "", 2011,      "",             NBSP"EEK",       1, STR_GAME_OPTIONS_CURRENCY_EEK    }, ///< estonian krooni
 
	{    1, "", CF_NOEURO, "",             "",              2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency
 
};
 

	
 
/* Array of currencies used by the system */
 
/** Array of currencies used by the system */
 
CurrencySpec _currency_specs[NUM_CURRENCY];
 

	
 
/**
 
 * These enums are only declared in order to make sens
 
 * out of the TTDPatch_To_OTTDIndex array that will follow
 
 * Every currency used by Ottd is there, just in case TTDPatch will
src/date.cpp
Show inline comments
 
@@ -20,13 +20,13 @@
 
#include "rail_gui.h"
 
#include "saveload/saveload.h"
 

	
 
Year      _cur_year;   ///< Current year, starting at 0
 
Month     _cur_month;  ///< Current month (0..11)
 
Date      _date;       ///< Current date in days (day counter)
 
DateFract _date_fract;
 
DateFract _date_fract; ///< Fractional part of the day.
 
uint16 _tick_counter;  ///< Ever incrementing (and sometimes wrapping) tick counter for setting off various events
 

	
 
/**
 
 * Set the date.
 
 * @param date  New date
 
 * @param fract The number of ticks that have passed on this date.
src/date_func.h
Show inline comments
 
@@ -21,12 +21,17 @@ extern DateFract _date_fract;
 
extern uint16 _tick_counter;
 

	
 
void SetDate(Date date, DateFract fract);
 
void ConvertDateToYMD(Date date, YearMonthDay *ymd);
 
Date ConvertYMDToDate(Year year, Month month, Day day);
 

	
 
/**
 
 * Checks whether the given year is a leap year or not.
 
 * @param yr The year to check.
 
 * @return True if \c yr is a leap year, otherwise false.
 
 */
 
static inline bool IsLeapYear(Year yr)
 
{
 
	return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0);
 
}
 

	
 
#endif /* DATE_FUNC_H */
src/date_gui.cpp
Show inline comments
 
@@ -178,12 +178,13 @@ struct SetDateWindow : Window {
 
				break;
 
		}
 
		this->SetDirty();
 
	}
 
};
 

	
 
/** Widgets for the date setting window. */
 
static const NWidgetPart _nested_set_date_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
 
		NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_DATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_BROWN),
 
@@ -199,12 +200,13 @@ static const NWidgetPart _nested_set_dat
 
				NWidget(NWID_SPACER), SetFill(1, 0),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer()
 
};
 

	
 
/** Description of the date setting window. */
 
static const WindowDesc _set_date_desc(
 
	WDP_CENTER, 0, 0,
 
	WC_SET_DATE, WC_NONE,
 
	WDF_UNCLICK_BUTTONS,
 
	_nested_set_date_widgets, lengthof(_nested_set_date_widgets)
 
);
src/depend/depend.cpp
Show inline comments
 
@@ -28,12 +28,13 @@
 
#include <unistd.h>
 
#include <map>
 
#include <set>
 
#include <stack>
 

	
 
#ifndef PATH_MAX
 
/** The maximum length of paths, if we don't know it. */
 
#	define PATH_MAX 260
 
#endif
 

	
 
/** Simple string comparator using strcmp as implementation */
 
struct StringCompare {
 
	/**
src/depot.cpp
Show inline comments
 
@@ -15,12 +15,13 @@
 
#include "order_func.h"
 
#include "window_func.h"
 
#include "core/pool_func.hpp"
 
#include "vehicle_gui.h"
 
#include "vehiclelist.h"
 

	
 
/** All our depots tucked away in a pool. */
 
DepotPool _depot_pool("Depot");
 
INSTANTIATE_POOL_METHODS(Depot)
 

	
 
/**
 
 * Clean up a depot
 
 */
src/depot_cmd.cpp
Show inline comments
 
@@ -18,13 +18,17 @@
 
#include "vehicle_gui.h"
 
#include "vehiclelist.h"
 
#include "window_func.h"
 

	
 
#include "table/strings.h"
 

	
 

	
 
/**
 
 * Check whether the given name is globally unique amongst depots.
 
 * @param name The name to check.
 
 * @return True if there is no depot with the given name.
 
 */
 
static bool IsUniqueDepotName(const char *name)
 
{
 
	const Depot *d;
 

	
 
	FOR_ALL_DEPOTS(d) {
 
		if (d->name != NULL && strcmp(d->name, name) == 0) return false;
src/depot_type.h
Show inline comments
 
@@ -9,12 +9,12 @@
 

	
 
/** @file depot_type.h Header files for depots (not hangars) */
 

	
 
#ifndef DEPOT_TYPE_H
 
#define DEPOT_TYPE_H
 

	
 
typedef uint16 DepotID;
 
typedef uint16 DepotID; ///< Type for the unique identifier of depots.
 
struct Depot;
 

	
 
static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 32; ///< The maximum length of a depot name in characters including '\0'
 

	
 
#endif /* DEPOT_TYPE_H */
src/direction_type.h
Show inline comments
 
@@ -39,13 +39,13 @@ enum Direction {
 

	
 
/** Allow incrementing of Direction variables */
 
DECLARE_POSTFIX_INCREMENT(Direction)
 

	
 
/** Define basic enum properties */
 
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR, 3> {};
 
typedef TinyEnumT<Direction> DirectionByte; // typedefing-enumification of Direction
 
typedef TinyEnumT<Direction> DirectionByte; ///< typedefing-enumification of Direction
 

	
 

	
 
/**
 
 * Enumeration for the difference between two directions.
 
 *
 
 * This enumeration is used to mark differences between
 
@@ -89,13 +89,13 @@ enum DiagDirection {
 

	
 
/** Allow incrementing of DiagDirection variables */
 
DECLARE_POSTFIX_INCREMENT(DiagDirection)
 

	
 
/** Define basic enum properties */
 
template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR, 2> {};
 
typedef TinyEnumT<DiagDirection> DiagDirectionByte; // typedefing-enumification of DiagDirection
 
typedef TinyEnumT<DiagDirection> DiagDirectionByte; ///< typedefing-enumification of DiagDirection
 

	
 

	
 
/**
 
 * Enumeration for the difference between to DiagDirection.
 
 *
 
 * As the DiagDirection only contains 4 possible directions the
 
@@ -127,9 +127,10 @@ DECLARE_POSTFIX_INCREMENT(DiagDirDiff)
 
enum Axis {
 
	AXIS_X = 0,          ///< The X axis
 
	AXIS_Y = 1,          ///< The y axis
 
	AXIS_END,            ///< Used for iterations
 
	INVALID_AXIS = 0xFF, ///< Flag for an invalid Axis
 
};
 
/** Helper information for extract tool. */
 
template <> struct EnumPropsT<Axis> : MakeEnumPropsT<Axis, byte, AXIS_X, AXIS_END, INVALID_AXIS, 1> {};
 

	
 
#endif /* DIRECTION_TYPE_H */
src/economy_base.h
Show inline comments
 
@@ -45,10 +45,20 @@ struct CargoPayment : CargoPaymentPool::
 
	 * Sets the currently handled cargo type.
 
	 * @param ct the cargo type to handle from now on.
 
	 */
 
	void SetCargo(CargoID ct) { this->ct = ct; }
 
};
 

	
 
/**
 
 * Iterate over all cargo payments from a given start position.
 
 * @param var The variable used for iterating.
 
 * @param start The start of the iteration.
 
 */
 
#define FOR_ALL_CARGO_PAYMENTS_FROM(var, start) FOR_ALL_ITEMS_FROM(CargoPayment, cargo_payment_index, var, start)
 

	
 
/**
 
 * Iterate over all cargo payments.
 
 * @param var The variable used for iterating.
 
 */
 
#define FOR_ALL_CARGO_PAYMENTS(var) FOR_ALL_CARGO_PAYMENTS_FROM(var, 0)
 

	
 
#endif /* ECONOMY_BASE_H */
src/effectvehicle.cpp
Show inline comments
 
@@ -555,12 +555,20 @@ static EffectTickProc * const _effect_ti
 
	ExplosionSmallTick,
 
	BulldozerTick,
 
	BubbleTick,
 
};
 

	
 

	
 
/**
 
 * Create an effect vehicle at a particular location.
 
 * @param x The x location on the map.
 
 * @param y The y location on the map.
 
 * @param z The z location on the map.
 
 * @param type The type of effect vehicle.
 
 * @return The effect vehicle.
 
 */
 
EffectVehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
 
{
 
	if (!Vehicle::CanAllocateItem()) return NULL;
 

	
 
	EffectVehicle *v = new EffectVehicle();
 
	v->subtype = type;
 
@@ -576,19 +584,36 @@ EffectVehicle *CreateEffectVehicle(int x
 
	VehicleMove(v, false);
 
	MarkSingleVehicleDirty(v);
 

	
 
	return v;
 
}
 

	
 
/**
 
 * Create an effect vehicle above a particular location.
 
 * @param x The x location on the map.
 
 * @param y The y location on the map.
 
 * @param z The offset from the ground.
 
 * @param type The type of effect vehicle.
 
 * @return The effect vehicle.
 
 */
 
EffectVehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
 
{
 
	int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE);
 
	int safe_y = Clamp(y, 0, MapMaxY() * TILE_SIZE);
 
	return CreateEffectVehicle(x, y, GetSlopeZ(safe_x, safe_y) + z, type);
 
}
 

	
 
/**
 
 * Create an effect vehicle above a particular vehicle.
 
 * @param v The vehicle to base the position on.
 
 * @param x The x offset to the vehicle.
 
 * @param y The y offset to the vehicle.
 
 * @param z The z offset to the vehicle.
 
 * @param type The type of effect vehicle.
 
 * @return The effect vehicle.
 
 */
 
EffectVehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type)
 
{
 
	return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type);
 
}
 

	
 
bool EffectVehicle::Tick()
src/elrail.cpp
Show inline comments
 
@@ -64,12 +64,17 @@
 
#include "elrail_func.h"
 
#include "company_base.h"
 
#include "newgrf_railtype.h"
 

	
 
#include "table/elrail_data.h"
 

	
 
/**
 
 * Get the tile location group of a tile.
 
 * @param t The tile to get the tile location group of.
 
 * @return The tile location group.
 
 */
 
static inline TLG GetTLG(TileIndex t)
 
{
 
	return (TLG)((HasBit(TileX(t), 0) << 1) + HasBit(TileY(t), 0));
 
}
 

	
 
/**
src/engine.cpp
Show inline comments
 
@@ -611,12 +611,17 @@ void SetYearEngineAgingStops()
 
		ConvertDateToYMD(ei->base_intro + (ei->lifelength * DAYS_IN_LEAP_YEAR) / 2, &ymd);
 

	
 
		_year_engine_aging_stops = max(_year_engine_aging_stops, ymd.year);
 
	}
 
}
 

	
 
/**
 
 * Start/initialise one engine.
 
 * @param e The engine to initialise.
 
 * @param aging_date The date used for age calculations.
 
 */
 
void StartupOneEngine(Engine *e, Date aging_date)
 
{
 
	const EngineInfo *ei = &e->info;
 

	
 
	e->age = 0;
 
	e->flags = 0;
 
@@ -651,12 +656,13 @@ void StartupOneEngine(Engine *e, Date ag
 
	if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) {
 
		e->flags |= ENGINE_AVAILABLE;
 
		e->company_avail = 0;
 
	}
 
}
 

	
 
/** Start/initialise all our engines. */
 
void StartupEngines()
 
{
 
	Engine *e;
 
	/* Aging of vehicles stops, so account for that when starting late */
 
	const Date aging_date = min(_date, ConvertYMDToDate(_year_engine_aging_stops, 0, 1));
 

	
src/engine_gui.cpp
Show inline comments
 
@@ -125,12 +125,17 @@ static const WindowDesc _engine_preview_
 

	
 
void ShowEnginePreviewWindow(EngineID engine)
 
{
 
	AllocateWindowDescFront<EnginePreviewWindow>(&_engine_preview_desc, engine);
 
}
 

	
 
/**
 
 * Get the capacity of an engine with articulated parts.
 
 * @param engine The engine to get the capacity of.
 
 * @return The capacity.
 
 */
 
uint GetTotalCapacityOfArticulatedParts(EngineID engine)
 
{
 
	uint total = 0;
 

	
 
	CargoArray cap = GetCapacityOfArticulatedParts(engine);
 
	for (CargoID c = 0; c < NUM_CARGO; c++) {
src/gamelog.cpp
Show inline comments
 
@@ -323,12 +323,13 @@ void GamelogPrint(GamelogPrintProc *proc
 

	
 
static void GamelogPrintConsoleProc(const char *s)
 
{
 
	IConsolePrint(CC_WARNING, s);
 
}
 

	
 
/** Print the gamelog data to the console. */
 
void GamelogPrintConsole()
 
{
 
	GamelogPrint(&GamelogPrintConsoleProc);
 
}
 

	
 
static int _gamelog_print_level = 0; ///< gamelog debug level we need to print stuff
src/gamelog.h
Show inline comments
 
@@ -11,12 +11,13 @@
 

	
 
#ifndef GAMELOG_H
 
#define GAMELOG_H
 

	
 
#include "newgrf_config.h"
 

	
 
/** The actions we log. */
 
enum GamelogActionType {
 
	GLAT_START,        ///< Game created
 
	GLAT_LOAD,         ///< Game loaded
 
	GLAT_GRF,          ///< GRF changed
 
	GLAT_CHEAT,        ///< Cheat was used
 
	GLAT_SETTING,      ///< Setting changed
 
@@ -28,12 +29,16 @@ enum GamelogActionType {
 

	
 
void GamelogStartAction(GamelogActionType at);
 
void GamelogStopAction();
 

	
 
void GamelogReset();
 

	
 
/**
 
 * Callback for printing text.
 
 * @param s The string to print.
 
 */
 
typedef void GamelogPrintProc(const char *s);
 
void GamelogPrint(GamelogPrintProc *proc); // needed for WIN32 / WINCE crash.log
 

	
 
void GamelogPrintDebug(int level);
 
void GamelogPrintConsole();
 

	
src/genworld_gui.cpp
Show inline comments
 
@@ -872,27 +872,34 @@ static void _ShowGenerateLandscape(Genen
 
		strecpy(w->name, _file_to_saveload.title, lastof(w->name));
 
	}
 

	
 
	SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
 
}
 

	
 
/** Start with a normal game. */
 
void ShowGenerateLandscape()
 
{
 
	_ShowGenerateLandscape(GLWM_GENERATE);
 
}
 

	
 
/** Start with loading a heightmap. */
 
void ShowHeightmapLoad()
 
{
 
	_ShowGenerateLandscape(GLWM_HEIGHTMAP);
 
}
 

	
 
/** Start with a scenario editor. */
 
void StartScenarioEditor()
 
{
 
	StartGeneratingLandscape(GLWM_SCENARIO);
 
}
 

	
 
/**
 
 * Start a normal game without the GUI.
 
 * @param seed The seed of the new game.
 
 */
 
void StartNewGameWithoutGUI(uint seed)
 
{
 
	/* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
 
	_settings_newgame.game_creation.generation_seed = seed;
 

	
 
	StartGeneratingLandscape(GLWM_GENERATE);
 
@@ -1152,12 +1159,13 @@ static const WindowDesc _create_scenario
 
	WDP_CENTER, 0, 0,
 
	WC_GENERATE_LANDSCAPE, WC_NONE,
 
	WDF_UNCLICK_BUTTONS,
 
	_nested_create_scenario_widgets, lengthof(_nested_create_scenario_widgets)
 
);
 

	
 
/** Show the window to create a scenario. */
 
void ShowCreateScenario()
 
{
 
	DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
 
	new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
 
}
 

	
src/gfxinit.cpp
Show inline comments
 
@@ -132,13 +132,13 @@ void CheckExternalFiles()
 
		add_pos += seprintf(add_pos, last, "\t%s is %s (%s)\n", sounds_set->files->filename, sounds_set->files->CheckMD5(DATA_DIR) == MD5File::CR_MISMATCH ? "corrupt" : "missing", sounds_set->files->missing_warning);
 
	}
 

	
 
	if (add_pos != error_msg) ShowInfoF("%s", error_msg);
 
}
 

	
 

	
 
/** Actually load the sprite tables. */
 
static void LoadSpriteTables()
 
{
 
	memset(_palette_remap_grf, 0, sizeof(_palette_remap_grf));
 
	uint i = FIRST_GRF_SLOT;
 
	const GraphicsSet *used_set = BaseGraphics::GetUsedSet();
 

	
 
@@ -196,12 +196,13 @@ static void LoadSpriteTables()
 
	/* Free and remove the top element. */
 
	delete master;
 
	_grfconfig = top;
 
}
 

	
 

	
 
/** Initialise and load all the sprites. */
 
void GfxLoadSprites()
 
{
 
	DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
 

	
 
	GfxInitSpriteMem();
 
	LoadSpriteTables();
src/group_gui.cpp
Show inline comments
 
@@ -658,12 +658,17 @@ static const WindowDesc _train_group_des
 
	WDP_AUTO, 525, 246,
 
	WC_TRAINS_LIST, WC_NONE,
 
	WDF_UNCLICK_BUTTONS,
 
	_nested_group_widgets, lengthof(_nested_group_widgets)
 
);
 

	
 
/**
 
 * Show the group window for the given company and vehicle type.
 
 * @param company The company to show the window for.
 
 * @param vehicle_type The type of vehicle to show it for.
 
 */
 
void ShowCompanyGroup(CompanyID company, VehicleType vehicle_type)
 
{
 
	if (!Company::IsValidID(company)) return;
 

	
 
	WindowNumber num = VehicleListIdentifier(VL_GROUP_LIST, vehicle_type, company).Pack();
 
	if (vehicle_type == VEH_TRAIN) {
src/group_type.h
Show inline comments
 
@@ -9,17 +9,17 @@
 

	
 
/** @file group_type.h Types of a group. */
 

	
 
#ifndef GROUP_TYPE_H
 
#define GROUP_TYPE_H
 

	
 
typedef uint16 GroupID;
 
typedef uint16 GroupID; ///< Type for all group identifiers.
 

	
 
static const GroupID ALL_GROUP     = 0xFFFD;
 
static const GroupID DEFAULT_GROUP = 0xFFFE; ///< ungrouped vehicles are in this group.
 
static const GroupID INVALID_GROUP = 0xFFFF;
 
static const GroupID ALL_GROUP     = 0xFFFD; ///< All vehicles are in this group.
 
static const GroupID DEFAULT_GROUP = 0xFFFE; ///< Ungrouped vehicles are in this group.
 
static const GroupID INVALID_GROUP = 0xFFFF; ///< Sentinel for invalid groups.
 

	
 
static const uint MAX_LENGTH_GROUP_NAME_CHARS = 32; ///< The maximum length of a group name in characters including '\0'
 

	
 
struct Group;
 

	
 
#endif /* GROUP_TYPE_H */
src/house_type.h
Show inline comments
 
@@ -9,12 +9,12 @@
 

	
 
/** @file house_type.h declaration of basic house types and enums */
 

	
 
#ifndef HOUSE_TYPE_H
 
#define HOUSE_TYPE_H
 

	
 
typedef uint16 HouseID;
 
typedef uint16 HouseClassID;
 
typedef uint16 HouseID; ///< OpenTTD ID of house types.
 
typedef uint16 HouseClassID; ///< Classes of houses.
 

	
 
struct HouseSpec;
 

	
 
#endif /* HOUSE_TYPE_H */
src/ini.cpp
Show inline comments
 
@@ -22,12 +22,16 @@
 

	
 
#ifdef WIN32
 
# include <shellapi.h>
 
# include "core/mem_func.hpp"
 
#endif
 

	
 
/**
 
 * Create a new ini file with given group names.
 
 * @param list_group_names A \c NULL terminated list with group names that should be loaded as lists instead of variables. @see IGT_LIST
 
 */
 
IniFile::IniFile(const char * const *list_group_names) : IniLoadFile(list_group_names)
 
{
 
}
 

	
 
/**
 
 * Save the Ini file's data to the disk.
src/language.h
Show inline comments
 
@@ -82,12 +82,13 @@ struct LanguagePackHeader {
 
		for (uint8 i = 0; i < MAX_NUM_CASES; i++) {
 
			if (strcmp(case_str, this->cases[i]) == 0) return i;
 
		}
 
		return MAX_NUM_CASES;
 
	}
 
};
 
/** Make sure the size is right. */
 
assert_compile(sizeof(LanguagePackHeader) % 4 == 0);
 

	
 
/** Metadata about a single language. */
 
struct LanguageMetadata : public LanguagePackHeader {
 
	char file[MAX_PATH]; ///< Name of the file we read this data from.
 
};
src/livery.h
Show inline comments
 
@@ -56,25 +56,26 @@ enum LiveryScheme {
 
	LS_FREIGHT_TRAM,
 

	
 
	LS_END
 
};
 

	
 
DECLARE_POSTFIX_INCREMENT(LiveryScheme)
 
/** Helper information for extract tool. */
 
template <> struct EnumPropsT<LiveryScheme> : MakeEnumPropsT<LiveryScheme, byte, LS_BEGIN, LS_END, LS_END, 8> {};
 

	
 
/** List of different livery classes, used only by the livery GUI. */
 
enum LiveryClass {
 
	LC_OTHER,
 
	LC_RAIL,
 
	LC_ROAD,
 
	LC_SHIP,
 
	LC_AIRCRAFT,
 
	LC_END
 
};
 

	
 

	
 
/** Information about a particular livery. */
 
struct Livery {
 
	bool in_use;  ///< Set if this livery should be used instead of the default livery.
 
	byte colour1; ///< First colour, for all vehicles.
 
	byte colour2; ///< Second colour, for vehicles with 2CC support.
 
};
 

	
src/map.cpp
Show inline comments
 
@@ -225,13 +225,13 @@ uint DistanceFromEdge(TileIndex tile)
 
	return min(minl, minh);
 
}
 

	
 
/**
 
 * Gets the distance to the edge of the map in given direction.
 
 * @param tile the tile to get the distance from
 
 * @param diagdir the direction of interest
 
 * @param dir the direction of interest
 
 * @return the distance from the edge in tiles
 
 */
 
uint DistanceFromEdgeDir(TileIndex tile, DiagDirection dir)
 
{
 
	switch (dir) {
 
		case DIAGDIR_NE: return             TileX(tile) - (_settings_game.construction.freeform_edges ? 1 : 0);
src/map_func.h
Show inline comments
 
@@ -184,12 +184,18 @@ static inline TileIndexDiff TileDiffXY(i
 
	 * 0 << shift isn't optimized to 0 properly.
 
	 * Typically x and y are constants, and then this doesn't result
 
	 * in any actual multiplication in the assembly code.. */
 
	return (y * MapSizeX()) + x;
 
}
 

	
 
/**
 
 * Get a tile from the virtual XY-coordinate.
 
 * @param x The virtual x coordinate of the tile.
 
 * @param y The virtual y coordinate of the tile.
 
 * @return The TileIndex calculated by the coordinate.
 
 */
 
static inline TileIndex TileVirtXY(uint x, uint y)
 
{
 
	return (y >> 4 << MapLogX()) + (x >> 4);
 
}
 

	
 

	
src/misc/array.hpp
Show inline comments
 
@@ -73,12 +73,16 @@ public:
 
	{
 
		const SubArray& s = data[index / B];
 
		const T& item = s[index % B];
 
		return item;
 
	}
 

	
 
	/**
 
	 * Helper for creating a human readable output of this data.
 
	 * @param dmp The location to dump to.
 
	 */
 
	template <typename D> void Dump(D &dmp) const
 
	{
 
		dmp.WriteLine("capacity = %d", Tcapacity);
 
		uint num_items = Length();
 
		dmp.WriteLine("num_items = %d", num_items);
 
		CStrA name;
src/misc/binaryheap.hpp
Show inline comments
 
@@ -11,18 +11,20 @@
 

	
 
#ifndef BINARYHEAP_HPP
 
#define BINARYHEAP_HPP
 

	
 
#include "../core/alloc_func.hpp"
 

	
 
/* Enable it if you suspect binary heap doesn't work well */
 
/** Enable it if you suspect binary heap doesn't work well */
 
#define BINARYHEAP_CHECK 0
 

	
 
#if BINARYHEAP_CHECK
 
	/** Check for consistency. */
 
	#define CHECK_CONSISTY() this->CheckConsistency()
 
#else
 
	/** Don't check for consistency. */
 
	#define CHECK_CONSISTY() ;
 
#endif
 

	
 
/**
 
 * Binary Heap as C++ template.
 
 *  A carrier which keeps its items automatically holds the smallest item at
 
@@ -52,12 +54,16 @@ class CBinaryHeapT {
 
private:
 
	uint items;    ///< Number of items in the heap
 
	uint capacity; ///< Maximum number of items the heap can hold
 
	T **data;      ///< The pointer to the heap item pointers
 

	
 
public:
 
	/**
 
	 * Create a binary heap.
 
	 * @param max_items The limit of the heap
 
	 */
 
	explicit CBinaryHeapT(uint max_items)
 
		: items(0)
 
		, capacity(max_items)
 
	{
 
		this->data = MallocT<T *>(max_items + 1);
 
	}
src/misc/fixedsizearray.hpp
Show inline comments
 
@@ -28,14 +28,14 @@ protected:
 
	{
 
		uint items;           ///< number of items in the array
 
		uint reference_count; ///< block reference counter (used by copy constructor and by destructor)
 
	};
 

	
 
	/* make constants visible from outside */
 
	static const uint Tsize = sizeof(T);                // size of item
 
	static const uint HeaderSize = sizeof(ArrayHeader); // size of header
 
	static const uint Tsize = sizeof(T);                ///< size of item
 
	static const uint HeaderSize = sizeof(ArrayHeader); ///< size of header
 

	
 
	/**
 
	 * the only member of fixed size array is pointer to the block
 
	 *  of C array of items. Header can be found on the offset -sizeof(ArrayHeader).
 
	 */
 
	T *data;
src/strings.cpp
Show inline comments
 
@@ -1473,12 +1473,17 @@ bool LanguagePackHeader::IsValid() const
 
	       StrValid(this->isocode,                        lastof(this->isocode)) &&
 
	       StrValid(this->digit_group_separator,          lastof(this->digit_group_separator)) &&
 
	       StrValid(this->digit_group_separator_currency, lastof(this->digit_group_separator_currency)) &&
 
	       StrValid(this->digit_decimal_separator,        lastof(this->digit_decimal_separator));
 
}
 

	
 
/**
 
 * Read a particular language.
 
 * @param lang The metadata about the language.
 
 * @return Whether the loading went okay or not.
 
 */
 
bool ReadLanguagePack(const LanguageMetadata *lang)
 
{
 
	/* Current language pack */
 
	size_t len;
 
	LanguagePack *lang_pack = (LanguagePack *)ReadFileToMem(lang->file, &len, 1U << 20);
 
	if (lang_pack == NULL) return false;
0 comments (0 inline, 0 general)