Merge branch 'more_cond_orders-sx' into jgrpp
# Conflicts: # config.lib # projects/openttd_vs100.vcxproj # projects/openttd_vs100.vcxproj.filters # projects/openttd_vs80.vcproj # projects/openttd_vs90.vcproj # src/order_gui.cpp # src/order_type.h # src/saveload/afterload.cpp # src/saveload/extended_ver_sl.cpp
This commit is contained in:
@@ -4580,6 +4580,7 @@ STR_ORDER_CONDITIONAL_AGE :Age (years)
|
||||
STR_ORDER_CONDITIONAL_REQUIRES_SERVICE :Requires service
|
||||
STR_ORDER_CONDITIONAL_UNCONDITIONALLY :Always
|
||||
STR_ORDER_CONDITIONAL_REMAINING_LIFETIME :Remaining lifetime (years)
|
||||
STR_ORDER_CONDITIONAL_MAX_RELIABILITY :Maximum reliability
|
||||
STR_ORDER_CONDITIONAL_CARGO_WAITING :Waiting cargo
|
||||
STR_ORDER_CONDITIONAL_ACCEPTANCE_DROPDOWN :Accepted cargo
|
||||
STR_ORDER_CONDITIONAL_FREE_PLATFORMS :Free platforms
|
||||
|
@@ -2708,6 +2708,10 @@ STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL}
|
||||
STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} ms
|
||||
STR_FRAMERATE_GRAPH_SECONDS :{TINY_FONT}{COMMA} s
|
||||
############ Leave those lines in this order!!
|
||||
STR_FRAMERATE_GL_TRAINS :{BLACK} Ticks de trenes:
|
||||
STR_FRAMERATE_GL_ROADVEHS :{BLACK} Ticks de vehículos de carretera:
|
||||
STR_FRAMERATE_GL_SHIPS :{BLACK} Ticks de barcos:
|
||||
STR_FRAMERATE_GL_AIRCRAFT :{BLACK} Ticks de aeronaves:
|
||||
STR_FRAMERATE_DRAWING :{BLACK}Renderizado gráfico:
|
||||
############ End of leave-in-this-order
|
||||
############ Leave those lines in this order!!
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "framerate_type.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
#include "mixer.h"
|
||||
|
||||
struct MixerChannel {
|
||||
bool active;
|
||||
@@ -38,6 +39,7 @@ struct MixerChannel {
|
||||
static MixerChannel _channels[8];
|
||||
static uint32 _play_rate = 11025;
|
||||
static uint32 _max_size = UINT_MAX;
|
||||
static MxStreamCallback _music_stream = NULL;
|
||||
|
||||
/**
|
||||
* The theoretical maximum volume for a single sound sample. Multiple sound
|
||||
@@ -151,6 +153,9 @@ void MxMixSamples(void *buffer, uint samples)
|
||||
/* Clear the buffer */
|
||||
memset(buffer, 0, sizeof(int16) * 2 * samples);
|
||||
|
||||
/* Fetch music if a sampled stream is available */
|
||||
if (_music_stream) _music_stream((int16*)buffer, samples);
|
||||
|
||||
/* Mix each channel */
|
||||
for (mc = _channels; mc != endof(_channels); mc++) {
|
||||
if (mc->active) {
|
||||
@@ -215,6 +220,17 @@ void MxSetChannelVolume(MixerChannel *mc, uint volume, float pan)
|
||||
void MxActivateChannel(MixerChannel *mc)
|
||||
{
|
||||
mc->active = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set source of PCM music
|
||||
* @param music_callback Function that will be called to fill sample buffers with music data.
|
||||
* @return Sample rate of mixer, which the buffers supplied to the callback must be rendered at.
|
||||
*/
|
||||
uint32 MxSetMusicSource(MxStreamCallback music_callback)
|
||||
{
|
||||
_music_stream = music_callback;
|
||||
return _play_rate;
|
||||
}
|
||||
|
||||
|
||||
@@ -222,5 +238,6 @@ bool MxInitialize(uint rate)
|
||||
{
|
||||
_play_rate = rate;
|
||||
_max_size = UINT_MAX / _play_rate;
|
||||
_music_stream = NULL; /* rate may have changed, any music source is now invalid */
|
||||
return true;
|
||||
}
|
||||
|
10
src/mixer.h
10
src/mixer.h
@@ -14,6 +14,14 @@
|
||||
|
||||
struct MixerChannel;
|
||||
|
||||
/**
|
||||
* Type of callback functions for supplying PCM music.
|
||||
* A music decoder/renderer implements this function and installs it with MxSetMusicSource, which also returns the sample rate used.
|
||||
* @param buffer Pointer to interleaved 2-channel signed 16 bit PCM data buffer, guaranteed to be 0-initialized.
|
||||
* @param samples number of samples that must be filled into \c buffer.
|
||||
*/
|
||||
typedef void(*MxStreamCallback)(int16 *buffer, size_t samples);
|
||||
|
||||
bool MxInitialize(uint rate);
|
||||
void MxMixSamples(void *buffer, uint samples);
|
||||
|
||||
@@ -22,4 +30,6 @@ void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, boo
|
||||
void MxSetChannelVolume(MixerChannel *mc, uint volume, float pan);
|
||||
void MxActivateChannel(MixerChannel*);
|
||||
|
||||
uint32 MxSetMusicSource(MxStreamCallback music_callback);
|
||||
|
||||
#endif /* MIXER_H */
|
||||
|
@@ -16,11 +16,11 @@
|
||||
#include "fluidsynth.h"
|
||||
#include "midifile.hpp"
|
||||
#include <fluidsynth.h>
|
||||
#include "../mixer.h"
|
||||
|
||||
static struct {
|
||||
fluid_settings_t* settings; ///< FluidSynth settings handle
|
||||
fluid_synth_t* synth; ///< FluidSynth synthesizer handle
|
||||
fluid_audio_driver_t* adriver; ///< FluidSynth audio driver handle
|
||||
fluid_player_t* player; ///< FluidSynth MIDI player handle
|
||||
} _midi; ///< Metadata about the midi we're playing.
|
||||
|
||||
@@ -42,33 +42,27 @@ static const char *default_sf[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static void RenderMusicStream(int16 *buffer, size_t samples)
|
||||
{
|
||||
if (!_midi.synth || !_midi.player) return;
|
||||
fluid_synth_write_s16(_midi.synth, samples, buffer, 0, 2, buffer, 1, 2);
|
||||
}
|
||||
|
||||
const char *MusicDriver_FluidSynth::Start(const char * const *param)
|
||||
{
|
||||
const char *driver_name = GetDriverParam(param, "driver");
|
||||
const char *sfont_name = GetDriverParam(param, "soundfont");
|
||||
int sfont_id;
|
||||
|
||||
if (!driver_name) driver_name = "alsa";
|
||||
|
||||
DEBUG(driver, 1, "Fluidsynth: driver %s, sf %s", driver_name, sfont_name);
|
||||
DEBUG(driver, 1, "Fluidsynth: sf %s", sfont_name);
|
||||
|
||||
/* Create the settings. */
|
||||
_midi.settings = new_fluid_settings();
|
||||
if (!_midi.settings) return "Could not create midi settings";
|
||||
|
||||
if (fluid_settings_setstr(_midi.settings, "audio.driver", driver_name) != 1) {
|
||||
return "Could not set audio driver name";
|
||||
}
|
||||
|
||||
/* Create the synthesizer. */
|
||||
_midi.synth = new_fluid_synth(_midi.settings);
|
||||
if (!_midi.synth) return "Could not open synth";
|
||||
|
||||
/* Create the audio driver. The synthesizer starts playing as soon
|
||||
as the driver is created. */
|
||||
_midi.adriver = new_fluid_audio_driver(_midi.settings, _midi.synth);
|
||||
if (!_midi.adriver) return "Could not open audio driver";
|
||||
|
||||
/* Load a SoundFont and reset presets (so that new instruments
|
||||
* get used from the SoundFont) */
|
||||
if (!sfont_name) {
|
||||
@@ -87,13 +81,17 @@ const char *MusicDriver_FluidSynth::Start(const char * const *param)
|
||||
|
||||
_midi.player = NULL;
|
||||
|
||||
uint32 samplerate = MxSetMusicSource(RenderMusicStream);
|
||||
fluid_synth_set_sample_rate(_midi.synth, samplerate);
|
||||
DEBUG(driver, 1, "Fluidsynth: samplerate %.0f", (float)samplerate);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MusicDriver_FluidSynth::Stop()
|
||||
{
|
||||
MxSetMusicSource(NULL);
|
||||
this->StopSong();
|
||||
delete_fluid_audio_driver(_midi.adriver);
|
||||
delete_fluid_synth(_midi.synth);
|
||||
delete_fluid_settings(_midi.settings);
|
||||
}
|
||||
|
@@ -2411,6 +2411,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
|
||||
switch (order->GetConditionVariable()) {
|
||||
case OCV_LOAD_PERCENTAGE: skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, NULL), value); break;
|
||||
case OCV_RELIABILITY: skip_order = OrderConditionCompare(occ, ToPercent16(v->reliability), value); break;
|
||||
case OCV_MAX_RELIABILITY: skip_order = OrderConditionCompare(occ, ToPercent16(v->GetEngine()->reliability), value); break;
|
||||
case OCV_MAX_SPEED: skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed() * 10 / 16, value); break;
|
||||
case OCV_AGE: skip_order = OrderConditionCompare(occ, v->age / DAYS_IN_LEAP_YEAR, value); break;
|
||||
case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(), value); break;
|
||||
|
@@ -598,6 +598,7 @@ static const StringID _order_goto_dropdown_aircraft[] = {
|
||||
static const OrderConditionVariable _order_conditional_variable[] = {
|
||||
OCV_LOAD_PERCENTAGE,
|
||||
OCV_RELIABILITY,
|
||||
OCV_MAX_RELIABILITY,
|
||||
OCV_MAX_SPEED,
|
||||
OCV_AGE,
|
||||
OCV_REMAINING_LIFETIME,
|
||||
|
@@ -142,6 +142,7 @@ enum OrderConditionVariable {
|
||||
OCV_REQUIRES_SERVICE, ///< Skip when the vehicle requires service
|
||||
OCV_UNCONDITIONALLY, ///< Always skip
|
||||
OCV_REMAINING_LIFETIME, ///< Skip based on the remaining lifetime
|
||||
OCV_MAX_RELIABILITY, ///< Skip based on the maximum reliability
|
||||
OCV_CARGO_WAITING, ///< Skip if specified cargo is waiting at next station
|
||||
OCV_CARGO_ACCEPTANCE, ///< Skip if specified cargo is accepted at next station
|
||||
OCV_FREE_PLATFORMS, ///< Skip based on free platforms at next station
|
||||
|
@@ -303,7 +303,7 @@ void CreateConsole()
|
||||
if (_has_console) return;
|
||||
_has_console = true;
|
||||
|
||||
AllocConsole();
|
||||
if (!AllocConsole()) return;
|
||||
|
||||
hand = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
GetConsoleScreenBufferInfo(hand, &coninfo);
|
||||
|
@@ -432,8 +432,9 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
/* single tram bits cause reversing */
|
||||
if (IsTram() && GetSingleTramBit(m_old_tile) == ReverseDiagDir(m_exitdir)) {
|
||||
/* Single tram bits and standard road stops cause reversing. */
|
||||
if (IsRoadTT() && ((IsTram() && GetSingleTramBit(m_old_tile) == ReverseDiagDir(m_exitdir)) ||
|
||||
(IsStandardRoadStopTile(m_old_tile) && GetRoadStopDir(m_old_tile) == ReverseDiagDir(m_exitdir)))) {
|
||||
/* reverse */
|
||||
m_new_tile = m_old_tile;
|
||||
m_new_td_bits = TrackdirToTrackdirBits(ReverseTrackdir(m_old_td));
|
||||
|
@@ -970,12 +970,13 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
|
||||
* multiple targets that are spread around, we should perform a breadth first
|
||||
* search by specifiying CalcZero as our heuristic.
|
||||
*/
|
||||
static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start_tile1, AyStarNode *start2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, AyStarUserData *user, uint reverse_penalty, bool ignore_reserved = false)
|
||||
static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start_tile1, AyStarNode *start2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, AyStarUserData *user, uint reverse_penalty, bool ignore_reserved = false, int max_penalty = 0)
|
||||
{
|
||||
int r;
|
||||
NPFFoundTargetData result;
|
||||
|
||||
/* Initialize procs */
|
||||
_npf_aystar.max_path_cost = max_penalty;
|
||||
_npf_aystar.CalculateH = heuristic_proc;
|
||||
_npf_aystar.EndNodeCheck = target_proc;
|
||||
_npf_aystar.FoundEndNode = NPFSaveTargetData;
|
||||
@@ -1063,7 +1064,7 @@ static NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir track
|
||||
* reverse_penalty applied (NPF_TILE_LENGTH is the equivalent of one full
|
||||
* tile).
|
||||
*/
|
||||
static NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStarUserData *user, uint reverse_penalty)
|
||||
static NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStarUserData *user, uint reverse_penalty, int max_penalty)
|
||||
{
|
||||
AyStarNode start1;
|
||||
AyStarNode start2;
|
||||
@@ -1075,7 +1076,7 @@ static NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Tra
|
||||
|
||||
/* perform a breadth first search. Target is NULL,
|
||||
* since we are just looking for any depot...*/
|
||||
return NPFRouteInternal(&start1, ignore_start_tile1, (IsValidTile(tile2) ? &start2 : NULL), ignore_start_tile2, target, NPFFindDepot, NPFCalcZero, user, reverse_penalty);
|
||||
return NPFRouteInternal(&start1, ignore_start_tile1, (IsValidTile(tile2) ? &start2 : NULL), ignore_start_tile2, target, NPFFindDepot, NPFCalcZero, user, reverse_penalty, false, max_penalty);
|
||||
}
|
||||
|
||||
void InitializeNPF()
|
||||
@@ -1121,7 +1122,7 @@ FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penal
|
||||
Trackdir trackdir = v->GetVehicleTrackdir();
|
||||
|
||||
AyStarUserData user = { v->owner, TRANSPORT_ROAD, INVALID_RAILTYPES, v->compatible_roadtypes };
|
||||
NPFFoundTargetData ftd = NPFRouteToDepotBreadthFirstTwoWay(v->tile, trackdir, false, v->tile, ReverseTrackdir(trackdir), false, NULL, &user, 0);
|
||||
NPFFoundTargetData ftd = NPFRouteToDepotBreadthFirstTwoWay(v->tile, trackdir, false, INVALID_TILE, INVALID_TRACKDIR, false, NULL, &user, 0, max_penalty);
|
||||
|
||||
if (ftd.best_bird_dist != 0) return FindDepotData();
|
||||
|
||||
@@ -1176,7 +1177,7 @@ Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir,
|
||||
* we did not find our target, but ftd.best_trackdir contains the direction leading
|
||||
* to the tile closest to our target. */
|
||||
path_found = (ftd.best_bird_dist == 0);
|
||||
if (ftd.best_trackdir == 0xff) return INVALID_TRACK;
|
||||
if (ftd.best_trackdir == INVALID_TRACKDIR) return INVALID_TRACK;
|
||||
return TrackdirToTrack(ftd.best_trackdir);
|
||||
}
|
||||
|
||||
@@ -1211,7 +1212,7 @@ FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_penalty)
|
||||
|
||||
assert(trackdir != INVALID_TRACKDIR);
|
||||
AyStarUserData user = { v->owner, TRANSPORT_RAIL, v->compatible_railtypes, ROADTYPES_NONE };
|
||||
NPFFoundTargetData ftd = NPFRouteToDepotBreadthFirstTwoWay(v->tile, trackdir, false, last->tile, trackdir_rev, false, &fstd, &user, NPF_INFINITE_PENALTY);
|
||||
NPFFoundTargetData ftd = NPFRouteToDepotBreadthFirstTwoWay(v->tile, trackdir, false, last->tile, trackdir_rev, false, &fstd, &user, NPF_INFINITE_PENALTY, max_penalty);
|
||||
if (ftd.best_bird_dist != 0) return FindDepotData();
|
||||
|
||||
/* Found target */
|
||||
|
@@ -20,8 +20,8 @@ static const int NPF_TILE_LENGTH = 100;
|
||||
/**
|
||||
* This penalty is the equivalent of "infinite", which means that paths that
|
||||
* get this penalty will be chosen, but only if there is no other route
|
||||
* without it. Be careful with not applying this penalty to often, or the
|
||||
* total path cost might overflow..
|
||||
* without it. Be careful with not applying this penalty too often, or the
|
||||
* total path cost might overflow.
|
||||
*/
|
||||
static const int NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH;
|
||||
|
||||
@@ -35,8 +35,8 @@ static const int YAPF_TILE_CORNER_LENGTH = 71;
|
||||
/**
|
||||
* This penalty is the equivalent of "infinite", which means that paths that
|
||||
* get this penalty will be chosen, but only if there is no other route
|
||||
* without it. Be careful with not applying this penalty to often, or the
|
||||
* total path cost might overflow..
|
||||
* without it. Be careful with not applying this penalty too often, or the
|
||||
* total path cost might overflow.
|
||||
*/
|
||||
static const int YAPF_INFINITE_PENALTY = 1000 * YAPF_TILE_LENGTH;
|
||||
|
||||
|
@@ -35,6 +35,10 @@ public:
|
||||
typedef typename Node::Key Key; ///< key to hash tables
|
||||
|
||||
protected:
|
||||
int m_max_cost;
|
||||
|
||||
CYapfCostRoadT() : m_max_cost(0) {};
|
||||
|
||||
/** to access inherited path finder */
|
||||
Tpf& Yapf()
|
||||
{
|
||||
@@ -105,6 +109,11 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
inline void SetMaxCost(int max_cost)
|
||||
{
|
||||
m_max_cost = max_cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by YAPF to calculate the cost from the origin to the given node.
|
||||
* Calculates only the cost of given node, adds it to the parent node cost
|
||||
@@ -120,6 +129,8 @@ public:
|
||||
/* start at n.m_key.m_tile / n.m_key.m_td and walk to the end of segment */
|
||||
TileIndex tile = n.m_key.m_tile;
|
||||
Trackdir trackdir = n.m_key.m_td;
|
||||
int parent_cost = (n.m_parent != NULL) ? n.m_parent->m_cost : 0;
|
||||
|
||||
for (;;) {
|
||||
/* base tile cost depending on distance between edges */
|
||||
segment_cost += Yapf().OneTileCost(tile, trackdir);
|
||||
@@ -128,6 +139,12 @@ public:
|
||||
/* we have reached the vehicle's destination - segment should end here to avoid target skipping */
|
||||
if (Yapf().PfDetectDestinationTile(tile, trackdir)) break;
|
||||
|
||||
/* Finish if we already exceeded the maximum path cost (i.e. when
|
||||
* searching for the nearest depot). */
|
||||
if (m_max_cost > 0 && (parent_cost + segment_cost) > m_max_cost) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* stop if we have just entered the depot */
|
||||
if (IsRoadDepotTile(tile) && trackdir == DiagDirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
|
||||
/* next time we will reverse and leave the depot */
|
||||
@@ -172,7 +189,6 @@ public:
|
||||
n.m_segment_last_td = trackdir;
|
||||
|
||||
/* save also tile cost */
|
||||
int parent_cost = (n.m_parent != NULL) ? n.m_parent->m_cost : 0;
|
||||
n.m_cost = parent_cost + segment_cost;
|
||||
return true;
|
||||
}
|
||||
@@ -453,15 +469,12 @@ public:
|
||||
* @param tile Tile of the vehicle.
|
||||
* @param td Trackdir of the vehicle.
|
||||
* @param max_distance max length (penalty) for paths.
|
||||
* @todo max_distance not used by YAPF for road vehicles.
|
||||
* It can be removed or copy the SetMaxCost() strategy
|
||||
* applied in YAPF for rail. The best depot can be at
|
||||
* a distance greater than max_distance.
|
||||
*/
|
||||
inline FindDepotData FindNearestDepot(const RoadVehicle *v, TileIndex tile, Trackdir td, int max_distance)
|
||||
{
|
||||
/* Set origin. */
|
||||
Yapf().SetOrigin(tile, TrackdirToTrackdirBits(td));
|
||||
Yapf().SetMaxCost(max_distance);
|
||||
|
||||
/* Find the best path and return if no depot is found. */
|
||||
if (!Yapf().FindPath(v)) return FindDepotData();
|
||||
|
@@ -3570,6 +3570,16 @@ bool AfterLoadGame()
|
||||
FOR_ALL_COMPANIES(c) c->purchase_land_limit = _settings_game.construction.purchase_land_frame_burst << 16;
|
||||
}
|
||||
|
||||
if (SlXvIsFeaturePresent(XSLFI_MORE_COND_ORDERS, 1, 1)) {
|
||||
Order *order;
|
||||
FOR_ALL_ORDERS(order) {
|
||||
// Insertion of OCV_MAX_RELIABILITY between OCV_REMAINING_LIFETIME and OCV_CARGO_WAITING
|
||||
if (order->IsType(OT_CONDITIONAL) && order->GetConditionVariable() > OCV_REMAINING_LIFETIME) {
|
||||
order->SetConditionVariable(static_cast<OrderConditionVariable>((uint)order->GetConditionVariable() + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Road stops is 'only' updating some caches */
|
||||
AfterLoadRoadStops();
|
||||
AfterLoadLabelMaps();
|
||||
|
@@ -49,7 +49,7 @@ static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version
|
||||
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_TRACE_RESTRICT, XSCF_NULL, 10, 10, "tracerestrict", NULL, NULL, "TRRM,TRRP,TRRS" },
|
||||
{ XSLFI_TRACE_RESTRICT_OWNER, XSCF_NULL, 1, 1, "tracerestrict_owner", NULL, NULL, NULL },
|
||||
{ XSLFI_TRACE_RESTRICT_ORDRCND, XSCF_NULL, 2, 2, "tracerestrict_order_cond", NULL, NULL, NULL },
|
||||
{ XSLFI_TRACE_RESTRICT_ORDRCND, XSCF_NULL, 3, 3, "tracerestrict_order_cond", NULL, NULL, NULL },
|
||||
{ XSLFI_TRACE_RESTRICT_STATUSCND,XSCF_NULL, 1, 1, "tracerestrict_status_cond", NULL, NULL, NULL },
|
||||
{ XSLFI_TRACE_RESTRICT_REVERSE, XSCF_NULL, 1, 1, "tracerestrict_reverse", NULL, NULL, NULL },
|
||||
{ XSLFI_PROG_SIGS, XSCF_NULL, 1, 1, "programmable_signals", NULL, NULL, "SPRG" },
|
||||
@@ -67,7 +67,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_INFRA_SHARING, XSCF_NULL, 2, 2, "infra_sharing", NULL, NULL, "CPDP" },
|
||||
{ XSLFI_VARIABLE_DAY_LENGTH, XSCF_NULL, 2, 2, "variable_day_length", NULL, NULL, NULL },
|
||||
{ XSLFI_ORDER_OCCUPANCY, XSCF_NULL, 2, 2, "order_occupancy", NULL, NULL, NULL },
|
||||
{ XSLFI_MORE_COND_ORDERS, XSCF_NULL, 1, 1, "more_cond_orders", NULL, NULL, NULL },
|
||||
{ XSLFI_MORE_COND_ORDERS, XSCF_NULL, 2, 2, "more_cond_orders", NULL, NULL, NULL },
|
||||
{ XSLFI_EXTRA_LARGE_MAP, XSCF_NULL, 0, 1, "extra_large_map", NULL, NULL, NULL },
|
||||
{ XSLFI_REVERSE_AT_WAYPOINT, XSCF_NULL, 1, 1, "reverse_at_waypoint", NULL, NULL, NULL },
|
||||
{ XSLFI_VEH_LIFETIME_PROFIT, XSCF_NULL, 1, 1, "veh_lifetime_profit", NULL, NULL, NULL },
|
||||
|
@@ -44,6 +44,7 @@ void SQAIOrder_Register(Squirrel *engine)
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_INVALID, "OF_INVALID");
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE");
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY, "OC_RELIABILITY");
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_MAX_RELIABILITY, "OC_MAX_RELIABILITY");
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED, "OC_MAX_SPEED");
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_AGE, "OC_AGE");
|
||||
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_REQUIRES_SERVICE, "OC_REQUIRES_SERVICE");
|
||||
|
@@ -44,6 +44,7 @@ void SQGSOrder_Register(Squirrel *engine)
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_INVALID, "OF_INVALID");
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE");
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY, "OC_RELIABILITY");
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_MAX_RELIABILITY, "OC_MAX_RELIABILITY");
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED, "OC_MAX_SPEED");
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_AGE, "OC_AGE");
|
||||
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_REQUIRES_SERVICE, "OC_REQUIRES_SERVICE");
|
||||
|
@@ -215,6 +215,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
|
||||
switch (condition) {
|
||||
case OC_LOAD_PERCENTAGE:
|
||||
case OC_RELIABILITY:
|
||||
case OC_MAX_RELIABILITY:
|
||||
case OC_MAX_SPEED:
|
||||
case OC_AGE:
|
||||
case OC_REMAINING_LIFETIME:
|
||||
|
@@ -91,6 +91,7 @@ public:
|
||||
/* Note: these values represent part of the in-game OrderConditionVariable enum */
|
||||
OC_LOAD_PERCENTAGE = ::OCV_LOAD_PERCENTAGE, ///< Skip based on the amount of load, value is in tons.
|
||||
OC_RELIABILITY = ::OCV_RELIABILITY, ///< Skip based on the reliability, value is percent (0..100).
|
||||
OC_MAX_RELIABILITY = ::OCV_MAX_RELIABILITY, ///< Skip based on the maximum reliability. Value in percent
|
||||
OC_MAX_SPEED = ::OCV_MAX_SPEED, ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see ScriptEngine::GetMaxSpeed.
|
||||
OC_AGE = ::OCV_AGE, ///< Skip based on the age, value is in years.
|
||||
OC_REQUIRES_SERVICE = ::OCV_REQUIRES_SERVICE, ///< Skip when the vehicle requires service, no value.
|
||||
|
@@ -449,7 +449,8 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
|
||||
}
|
||||
unsigned short bom = 0;
|
||||
if (size >= 2) {
|
||||
fread(&bom, 1, sizeof(bom), file); // Inside tar, no point checking return value of fread
|
||||
size_t sr = fread(&bom, 1, sizeof(bom), file);
|
||||
(void)sr; // Inside tar, no point checking return value of fread
|
||||
}
|
||||
|
||||
SQLEXREADFUNC func;
|
||||
@@ -487,8 +488,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
|
||||
return sq_throwerror(vm, "I/O error");
|
||||
}
|
||||
unsigned char uc;
|
||||
fread(&uc, 1, sizeof(uc), file);
|
||||
if (uc != 0xBF) {
|
||||
if (fread(&uc, 1, sizeof(uc), file) != sizeof(uc) || uc != 0xBF) {
|
||||
FioFCloseFile(file);
|
||||
return sq_throwerror(vm, "Unrecognized encoding");
|
||||
}
|
||||
|
@@ -909,10 +909,11 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
|
||||
*/
|
||||
assert(coa >= _cleared_object_areas.Begin() && coa < _cleared_object_areas.End());
|
||||
size_t coa_index = coa - _cleared_object_areas.Begin();
|
||||
assert(coa_index < UINT_MAX); // more than 2**32 cleared areas would be a bug in itself
|
||||
coa = NULL;
|
||||
|
||||
ret = DoCommand(end_tile, end_tileh & start_tileh, 0, flags, CMD_TERRAFORM_LAND);
|
||||
_cleared_object_areas[coa_index].first_tile = old_first_tile;
|
||||
_cleared_object_areas[(uint)coa_index].first_tile = old_first_tile;
|
||||
if (ret.Failed()) return_cmd_error(STR_ERROR_UNABLE_TO_EXCAVATE_LAND);
|
||||
cost.AddCost(ret);
|
||||
}
|
||||
|
@@ -1747,7 +1747,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int
|
||||
int16 default_width = max(desc->GetDefaultWidth(), sm_width);
|
||||
int16 default_height = max(desc->GetDefaultHeight(), sm_height);
|
||||
|
||||
if (desc->parent_cls != 0 /* WC_MAIN_WINDOW */ && (w = FindWindowById(desc->parent_cls, window_number)) != NULL) {
|
||||
if (desc->parent_cls != WC_NONE && (w = FindWindowById(desc->parent_cls, window_number)) != NULL) {
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
if (desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) {
|
||||
pt.x = w->left + (rtl ? w->width - default_width : 0);
|
||||
|
Reference in New Issue
Block a user