mirror of https://github.com/OpenTTD/OpenTTD
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
parent
1692ce8312
commit
9d018723b7
|
@ -316,7 +316,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
|
||||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||||
EnforcePrecondition(false, ::IsValidTile(to));
|
EnforcePrecondition(false, ::IsValidTile(to));
|
||||||
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
|
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
|
||||||
EnforcePrecondition(false, ::DistanceManhattan(tile,to) >= 1);
|
EnforcePrecondition(false, ::DistanceManhattan(tile, to) >= 1);
|
||||||
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
|
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
|
||||||
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
|
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
|
||||||
EnforcePrecondition(false, diag_offset <= 1 ||
|
EnforcePrecondition(false, diag_offset <= 1 ||
|
||||||
|
@ -333,7 +333,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
|
||||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||||
EnforcePrecondition(false, ::IsValidTile(to));
|
EnforcePrecondition(false, ::IsValidTile(to));
|
||||||
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
|
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
|
||||||
EnforcePrecondition(false, ::DistanceManhattan(tile,to) >= 1);
|
EnforcePrecondition(false, ::DistanceManhattan(tile, to) >= 1);
|
||||||
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
|
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
|
||||||
EnforcePrecondition(false, diag_offset <= 1 ||
|
EnforcePrecondition(false, diag_offset <= 1 ||
|
||||||
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
|
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the details for the given vehicle at the position (x,y)
|
* Draw the details for the given vehicle at the position (x, y)
|
||||||
*
|
*
|
||||||
* @param v current vehicle
|
* @param v current vehicle
|
||||||
* @param x The x coordinate
|
* @param x The x coordinate
|
||||||
* @param y The y coordinate
|
* @param y The y coordinate
|
||||||
*/
|
*/
|
||||||
void DrawAircraftDetails(const Vehicle *v, int x, int y)
|
void DrawAircraftDetails(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
|
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
|
||||||
|
|
|
@ -780,7 +780,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
if (_network_server) {
|
if (_network_server) {
|
||||||
/* XXX - UGLY! p2 (pid) is mis-used to fetch the client-id, done at
|
/* XXX - UGLY! p2 (pid) is mis-used to fetch the client-id, done at
|
||||||
* server-side in network_server.c:838, function
|
* server side in network_server.c:838, function
|
||||||
* DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
|
* DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
|
||||||
CompanyID old_playas = ci->client_playas;
|
CompanyID old_playas = ci->client_playas;
|
||||||
ci->client_playas = c->index;
|
ci->client_playas = c->index;
|
||||||
|
|
|
@ -204,7 +204,7 @@ struct IConsoleWindow : Window
|
||||||
const int scroll_height = (this->height / ICON_LINE_HEIGHT) - 1;
|
const int scroll_height = (this->height / ICON_LINE_HEIGHT) - 1;
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case WKC_UP:
|
case WKC_UP:
|
||||||
IConsoleHistoryNavigate(+1);
|
IConsoleHistoryNavigate(1);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
|
||||||
uint _block_sizes[4][2];
|
uint _block_sizes[4][2];
|
||||||
|
|
||||||
/* Array to hold the default resize capacities
|
/* Array to hold the default resize capacities
|
||||||
* First part is the vehicle type, while the last is 0 = x, 1 = y */
|
* First part is the vehicle type, while the last is 0 = x, 1 = y */
|
||||||
const uint _resize_cap[][2] = {
|
const uint _resize_cap[][2] = {
|
||||||
/* VEH_TRAIN */ {6, 10 * 29},
|
/* VEH_TRAIN */ {6, 10 * 29},
|
||||||
/* VEH_ROAD */ {5, 5},
|
/* VEH_ROAD */ {5, 5},
|
||||||
|
|
|
@ -190,7 +190,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
|
||||||
do {
|
do {
|
||||||
min_income = min(min_income, cee->income + cee->expenses);
|
min_income = min(min_income, cee->income + cee->expenses);
|
||||||
max_income = max(max_income, cee->income + cee->expenses);
|
max_income = max(max_income, cee->income + cee->expenses);
|
||||||
} while (++cee,--numec);
|
} while (++cee, --numec);
|
||||||
|
|
||||||
if (min_income > 0) {
|
if (min_income > 0) {
|
||||||
_score_part[owner][SCORE_MIN_INCOME] = ClampToI32(min_income);
|
_score_part[owner][SCORE_MIN_INCOME] = ClampToI32(min_income);
|
||||||
|
@ -212,7 +212,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
|
||||||
total_delivered = 0;
|
total_delivered = 0;
|
||||||
do {
|
do {
|
||||||
total_delivered += cee->delivered_cargo;
|
total_delivered += cee->delivered_cargo;
|
||||||
} while (++cee,--numec);
|
} while (++cee, --numec);
|
||||||
|
|
||||||
_score_part[owner][SCORE_DELIVERED] = total_delivered;
|
_score_part[owner][SCORE_DELIVERED] = total_delivered;
|
||||||
}
|
}
|
||||||
|
@ -962,7 +962,7 @@ struct FoundRoute {
|
||||||
|
|
||||||
static void FindSubsidyPassengerRoute(FoundRoute *fr)
|
static void FindSubsidyPassengerRoute(FoundRoute *fr)
|
||||||
{
|
{
|
||||||
Town *from,*to;
|
Town *from, *to;
|
||||||
|
|
||||||
fr->distance = UINT_MAX;
|
fr->distance = UINT_MAX;
|
||||||
|
|
||||||
|
@ -1062,13 +1062,13 @@ static void SubsidyMonthlyHandler()
|
||||||
for (s = _subsidies; s != endof(_subsidies); s++) {
|
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||||
if (s->cargo_type == CT_INVALID) continue;
|
if (s->cargo_type == CT_INVALID) continue;
|
||||||
|
|
||||||
if (s->age == 12-1) {
|
if (s->age == 12 - 1) {
|
||||||
pair = SetupSubsidyDecodeParam(s, 1);
|
pair = SetupSubsidyDecodeParam(s, 1);
|
||||||
AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NS_SUBSIDIES, pair.a, pair.b);
|
AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NS_SUBSIDIES, pair.a, pair.b);
|
||||||
s->cargo_type = CT_INVALID;
|
s->cargo_type = CT_INVALID;
|
||||||
modified = true;
|
modified = true;
|
||||||
AI::BroadcastNewEvent(new AIEventSubsidyOfferExpired(s - _subsidies));
|
AI::BroadcastNewEvent(new AIEventSubsidyOfferExpired(s - _subsidies));
|
||||||
} else if (s->age == 2*12-1) {
|
} else if (s->age == 2 * 12 - 1) {
|
||||||
st = GetStation(s->to);
|
st = GetStation(s->to);
|
||||||
if (st->owner == _local_company) {
|
if (st->owner == _local_company) {
|
||||||
pair = SetupSubsidyDecodeParam(s, 1);
|
pair = SetupSubsidyDecodeParam(s, 1);
|
||||||
|
@ -1083,7 +1083,7 @@ static void SubsidyMonthlyHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 25% chance to go on */
|
/* 25% chance to go on */
|
||||||
if (Chance16(1,4)) {
|
if (Chance16(1, 4)) {
|
||||||
/* Find a free slot*/
|
/* Find a free slot*/
|
||||||
s = _subsidies;
|
s = _subsidies;
|
||||||
while (s->cargo_type != CT_INVALID) {
|
while (s->cargo_type != CT_INVALID) {
|
||||||
|
|
|
@ -673,7 +673,7 @@ void EnginesMonthlyLoop()
|
||||||
if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + DAYS_IN_YEAR)) {
|
if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + DAYS_IN_YEAR)) {
|
||||||
/* Introduce it to all companies */
|
/* Introduce it to all companies */
|
||||||
NewVehicleAvailable(e);
|
NewVehicleAvailable(e);
|
||||||
} else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_EXCLUSIVE_PREVIEW)) && _date >= e->intro_date) {
|
} else if (!(e->flags & (ENGINE_AVAILABLE | ENGINE_EXCLUSIVE_PREVIEW)) && _date >= e->intro_date) {
|
||||||
/* Introduction date has passed.. show introducing dialog to one companies. */
|
/* Introduction date has passed.. show introducing dialog to one companies. */
|
||||||
e->flags |= ENGINE_EXCLUSIVE_PREVIEW;
|
e->flags |= ENGINE_EXCLUSIVE_PREVIEW;
|
||||||
|
|
||||||
|
|
|
@ -555,10 +555,9 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
|
||||||
EventState state;
|
EventState state;
|
||||||
this->HandleEditBoxKey(GLAND_RANDOM_EDITBOX, key, keycode, state);
|
this->HandleEditBoxKey(GLAND_RANDOM_EDITBOX, key, keycode, state);
|
||||||
/* the seed is unsigned, therefore atoi cannot be used.
|
/* the seed is unsigned, therefore atoi cannot be used.
|
||||||
* As 2^32 - 1 (UINT32_MAX) is a 'magic' value
|
* As UINT32_MAX is a 'magic' value (use random seed) it
|
||||||
* (use random seed) it should not be possible to be
|
* should not be possible to be entered into the input
|
||||||
* entered into the input field; the generate seed
|
* field; the generate seed button can be used instead. */
|
||||||
* button can be used instead. */
|
|
||||||
_settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), UINT32_MAX - 1);
|
_settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), UINT32_MAX - 1);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1921,14 +1921,14 @@ static bool CheckIndustryCloseDownProtection(IndustryType type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can given cargo type be accepted or produced by the industry?
|
* Can given cargo type be accepted or produced by the industry?
|
||||||
* @param cargo: Cargo type
|
* @param cargo: Cargo type
|
||||||
* @param ind: Industry
|
* @param ind: Industry
|
||||||
* @param *c_accepts: Pointer to boolean for acceptance of cargo
|
* @param *c_accepts: Pointer to boolean for acceptance of cargo
|
||||||
* @param *c_produces: Pointer to boolean for production of cargo
|
* @param *c_produces: Pointer to boolean for production of cargo
|
||||||
* @return: \c *c_accepts is set when industry accepts the cargo type,
|
* @return: \c *c_accepts is set when industry accepts the cargo type,
|
||||||
* \c *c_produces is set when the industry produces the cargo type
|
* \c *c_produces is set when the industry produces the cargo type
|
||||||
*/
|
*/
|
||||||
static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accepts, bool *c_produces)
|
static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accepts, bool *c_produces)
|
||||||
{
|
{
|
||||||
const IndustrySpec *indspec = GetIndustrySpec(ind->type);
|
const IndustrySpec *indspec = GetIndustrySpec(ind->type);
|
||||||
|
@ -1959,18 +1959,18 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute who can service the industry.
|
* Compute who can service the industry.
|
||||||
*
|
*
|
||||||
* Here, 'can service' means that he/she has trains and stations close enough
|
* Here, 'can service' means that he/she has trains and stations close enough
|
||||||
* to the industry with the right cargo type and the right orders (ie has the
|
* to the industry with the right cargo type and the right orders (ie has the
|
||||||
* technical means).
|
* technical means).
|
||||||
*
|
*
|
||||||
* @param ind: Industry being investigated.
|
* @param ind: Industry being investigated.
|
||||||
*
|
*
|
||||||
* @return: 0 if nobody can service the industry, 2 if the local company can
|
* @return: 0 if nobody can service the industry, 2 if the local company can
|
||||||
* service the industry, and 1 otherwise (only competitors can service the
|
* service the industry, and 1 otherwise (only competitors can service the
|
||||||
* industry)
|
* industry)
|
||||||
*/
|
*/
|
||||||
int WhoCanServiceIndustry(Industry *ind)
|
int WhoCanServiceIndustry(Industry *ind)
|
||||||
{
|
{
|
||||||
/* Find all stations within reach of the industry */
|
/* Find all stations within reach of the industry */
|
||||||
|
@ -2024,12 +2024,12 @@ int WhoCanServiceIndustry(Industry *ind)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report news that industry production has changed significantly
|
* Report news that industry production has changed significantly
|
||||||
*
|
*
|
||||||
* @param ind: Industry with changed production
|
* @param ind: Industry with changed production
|
||||||
* @param type: Cargo type that has changed
|
* @param type: Cargo type that has changed
|
||||||
* @param percent: Percentage of change (>0 means increase, <0 means decrease)
|
* @param percent: Percentage of change (>0 means increase, <0 means decrease)
|
||||||
*/
|
*/
|
||||||
static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int percent)
|
static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int percent)
|
||||||
{
|
{
|
||||||
NewsSubtype ns;
|
NewsSubtype ns;
|
||||||
|
|
|
@ -9,34 +9,34 @@
|
||||||
#include "../core/mem_func.hpp"
|
#include "../core/mem_func.hpp"
|
||||||
|
|
||||||
/** Base class for simple binary blobs.
|
/** Base class for simple binary blobs.
|
||||||
* Item is byte.
|
* Item is byte.
|
||||||
* The word 'simple' means:
|
* The word 'simple' means:
|
||||||
* - no configurable allocator type (always made from heap)
|
* - no configurable allocator type (always made from heap)
|
||||||
* - no smart deallocation - deallocation must be called from the same
|
* - no smart deallocation - deallocation must be called from the same
|
||||||
* module (DLL) where the blob was allocated
|
* module (DLL) where the blob was allocated
|
||||||
* - no configurable allocation policy (how big blocks should be allocated)
|
* - no configurable allocation policy (how big blocks should be allocated)
|
||||||
* - no extra ownership policy (i.e. 'copy on write') when blob is copied
|
* - no extra ownership policy (i.e. 'copy on write') when blob is copied
|
||||||
* - no thread synchronization at all
|
* - no thread synchronization at all
|
||||||
*
|
*
|
||||||
* Internal member layout:
|
* Internal member layout:
|
||||||
* 1. The only class member is pointer to the first item (see union ptr_u).
|
* 1. The only class member is pointer to the first item (see union ptr_u).
|
||||||
* 2. Allocated block contains the blob header (see CHdr) followed by the raw byte data.
|
* 2. Allocated block contains the blob header (see CHdr) followed by the raw byte data.
|
||||||
* Always, when it allocates memory the allocated size is:
|
* Always, when it allocates memory the allocated size is:
|
||||||
* sizeof(CHdr) + <data capacity>
|
* sizeof(CHdr) + <data capacity>
|
||||||
* 3. Two 'virtual' members (m_size and m_max_size) are stored in the CHdr at beginning
|
* 3. Two 'virtual' members (m_size and m_max_size) are stored in the CHdr at beginning
|
||||||
* of the alloated block.
|
* of the alloated block.
|
||||||
* 4. The pointter (in ptr_u) pobsize_ts behind the header (to the first data byte).
|
* 4. The pointter (in ptr_u) pobsize_ts behind the header (to the first data byte).
|
||||||
* When memory block is allocated, the sizeof(CHdr) it added to it.
|
* When memory block is allocated, the sizeof(CHdr) it added to it.
|
||||||
* 5. Benefits of this layout:
|
* 5. Benefits of this layout:
|
||||||
* - items are accessed in the simplest possible way - just dereferencing the pointer,
|
* - items are accessed in the simplest possible way - just dereferencing the pointer,
|
||||||
* which is good for performance (assuming that data are accessed most often).
|
* which is good for performance (assuming that data are accessed most often).
|
||||||
* - sizeof(blob) is the same as the size of any other pointer
|
* - sizeof(blob) is the same as the size of any other pointer
|
||||||
* 6. Drawbacks of this layout:
|
* 6. Drawbacks of this layout:
|
||||||
* - the fact, that pointer to the alocated block is adjusted by sizeof(CHdr) before
|
* - the fact, that pointer to the alocated block is adjusted by sizeof(CHdr) before
|
||||||
* it is stored can lead to several confusions:
|
* it is stored can lead to several confusions:
|
||||||
* - it is not common pattern so the implementation code is bit harder to read
|
* - it is not common pattern so the implementation code is bit harder to read
|
||||||
* - valgrind can generate warning that allocated block is lost (not accessible)
|
* - valgrind can generate warning that allocated block is lost (not accessible)
|
||||||
* */
|
*/
|
||||||
class CBlobBaseSimple {
|
class CBlobBaseSimple {
|
||||||
public:
|
public:
|
||||||
typedef ::ptrdiff_t bsize_t;
|
typedef ::ptrdiff_t bsize_t;
|
||||||
|
@ -312,12 +312,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Blob - simple dynamic Titem_ array. Titem_ (template argument) is a placeholder for any type.
|
/** Blob - simple dynamic Titem_ array. Titem_ (template argument) is a placeholder for any type.
|
||||||
* Titem_ can be any integral type, pointer, or structure. Using Blob instead of just plain C array
|
* Titem_ can be any integral type, pointer, or structure. Using Blob instead of just plain C array
|
||||||
* simplifies the resource management in several ways:
|
* simplifies the resource management in several ways:
|
||||||
* 1. When adding new item(s) it automatically grows capacity if needed.
|
* 1. When adding new item(s) it automatically grows capacity if needed.
|
||||||
* 2. When variable of type Blob comes out of scope it automatically frees the data buffer.
|
* 2. When variable of type Blob comes out of scope it automatically frees the data buffer.
|
||||||
* 3. Takes care about the actual data size (number of used items).
|
* 3. Takes care about the actual data size (number of used items).
|
||||||
* 4. Dynamically constructs only used items (as opposite of static array which constructs all items) */
|
* 4. Dynamically constructs only used items (as opposite of static array which constructs all items) */
|
||||||
template <class Titem_, class Tbase_ = CBlobBaseSimple>
|
template <class Titem_, class Tbase_ = CBlobBaseSimple>
|
||||||
class CBlobT : public Tbase_ {
|
class CBlobT : public Tbase_ {
|
||||||
// make template arguments public:
|
// make template arguments public:
|
||||||
|
|
|
@ -23,9 +23,9 @@ template <typename T, size_t N> struct ArrayT<T[N]> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper template function that returns item of array at given index
|
* Helper template function that returns item of array at given index
|
||||||
* or t_unk when index is out of bounds.
|
* or t_unk when index is out of bounds.
|
||||||
*/
|
*/
|
||||||
template <typename E, typename T>
|
template <typename E, typename T>
|
||||||
inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk)
|
inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk)
|
||||||
{
|
{
|
||||||
|
@ -36,10 +36,10 @@ inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper template function that returns item of array at given index
|
* Helper template function that returns item of array at given index
|
||||||
* or t_inv when index == idx_inv
|
* or t_inv when index == idx_inv
|
||||||
* or t_unk when index is out of bounds.
|
* or t_unk when index is out of bounds.
|
||||||
*/
|
*/
|
||||||
template <typename E, typename T>
|
template <typename E, typename T>
|
||||||
inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk, E idx_inv, typename ArrayT<T>::item_t t_inv)
|
inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk, E idx_inv, typename ArrayT<T>::item_t t_inv)
|
||||||
{
|
{
|
||||||
|
@ -53,11 +53,11 @@ inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper template function that returns compound bitfield name that is
|
* Helper template function that returns compound bitfield name that is
|
||||||
* concatenation of names of each set bit in the given value
|
* concatenation of names of each set bit in the given value
|
||||||
* or t_inv when index == idx_inv
|
* or t_inv when index == idx_inv
|
||||||
* or t_unk when index is out of bounds.
|
* or t_unk when index is out of bounds.
|
||||||
*/
|
*/
|
||||||
template <typename E, typename T>
|
template <typename E, typename T>
|
||||||
inline CStrA ComposeNameT(E value, T &t, const char *t_unk, E val_inv, const char *name_inv)
|
inline CStrA ComposeNameT(E value, T &t, const char *t_unk, E val_inv, const char *name_inv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -713,8 +713,8 @@ public:
|
||||||
SetVScrollCount(this, this->servers.Length());
|
SetVScrollCount(this, this->servers.Length());
|
||||||
|
|
||||||
/* Additional colums in server list */
|
/* Additional colums in server list */
|
||||||
if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE)
|
if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE) +
|
||||||
+ GetWidgetWidth(NGWW_DATE) + GetWidgetWidth(NGWW_YEARS)) {
|
GetWidgetWidth(NGWW_DATE) + GetWidgetWidth(NGWW_YEARS)) {
|
||||||
/* show columns 'Map size', 'Date' and 'Years' */
|
/* show columns 'Map size', 'Date' and 'Years' */
|
||||||
this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
|
this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
|
||||||
AlignWidgetRight(NGWW_YEARS, NGWW_INFO);
|
AlignWidgetRight(NGWW_YEARS, NGWW_INFO);
|
||||||
|
|
|
@ -117,7 +117,7 @@ static uint32 RotateRight(uint32 val, uint32 rot)
|
||||||
|
|
||||||
|
|
||||||
/* Evaluate an adjustment for a variable of the given size.
|
/* Evaluate an adjustment for a variable of the given size.
|
||||||
* U is the unsigned type and S is the signed type to use. */
|
* U is the unsigned type and S is the signed type to use. */
|
||||||
template <typename U, typename S>
|
template <typename U, typename S>
|
||||||
static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ResolverObject *object, U last_value, uint32 value)
|
static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ResolverObject *object, U last_value, uint32 value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -890,28 +890,28 @@ struct MessageOptionsWindow : Window {
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The news settings window widgets
|
* The news settings window widgets
|
||||||
*
|
*
|
||||||
* Main part of the window is a list of news-setting lines, one for each news category.
|
* Main part of the window is a list of news setting lines, one for each news category.
|
||||||
* Each line is constructed by an expansion of the \c NEWS_SETTINGS_LINE macro
|
* Each line is constructed by an expansion of the \c NEWS_SETTINGS_LINE macro
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro to construct one news-setting line in the news-settings window.
|
* Macro to construct one news setting line in the news - settings window.
|
||||||
* One line consists of four widgets, namely
|
* One line consists of four widgets, namely
|
||||||
* - A [<] button
|
* - A [<] button
|
||||||
* - A [...] label
|
* - A [...] label
|
||||||
* - A [>] button
|
* - A [>] button
|
||||||
* - A text label describing the news category
|
* - A text label describing the news category
|
||||||
* Horizontal positions of the widgets are hard-coded, vertical start position is (\a basey + \a linenum * \c NEWS_SETTING_BASELINE_SKIP).
|
* Horizontal positions of the widgets are hard coded, vertical start position is (\a basey + \a linenum * \c NEWS_SETTING_BASELINE_SKIP).
|
||||||
* Height of one line is 12, with the text label shifted 1 pixel down.
|
* Height of one line is 12, with the text label shifted 1 pixel down.
|
||||||
*
|
*
|
||||||
* First line should be widget number WIDGET_NEWSOPT_START_OPTION
|
* First line should be widget number WIDGET_NEWSOPT_START_OPTION
|
||||||
*
|
*
|
||||||
* @param basey: Base Y coordinate
|
* @param basey: Base Y coordinate
|
||||||
* @param linenum: Count, news-setting is the \a linenum-th line
|
* @param linenum: Count, news - setting is the \a linenum - th line
|
||||||
* @param text: StringID for the text label to display
|
* @param text: StringID for the text label to display
|
||||||
*/
|
*/
|
||||||
#define NEWS_SETTINGS_LINE(basey, linenum, text) \
|
#define NEWS_SETTINGS_LINE(basey, linenum, text) \
|
||||||
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_YELLOW, \
|
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_YELLOW, \
|
||||||
4, 12, basey + linenum * NEWS_SETTING_BASELINE_SKIP, basey + 11 + linenum * NEWS_SETTING_BASELINE_SKIP, \
|
4, 12, basey + linenum * NEWS_SETTING_BASELINE_SKIP, basey + 11 + linenum * NEWS_SETTING_BASELINE_SKIP, \
|
||||||
|
|
|
@ -217,7 +217,7 @@ struct MyGetOptData {
|
||||||
|
|
||||||
static int MyGetOpt(MyGetOptData *md)
|
static int MyGetOpt(MyGetOptData *md)
|
||||||
{
|
{
|
||||||
const char *s,*r,*t;
|
const char *s, *r, *t;
|
||||||
|
|
||||||
s = md->cont;
|
s = md->cont;
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
|
|
|
@ -862,7 +862,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
|
||||||
uint sy = TileY(start);
|
uint sy = TileY(start);
|
||||||
uint ex = TileX(end);
|
uint ex = TileX(end);
|
||||||
uint ey = TileY(end);
|
uint ey = TileY(end);
|
||||||
uint w,h;
|
uint w, h;
|
||||||
|
|
||||||
if (sx > ex) Swap(sx, ex);
|
if (sx > ex) Swap(sx, ex);
|
||||||
if (sy > ey) Swap(sy, ey);
|
if (sy > ey) Swap(sy, ey);
|
||||||
|
|
|
@ -35,12 +35,12 @@ void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the details for the given vehicle at the position (x,y)
|
* Draw the details for the given vehicle at the position (x, y)
|
||||||
*
|
*
|
||||||
* @param v current vehicle
|
* @param v current vehicle
|
||||||
* @param x The x coordinate
|
* @param x The x coordinate
|
||||||
* @param y The y coordinate
|
* @param y The y coordinate
|
||||||
*/
|
*/
|
||||||
void DrawShipDetails(const Vehicle *v, int x, int y)
|
void DrawShipDetails(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
SetDParam(0, v->engine_type);
|
SetDParam(0, v->engine_type);
|
||||||
|
|
|
@ -42,7 +42,7 @@ static const Widget _smallmap_widgets[] = {
|
||||||
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 180, 201, SPR_IMG_TOWN, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF},
|
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 180, 201, SPR_IMG_TOWN, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF},
|
||||||
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 337, 202, 213, 0x0, STR_NULL},
|
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 337, 202, 213, 0x0, STR_NULL},
|
||||||
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 0, 99, 202, 213, STR_MESSAGES_ENABLE_ALL, STR_NULL},
|
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 0, 99, 202, 213, STR_MESSAGES_ENABLE_ALL, STR_NULL},
|
||||||
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 100, 201, 202, 213, STR_MESSAGES_DISABLE_ALL,STR_NULL},
|
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 100, 201, 202, 213, STR_MESSAGES_DISABLE_ALL, STR_NULL},
|
||||||
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_BROWN, 338, 349, 202, 213, 0x0, STR_RESIZE_BUTTON},
|
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_BROWN, 338, 349, 202, 213, 0x0, STR_RESIZE_BUTTON},
|
||||||
{ WIDGETS_END},
|
{ WIDGETS_END},
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,26 +3,26 @@
|
||||||
/** @file files.h MD5 checksum information and names of the original and extra data files. */
|
/** @file files.h MD5 checksum information and names of the original and extra data files. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
MD5 sums of graphics files
|
* MD5 sums of graphics files
|
||||||
|
*
|
||||||
DOS -
|
* DOS -
|
||||||
|
*
|
||||||
TRG1.GRF 9311676280e5b14077a8ee41c1b42192
|
* TRG1.GRF 9311676280e5b14077a8ee41c1b42192
|
||||||
TRGC.GRF ed446637e034104c5559b32c18afe78d
|
* TRGC.GRF ed446637e034104c5559b32c18afe78d
|
||||||
TRGH.GRF ee6616fb0e6ef6b24892c58c93d86fc9
|
* TRGH.GRF ee6616fb0e6ef6b24892c58c93d86fc9
|
||||||
TRGI.GRF da6a6c9dcc451eec88d79211437b76a8
|
* TRGI.GRF da6a6c9dcc451eec88d79211437b76a8
|
||||||
TRGT.GRF e30e8a398ae86c03dc534a8ac7dfb3b6 (German: fcde1d7e8a74197d72a62695884b909e)
|
* TRGT.GRF e30e8a398ae86c03dc534a8ac7dfb3b6 (German: fcde1d7e8a74197d72a62695884b909e)
|
||||||
SAMPLE.CAT 422ea3dd074d2859bb51639a6e0e85da
|
* SAMPLE.CAT 422ea3dd074d2859bb51639a6e0e85da
|
||||||
|
*
|
||||||
WINDOWS -
|
* WINDOWS -
|
||||||
|
*
|
||||||
TRG1R.GRF b04ce593d8c5016e07473a743d7d3358
|
* TRG1R.GRF b04ce593d8c5016e07473a743d7d3358
|
||||||
TRGCR.GRF 3668f410c761a050b5e7095a2b14879b
|
* TRGCR.GRF 3668f410c761a050b5e7095a2b14879b
|
||||||
TRGHR.GRF 06bf2b7a31766f048baac2ebe43457b1
|
* TRGHR.GRF 06bf2b7a31766f048baac2ebe43457b1
|
||||||
TRGIR.GRF 0c2484ff6be49fc63a83be6ab5c38f32
|
* TRGIR.GRF 0c2484ff6be49fc63a83be6ab5c38f32
|
||||||
TRGTR.GRF de53650517fe661ceaa3138c6edb0eb8
|
* TRGTR.GRF de53650517fe661ceaa3138c6edb0eb8
|
||||||
SAMPLE.CAT 9212e81e72badd4bbe1eaeae66458e10
|
* SAMPLE.CAT 9212e81e72badd4bbe1eaeae66458e10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static MD5File _sound_sets[] = {
|
static MD5File _sound_sets[] = {
|
||||||
|
|
|
@ -720,9 +720,9 @@ CargoID FindFirstRefittableCargo(EngineID engine_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Learn the price of refitting a certain engine
|
/** Learn the price of refitting a certain engine
|
||||||
* @param engine_type Which engine to refit
|
* @param engine_type Which engine to refit
|
||||||
* @return Price for refitting
|
* @return Price for refitting
|
||||||
*/
|
*/
|
||||||
CommandCost GetRefitCost(EngineID engine_type)
|
CommandCost GetRefitCost(EngineID engine_type)
|
||||||
{
|
{
|
||||||
Money base_cost;
|
Money base_cost;
|
||||||
|
|
|
@ -420,9 +420,9 @@ static const WindowDesc _vehicle_refit_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Show the refit window for a vehicle
|
/** Show the refit window for a vehicle
|
||||||
* @param *v The vehicle to show the refit window for
|
* @param *v The vehicle to show the refit window for
|
||||||
* @param order of the vehicle ( ? )
|
* @param order of the vehicle ( ? )
|
||||||
*/
|
*/
|
||||||
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent)
|
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_VEHICLE_REFIT, v->index);
|
DeleteWindowById(WC_VEHICLE_REFIT, v->index);
|
||||||
|
|
|
@ -576,8 +576,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert local coordinate to window server (CoreGraphics) coordinate.
|
* Convert local coordinate to window server (CoreGraphics) coordinate.
|
||||||
In fullscreen mode this just means copying the coords.
|
* In fullscreen mode this just means copying the coords.
|
||||||
*/
|
*/
|
||||||
virtual CGPoint PrivateLocalToCG(NSPoint *p)
|
virtual CGPoint PrivateLocalToCG(NSPoint *p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2251,9 +2251,9 @@ void VpSetPlaceSizingLimit(int limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlights all tiles between a set of two tiles. Used in dock and tunnel placement
|
* Highlights all tiles between a set of two tiles. Used in dock and tunnel placement
|
||||||
* @param from TileIndex of the first tile to highlight
|
* @param from TileIndex of the first tile to highlight
|
||||||
* @param to TileIndex of the last tile to highlight */
|
* @param to TileIndex of the last tile to highlight */
|
||||||
void VpSetPresizeRange(TileIndex from, TileIndex to)
|
void VpSetPresizeRange(TileIndex from, TileIndex to)
|
||||||
{
|
{
|
||||||
uint64 distance = DistanceManhattan(from, to) + 1;
|
uint64 distance = DistanceManhattan(from, to) + 1;
|
||||||
|
@ -2338,19 +2338,19 @@ static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculates height difference between one tile and another
|
/** Calculates height difference between one tile and another
|
||||||
* Multiplies the result to suit the standard given by minimap - 50 meters high
|
* Multiplies the result to suit the standard given by minimap - 50 meters high
|
||||||
* To correctly get the height difference we need the direction we are dragging
|
* To correctly get the height difference we need the direction we are dragging
|
||||||
* in, as well as with what kind of tool we are dragging. For example a horizontal
|
* in, as well as with what kind of tool we are dragging. For example a horizontal
|
||||||
* autorail tool that starts in bottom and ends at the top of a tile will need the
|
* autorail tool that starts in bottom and ends at the top of a tile will need the
|
||||||
* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
|
* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
|
||||||
* See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
|
* See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
|
||||||
* the values yourself.
|
* the values yourself.
|
||||||
* @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
|
* @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
|
||||||
* @param distance amount of tiles dragged, important for horizontal/vertical drags
|
* @param distance amount of tiles dragged, important for horizontal/vertical drags
|
||||||
* ignored for others
|
* ignored for others
|
||||||
* @param start_tile, end_tile start and end tile of drag operation
|
* @param start_tile, end_tile start and end tile of drag operation
|
||||||
* @return height difference between two tiles. Tile measurement tool utilizes
|
* @return height difference between two tiles. Tile measurement tool utilizes
|
||||||
* this value in its tooltips */
|
* this value in its tooltips */
|
||||||
static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_tile, TileIndex end_tile)
|
static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_tile, TileIndex end_tile)
|
||||||
{
|
{
|
||||||
bool swap = SwapDirection(style, start_tile, end_tile);
|
bool swap = SwapDirection(style, start_tile, end_tile);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
{
|
{
|
||||||
int x = TileX(this->wp->xy) * TILE_SIZE;
|
int x = TileX(this->wp->xy) * TILE_SIZE;
|
||||||
int y = TileY(this->wp->xy) * TILE_SIZE;
|
int y = TileY(this->wp->xy) * TILE_SIZE;
|
||||||
ScrollWindowTo(x,y, this);
|
ScrollWindowTo(x, y, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnQueryTextFinished(char *str)
|
virtual void OnQueryTextFinished(char *str)
|
||||||
|
|
|
@ -1968,6 +1968,7 @@ void MouseLoop(MouseClick click, int mousewheel)
|
||||||
if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break;
|
if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break;
|
||||||
/* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.
|
/* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.
|
||||||
* Simulate a right button click so we can get started. */
|
* Simulate a right button click so we can get started. */
|
||||||
|
|
||||||
/* fallthough */
|
/* fallthough */
|
||||||
case MC_RIGHT: DispatchRightClickEvent(w, x - w->left, y - w->top); break;
|
case MC_RIGHT: DispatchRightClickEvent(w, x - w->left, y - w->top); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ struct CSegmentCostCacheT
|
||||||
/** CYapfSegmentCostCacheGlobalT - the yapf cost cache provider that adds the segment cost
|
/** CYapfSegmentCostCacheGlobalT - the yapf cost cache provider that adds the segment cost
|
||||||
* caching functionality to yapf. Using this class as base of your will provide the global
|
* caching functionality to yapf. Using this class as base of your will provide the global
|
||||||
* segment cost caching services for your Nodes.
|
* segment cost caching services for your Nodes.
|
||||||
*/
|
*/
|
||||||
template <class Types>
|
template <class Types>
|
||||||
class CYapfSegmentCostCacheGlobalT
|
class CYapfSegmentCostCacheGlobalT
|
||||||
: public CYapfSegmentCostCacheLocalT<Types>
|
: public CYapfSegmentCostCacheLocalT<Types>
|
||||||
|
|
Loading…
Reference in New Issue