mirror of https://github.com/OpenTTD/OpenTTD
(svn r19258) [1.0] -Backport from trunk:
- Feature: [NewGRF] Add 2 bits of pseudo-random data for rail types, based on tile location (r19235) - Fix: Writing (console) output to a file failed on Windows if the date would not be logged [FS#3639] (r19252) - Fix: [NewGRF] Some GRF error messages did not free the previous error messages, creating a memory leak (r19251) - Fix: With RTL languages clicking a horizontal scrollbar that could not scroll could cause a crash [FS#3643] (r19250) - Fix: Start and end tiles were swapped in CMD_REMOVE_LONG_ROAD causing too much road to be removed [FS#3642] (r19249) - Fix: DOS 'port' did not compile anymore (r19248) - Fix: The -M command line option did not work (r19233)release/1.0
parent
bfa5e7fef5
commit
7ed9361ad9
|
@ -549,7 +549,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
|
||||||
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
|
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
|
||||||
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
|
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
|
||||||
|
|
||||||
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
|
return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool AIRoad::RemoveRoadFull(TileIndex start, TileIndex end)
|
/* static */ bool AIRoad::RemoveRoadFull(TileIndex start, TileIndex end)
|
||||||
|
@ -559,7 +559,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
|
||||||
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
|
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
|
||||||
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
|
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
|
||||||
|
|
||||||
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
|
return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool AIRoad::RemoveRoadDepot(TileIndex tile)
|
/* static */ bool AIRoad::RemoveRoadDepot(TileIndex tile)
|
||||||
|
|
|
@ -50,7 +50,7 @@ static void IConsoleWriteToLogFile(const char *string)
|
||||||
if (_iconsole_output_file != NULL) {
|
if (_iconsole_output_file != NULL) {
|
||||||
/* if there is an console output file ... also print it there */
|
/* if there is an console output file ... also print it there */
|
||||||
const char *header = GetLogPrefix();
|
const char *header = GetLogPrefix();
|
||||||
if (fwrite(header, strlen(header), 1, _iconsole_output_file) != 1 ||
|
if ((strlen(header) != 0 && fwrite(header, strlen(header), 1, _iconsole_output_file) != 1) ||
|
||||||
fwrite(string, strlen(string), 1, _iconsole_output_file) != 1 ||
|
fwrite(string, strlen(string), 1, _iconsole_output_file) != 1 ||
|
||||||
fwrite("\n", 1, 1, _iconsole_output_file) != 1) {
|
fwrite("\n", 1, 1, _iconsole_output_file) != 1) {
|
||||||
fclose(_iconsole_output_file);
|
fclose(_iconsole_output_file);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <storage/FindDirectory.h>
|
#include <storage/FindDirectory.h>
|
||||||
#else
|
#else
|
||||||
#ifdef OPENBSD
|
#if defined(OPENBSD) || defined(DOS)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
|
@ -2668,8 +2668,8 @@ static bool HandleChangeInfoResult(const char *caller, ChangeInfoResult cir, uin
|
||||||
/* No debug message for an invalid ID, as it has already been output */
|
/* No debug message for an invalid ID, as it has already been output */
|
||||||
_skip_sprites = -1;
|
_skip_sprites = -1;
|
||||||
_cur_grfconfig->status = GCS_DISABLED;
|
_cur_grfconfig->status = GCS_DISABLED;
|
||||||
_cur_grfconfig->error = CallocT<GRFError>(1);
|
delete _cur_grfconfig->error;
|
||||||
_cur_grfconfig->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
_cur_grfconfig->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL);
|
||||||
_cur_grfconfig->error->message = (cir == CIR_INVALID_ID) ? STR_NEWGRF_ERROR_INVALID_ID : STR_NEWGRF_ERROR_UNKNOWN_PROPERTY;
|
_cur_grfconfig->error->message = (cir == CIR_INVALID_ID) ? STR_NEWGRF_ERROR_INVALID_ID : STR_NEWGRF_ERROR_UNKNOWN_PROPERTY;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4198,16 +4198,10 @@ static void CfgApply(ByteReader *buf)
|
||||||
*/
|
*/
|
||||||
static void DisableStaticNewGRFInfluencingNonStaticNewGRFs(GRFConfig *c)
|
static void DisableStaticNewGRFInfluencingNonStaticNewGRFs(GRFConfig *c)
|
||||||
{
|
{
|
||||||
if (c->error != NULL) {
|
delete c->error;
|
||||||
free(c->error->custom_message);
|
|
||||||
free(c->error->data);
|
|
||||||
free(c->error);
|
|
||||||
}
|
|
||||||
c->status = GCS_DISABLED;
|
c->status = GCS_DISABLED;
|
||||||
c->error = CallocT<GRFError>(1);
|
c->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_STATIC_GRF_CAUSES_DESYNC);
|
||||||
c->error->data = strdup(_cur_grfconfig->name);
|
c->error->data = strdup(_cur_grfconfig->name);
|
||||||
c->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
|
||||||
c->error->message = STR_NEWGRF_ERROR_STATIC_GRF_CAUSES_DESYNC;
|
|
||||||
|
|
||||||
ClearTemporaryNewGRFData(GetFileByGRFID(c->grfid));
|
ClearTemporaryNewGRFData(GetFileByGRFID(c->grfid));
|
||||||
}
|
}
|
||||||
|
@ -4416,9 +4410,8 @@ static void GRFInfo(ByteReader *buf)
|
||||||
|
|
||||||
if (_cur_stage < GLS_RESERVE && _cur_grfconfig->status != GCS_UNKNOWN) {
|
if (_cur_stage < GLS_RESERVE && _cur_grfconfig->status != GCS_UNKNOWN) {
|
||||||
_cur_grfconfig->status = GCS_DISABLED;
|
_cur_grfconfig->status = GCS_DISABLED;
|
||||||
_cur_grfconfig->error = CallocT<GRFError>(1);
|
delete _cur_grfconfig->error;
|
||||||
_cur_grfconfig->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
_cur_grfconfig->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_MULTIPLE_ACTION_8);
|
||||||
_cur_grfconfig->error->message = STR_NEWGRF_ERROR_MULTIPLE_ACTION_8;
|
|
||||||
|
|
||||||
_skip_sprites = -1;
|
_skip_sprites = -1;
|
||||||
return;
|
return;
|
||||||
|
@ -4556,9 +4549,7 @@ static void GRFLoadError(ByteReader *buf)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRFError *error = CallocT<GRFError>(1);
|
GRFError *error = new GRFError(sevstr[severity]);
|
||||||
|
|
||||||
error->severity = sevstr[severity];
|
|
||||||
|
|
||||||
if (message_id == 0xFF) {
|
if (message_id == 0xFF) {
|
||||||
/* This is a custom error message. */
|
/* This is a custom error message. */
|
||||||
|
@ -5426,17 +5417,12 @@ static void TranslateGRFStrings(ByteReader *buf)
|
||||||
if (c->status == GCS_INITIALISED) {
|
if (c->status == GCS_INITIALISED) {
|
||||||
/* If the file is not active but will be activated later, give an error
|
/* If the file is not active but will be activated later, give an error
|
||||||
* and disable this file. */
|
* and disable this file. */
|
||||||
GRFError *error = CallocT<GRFError>(1);
|
delete _cur_grfconfig->error;
|
||||||
|
_cur_grfconfig->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_LOAD_AFTER);
|
||||||
|
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
GetString(tmp, STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE, lastof(tmp));
|
GetString(tmp, STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE, lastof(tmp));
|
||||||
error->data = strdup(tmp);
|
_cur_grfconfig->error->data = strdup(tmp);
|
||||||
|
|
||||||
error->message = STR_NEWGRF_ERROR_LOAD_AFTER;
|
|
||||||
error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
|
||||||
|
|
||||||
if (_cur_grfconfig->error != NULL) free(_cur_grfconfig->error);
|
|
||||||
_cur_grfconfig->error = error;
|
|
||||||
|
|
||||||
_cur_grfconfig->status = GCS_DISABLED;
|
_cur_grfconfig->status = GCS_DISABLED;
|
||||||
ClearTemporaryNewGRFData(_cur_grffile);
|
ClearTemporaryNewGRFData(_cur_grffile);
|
||||||
|
@ -5714,9 +5700,7 @@ static void ResetNewGRFErrors()
|
||||||
{
|
{
|
||||||
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
|
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
|
||||||
if (!HasBit(c->flags, GCF_COPY) && c->error != NULL) {
|
if (!HasBit(c->flags, GCF_COPY) && c->error != NULL) {
|
||||||
free(c->error->custom_message);
|
delete c->error;
|
||||||
free(c->error->data);
|
|
||||||
free(c->error);
|
|
||||||
c->error = NULL;
|
c->error = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6189,9 +6173,8 @@ static void DecodeSpecialSprite(byte *buf, uint num, GrfLoadingStage stage)
|
||||||
|
|
||||||
_skip_sprites = -1;
|
_skip_sprites = -1;
|
||||||
_cur_grfconfig->status = GCS_DISABLED;
|
_cur_grfconfig->status = GCS_DISABLED;
|
||||||
_cur_grfconfig->error = CallocT<GRFError>(1);
|
delete _cur_grfconfig->error;
|
||||||
_cur_grfconfig->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
_cur_grfconfig->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_READ_BOUNDS);
|
||||||
_cur_grfconfig->error->message = STR_NEWGRF_ERROR_READ_BOUNDS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6221,9 +6204,7 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage)
|
||||||
if (file_index > LAST_GRF_SLOT) {
|
if (file_index > LAST_GRF_SLOT) {
|
||||||
DEBUG(grf, 0, "'%s' is not loaded as the maximum number of GRFs has been reached", filename);
|
DEBUG(grf, 0, "'%s' is not loaded as the maximum number of GRFs has been reached", filename);
|
||||||
config->status = GCS_DISABLED;
|
config->status = GCS_DISABLED;
|
||||||
config->error = CallocT<GRFError>(1);
|
config->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED);
|
||||||
config->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
|
||||||
config->error->message = STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6269,9 +6250,8 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage)
|
||||||
if (_skip_sprites == 0) {
|
if (_skip_sprites == 0) {
|
||||||
grfmsg(0, "LoadNewGRFFile: Unexpected sprite, disabling");
|
grfmsg(0, "LoadNewGRFFile: Unexpected sprite, disabling");
|
||||||
config->status = GCS_DISABLED;
|
config->status = GCS_DISABLED;
|
||||||
config->error = CallocT<GRFError>(1);
|
delete config->error;
|
||||||
config->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
config->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_UNEXPECTED_SPRITE);
|
||||||
config->error->message = STR_NEWGRF_ERROR_UNEXPECTED_SPRITE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,17 @@ GRFConfig *_grfconfig;
|
||||||
GRFConfig *_grfconfig_newgame;
|
GRFConfig *_grfconfig_newgame;
|
||||||
GRFConfig *_grfconfig_static;
|
GRFConfig *_grfconfig_static;
|
||||||
|
|
||||||
|
GRFError::GRFError(StringID severity, StringID message) :
|
||||||
|
message(message),
|
||||||
|
severity(severity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GRFError::~GRFError()
|
||||||
|
{
|
||||||
|
free(this->custom_message);
|
||||||
|
free(this->data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the palettes of the graphics from the config file.
|
* Update the palettes of the graphics from the config file.
|
||||||
|
@ -101,12 +112,7 @@ void ClearGRFConfig(GRFConfig **config)
|
||||||
free((*config)->filename);
|
free((*config)->filename);
|
||||||
free((*config)->name);
|
free((*config)->name);
|
||||||
free((*config)->info);
|
free((*config)->info);
|
||||||
|
delete (*config)->error;
|
||||||
if ((*config)->error != NULL) {
|
|
||||||
free((*config)->error->custom_message);
|
|
||||||
free((*config)->error->data);
|
|
||||||
free((*config)->error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(*config);
|
free(*config);
|
||||||
*config = NULL;
|
*config = NULL;
|
||||||
|
@ -139,8 +145,9 @@ GRFConfig *DuplicateGRFConfig(const GRFConfig *c)
|
||||||
if (c->name != NULL) config->name = strdup(c->name);
|
if (c->name != NULL) config->name = strdup(c->name);
|
||||||
if (c->info != NULL) config->info = strdup(c->info);
|
if (c->info != NULL) config->info = strdup(c->info);
|
||||||
if (c->error != NULL) {
|
if (c->error != NULL) {
|
||||||
config->error = MallocT<GRFError>(1);
|
config->error = new GRFError(c->error->severity, c->error->message);
|
||||||
memcpy(config->error, c->error, sizeof(GRFError));
|
config->error->num_params = c->error->num_params;
|
||||||
|
memcpy(config->error->param_value, c->error->param_value, sizeof(config->error->param_value));
|
||||||
if (c->error->data != NULL) config->error->data = strdup(c->error->data);
|
if (c->error->data != NULL) config->error->data = strdup(c->error->data);
|
||||||
if (c->error->custom_message != NULL) config->error->custom_message = strdup(c->error->custom_message);
|
if (c->error->custom_message != NULL) config->error->custom_message = strdup(c->error->custom_message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define NEWGRF_CONFIG_H
|
#define NEWGRF_CONFIG_H
|
||||||
|
|
||||||
#include "strings_type.h"
|
#include "strings_type.h"
|
||||||
|
#include "core/alloc_type.hpp"
|
||||||
|
|
||||||
/** GRF config bit flags */
|
/** GRF config bit flags */
|
||||||
enum GCF_Flags {
|
enum GCF_Flags {
|
||||||
|
@ -55,7 +56,10 @@ struct GRFIdentifier {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Information about why GRF had problems during initialisation */
|
/** Information about why GRF had problems during initialisation */
|
||||||
struct GRFError {
|
struct GRFError : ZeroedMemoryAllocator {
|
||||||
|
GRFError(StringID severity, StringID message = 0);
|
||||||
|
~GRFError();
|
||||||
|
|
||||||
char *custom_message; ///< Custom message (if present)
|
char *custom_message; ///< Custom message (if present)
|
||||||
char *data; ///< Additional data for message and custom_message
|
char *data; ///< Additional data for message and custom_message
|
||||||
StringID message; ///< Default message
|
StringID message; ///< Default message
|
||||||
|
|
|
@ -14,10 +14,13 @@
|
||||||
#include "newgrf_commons.h"
|
#include "newgrf_commons.h"
|
||||||
#include "newgrf_railtype.h"
|
#include "newgrf_railtype.h"
|
||||||
#include "newgrf_spritegroup.h"
|
#include "newgrf_spritegroup.h"
|
||||||
|
#include "core/bitmath_func.hpp"
|
||||||
|
|
||||||
static uint32 RailTypeGetRandomBits(const ResolverObject *object)
|
static uint32 RailTypeGetRandomBits(const ResolverObject *object)
|
||||||
{
|
{
|
||||||
return 0;
|
TileIndex tile = object->u.routes.tile;
|
||||||
|
uint tmp = CountBits(tile + (TileX(tile) + TileY(tile)) * TILE_SIZE);
|
||||||
|
return GB(tmp, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32 RailTypeGetTriggers(const ResolverObject *object)
|
static uint32 RailTypeGetTriggers(const ResolverObject *object)
|
||||||
|
|
|
@ -446,7 +446,7 @@ int ttd_main(int argc, char *argv[])
|
||||||
* a letter means: it accepts that param (e.g.: -h)
|
* a letter means: it accepts that param (e.g.: -h)
|
||||||
* a ':' behind it means: it need a param (e.g.: -m<driver>)
|
* a ':' behind it means: it need a param (e.g.: -m<driver>)
|
||||||
* a '::' behind it means: it can optional have a param (e.g.: -d<debug>) */
|
* a '::' behind it means: it can optional have a param (e.g.: -d<debug>) */
|
||||||
optformat = "m:s:v:b:hD::n::ei::I:S:t:d::r:g::G:c:xl:p:P:"
|
optformat = "m:s:v:b:hD::n::ei::I:S:M:t:d::r:g::G:c:xl:p:P:"
|
||||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
|
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
|
||||||
"f"
|
"f"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -779,9 +779,9 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Remove a long piece of road.
|
/** Remove a long piece of road.
|
||||||
* @param end_tile end tile of drag
|
* @param start_tile start tile of drag
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
* @param p1 start tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1)
|
* - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1)
|
||||||
* - p2 = (bit 1) - end tile starts in the 2nd half of tile (p2 & 2)
|
* - p2 = (bit 1) - end tile starts in the 2nd half of tile (p2 & 2)
|
||||||
|
@ -790,13 +790,13 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveLongRoad(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
if (p1 >= MapSize()) return CMD_ERROR;
|
if (p1 >= MapSize()) return CMD_ERROR;
|
||||||
|
|
||||||
TileIndex start_tile = p1;
|
TileIndex end_tile = p1;
|
||||||
RoadType rt = (RoadType)GB(p2, 3, 2);
|
RoadType rt = (RoadType)GB(p2, 3, 2);
|
||||||
if (!IsValidRoadType(rt)) return CMD_ERROR;
|
if (!IsValidRoadType(rt)) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -829,7 +829,7 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, DoCommandFlag flags, uint32 p1
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
money -= ret.GetCost();
|
money -= ret.GetCost();
|
||||||
if (money < 0) {
|
if (money < 0) {
|
||||||
_additional_cash_required = DoCommand(end_tile, start_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost();
|
_additional_cash_required = DoCommand(start_tile, end_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost();
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
RemoveRoad(tile, flags, bits, rt, true, false);
|
RemoveRoad(tile, flags, bits, rt, true, false);
|
||||||
|
|
|
@ -225,6 +225,15 @@
|
||||||
|
|
||||||
#endif /* defined(_MSC_VER) */
|
#endif /* defined(_MSC_VER) */
|
||||||
|
|
||||||
|
#if defined(DOS)
|
||||||
|
/* The DOS port does not have all signals/signal functions. */
|
||||||
|
#define strsignal(sig) ""
|
||||||
|
/* Use 'no floating point' for bus errors; SIGBUS does not
|
||||||
|
* exist for does, SIGNOFP not for other platforms. So it's
|
||||||
|
* fairly safe the interchange those. */
|
||||||
|
#define SIGBUS SIGNOFP
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WINCE)
|
#if defined(WINCE)
|
||||||
#define strdup _strdup
|
#define strdup _strdup
|
||||||
#endif /* WINCE */
|
#endif /* WINCE */
|
||||||
|
|
|
@ -1757,7 +1757,7 @@ static bool HandleScrollbarScrolling()
|
||||||
|
|
||||||
/* Find the item we want to move to and make sure it's inside bounds. */
|
/* Find the item we want to move to and make sure it's inside bounds. */
|
||||||
int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity()));
|
int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity()));
|
||||||
if (rtl) pos = sb->GetCount() - sb->GetCapacity() - pos;
|
if (rtl) pos = max(0, sb->GetCount() - sb->GetCapacity() - pos);
|
||||||
if (pos != sb->GetPosition()) {
|
if (pos != sb->GetPosition()) {
|
||||||
sb->SetPosition(pos);
|
sb->SetPosition(pos);
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
|
|
Loading…
Reference in New Issue