Merge remote-tracking branch 'origin/master' into jgrpp

# Conflicts:
#	src/string.cpp
pull/73/head
Jonathan G Rennison 6 years ago
commit 2003a86932

@ -3210,10 +3210,22 @@ detect_fontconfig() {
}
detect_icu_layout() {
if [ "$with_cocoa" != "0" ] && [ "$with_icu_layout" = "1" ]; then
log 1 "checking icu-lx... OSX, skipping"
icu_layout_config=""
return 0
fi
detect_pkg_config "$with_icu_layout" "icu-lx" "icu_layout_config" "4.8" "1"
}
detect_icu_sort() {
if [ "$with_cocoa" != "0" ] && [ "$with_icu_sort" = "1" ]; then
log 1 "checking icu-i18n... OSX, skipping"
icu_sort_config=""
return 0
fi
detect_pkg_config "$with_icu_sort" "icu-i18n" "icu_sort_config" "4.8" "1"
}

@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2016-07-01
Release version: 1.6.1
Last updated: 2018-11-05
Release version: 1.9.0
------------------------------------------------------------------------
@ -14,12 +14,12 @@ Table of contents
---- -----
All bugs listed below are marked as known. Please do not submit any bugs
that are the same as these. If you do, do not act surprised, because
we WILL flame you!!
we WILL flame you!
The current list of known bugs that we intend to fix can be found in our
bug tracking system at: https://github.com/OpenTTD/OpenTTD/issues
Also check the closed bugs when searching for your bug in this system as
we might have fixed the bug in the mean time.
bug tracking system at https://github.com/OpenTTD/OpenTTD/issues
Also check the closed bugs when searching for your bug in this system as we
might have fixed the bug in the mean time.
2.0) Known bugs
@ -29,436 +29,383 @@ reasons why we think that fixing them is infeasible. We might make some
minor improvements that reduce the scope of these bugs, but we will not
be able to completely fix them.
No suitable AI can be found
If you have no AIs and an AI is started the so-called 'dummy' AI will
be loaded. This AI does nothing but writing a message on the AI debug
window and showing a red warning. There are basically two solutions
for this problem: Either you set the number of AI players to 0 so that
no AI is started. You find that setting at the top of the window in the
"AI / Game Scripts Settings" window.
The other solution is acquiring (downloading) some AI. The easiest way
to do this is via the "Check Online Content" button in the main (intro)
menu or directly in the "AI / Game Scripts Settings" dialogue via the
"Check Online Content" button.
After a while of playing, colours get corrupted
In Windows 7 the background slideshow corrupts the colour mapping of
OpenTTD's 8bpp screen modes. Workarounds for this are:
a) Switching to windowed mode, instead of fullscreen
b) Switching off background slideshow
c) Setting up the 32bpp-anim or 32bpp-optimized blitter
Long delay between switching songs/music
On Windows there is a delay of a (few) second(s) between switching of
songs for the "win32" driver. This delay is caused by the fact that
opening a MIDI file via MCI is extremely slow.
DirectMusic, known as "dmusic" in OpenTTD, has a much shorter delay.
However, under some circumstances DirectMusic does not reset its
state properly causing wrongly pitched/bad sounding songs. This
problem is in DirectMusic as it is reproducable with Microsoft's
DirectMusic Producer. DirectMusic has been deprecated since 2004
and as such has no support for 64 bits OpenTTD.
As a delay is favourable over bad sounding music the "win32" driver
is the default driver for OpenTTD. You can change this default by
setting the "musicdriver" in your openttd.cfg to "dmusic".
Custom vehicle type name is incorrectly aligned
Some NewGRFs use sprites that are bigger than normal in the "buy
vehicle" window. Due to this they have to encode an offset for the
vehicle type name. Upon renaming the vehicle type this encoded offset
is stripped from the name because the "edit box" cannot show this
encoding. As a result the custom vehicle type names will get the
default alignment. The only way to (partly) fix this is by adding
spaces to the custom name.
Clipping problems [FS#119]
In some cases sprites are not drawn as one would expect. Examples of
this are aircraft that might be hidden below the runway or trees that
in some cases are rendered over vehicles.
The primary cause of this problem is that OpenTTD does not have enough
data (like a 3D model) to properly determine what needs to be drawn in
front of what. OpenTTD has bounding boxes but in lots of cases they
are either too big or too small and then cause problems with what
needs to be drawn in front of what. Also some visual tricks are used.
For example trains at 8 pixels high, the catenary needs to be drawn
above that. When you want to draw bridges on top of that, which are
only one height level (= 8 pixels) higher, you are getting into some
big problems.
We can not change the height levels; it would require us to either
redraw all vehicle or all landscape graphics. Doing so would mean we
leave the Transport Tycoon graphics, which in effect means OpenTTD
will not be a Transport Tycoon clone anymore.
Mouse scrolling not possible at the edges of the screen [FS#383] [FS#3966]
Scrolling the viewport with the mouse cursor at the edges of the screen
in the same direction of the edge will fail. If the cursor is near the
edge the scrolling will be very slow.
OpenTTD only receives cursor position updates when the cursor is inside
OpenTTD's window. It is not told how far you have moved the cursor
outside of OpenTTD's window.
Lost trains ignore (block) exit signals [FS#1473]
If trains are lost they ignore block exit signals, blocking junctions
with presignals. This is caused because the path finders cannot tell
where the train needs to go. As such a random direction is chosen at
each junction. This causes the trains to occasionally to make choices
that are unwanted from a player's point of view.
This will not be fixed because lost trains are in almost all cases a
network problem, e.g. a train can never reach a specific place. This
makes the impact of fixing the bug enormously small against the
amount of work needed to write a system that prevents the lost trains
from taking the wrong direction.
Vehicle owner of last transfer leg gets paid for all [FS#2427]
When you make a transfer system that switches vehicle owners. This
is only possible with 'industry stations', e.g. the oil rig station
the owner of the vehicle that does the final delivery gets paid for
the whole trip. It is not shared amongst the different vehicle
owners that have participated in transporting the cargo.
This sharing is not done because it would enormously increase the
memory and CPU usage in big games for something that is happening
in only one corner case. We think it is not worth the effort until
sharing of stations is an official feature.
Forbid 90 degree turns does not work for crossing PBS paths [FS#2737]
When you run a train through itself on a X junction with PBS turned on
the train will not obey the 'forbid 90 degree turns' setting. This is
due to the fact that we can not be sure that the setting was turned
off when the track was reserved, which means that we assume it was
turned on and that the setting does not hold at the time. We made it
this way to allow one to change the setting in-game, but it breaks
slightly when you are running your train through itself. Running a
train through means that your network is broken and is thus a user
error which OpenTTD tries to graciously handle.
Fixing this bug means that we need to record whether this particular
setting was turned on or off at the time the reservation was made. This
means adding quite a bit of data to the savegame for solving an issue
that is basically an user error. We think it is not worth the effort.
Duplicate (station) names after renaming [FS#3204]
After renaming stations one can create duplicate station names. This
is done giving a station the same custom name as another station with
an automatically generated name.
The major part of this problem is that station names are translatable.
Meaning that a station is called e.g. '<TOWN> Central' in English and
'<TOWN> Centraal' in Dutch. This means that in network games the
renaming of a town could cause the rename to succeed on some clients
and fail at others. This creates an inconsistent game state that will
be seen as a 'desync'. Secondly the custom names are intended to fall
completely outside of the '<TOWN> <name>' naming of stations, so when
you rename a town all station names are updated accordingly.
As a result the decision has been made that all custom names are only
compared to the other custom names in the same class and not compared
to the automatically generated names.
Extreme CPU usage/hangs when using SDL and PulseAudio [FS#3294]
OpenTTD hangs/freezes when closing, OpenTTD is slow, OpenTTD uses a lot of CPU
OpenTTD can be extremely slow/use a lot of CPU when the sound is
played via SDL and then through PulseAudio's ALSA wrapper. Under the
same configuration OpenTTD, or rather SDL, might hang when exiting
the game. This problem is seen most in Ubuntu 9.04 and higher.
This is because recent versions of the PulseAudio sound server are
configured to use timer-based audio scheduling rather than
interrupt-based audio scheduling. Configuring PulseAudio to force
use of interrupt-based scheduling may resolve sound problems for
some users. Under recent versions of Ubuntu Linux (9.04 and higher)
this can be accomplished by changing the following line in the
/etc/pulse/default.pa file:
load-module module-udev-detect
to
load-module module-udev-detect tsched=0
Note that PulseAudio must be restarted for changes to take effect.
Older versions of PulseAudio may use the module-hal-detect module
instead. Adding tsched=0 to the end of that line will have a similar
effect.
Another possible solution is selecting the "pulse" backend of SDL
by either using "SDL_AUDIODRIVER=pulse openttd" at the command
prompt or installing the 'libsdl1.2debian-pulseaudio' package from
Ubuntu's Universe repository. For other distributions a similar
package needs to be installed.
OpenTTD not properly resizing with SDL on X [FS#3305]
Under some X window managers OpenTTD's window does not properly
resize. You will either end up with a black bar at the right/bottom
side of the window or you cannot see the right/bottom of the window,
e.g you cannot see the status bar. The problem is that OpenTTD does
not always receive a resize event from SDL making it impossible for
OpenTTD to know that the window was resized; sometimes moving the
window will solve the problem.
Window managers that are known to exhibit this behaviour are KDE's
and GNOME's. With the XFCE's and LXDE's window managers the resize
event is sent when the user releases the mouse.
No suitable AI can be found:
If you have no AIs and an AI is started the so-called 'dummy' AI will
be loaded. This AI does nothing but writing a message on the AI debug
window and showing a red warning. There are basically two solutions
for this problem: Either you set the number of AI players to 0 so that
no AI is started. You find that setting at the top of the window in the
"AI / Game Scripts Settings" window.
The other solution is acquiring (downloading) some AI. The easiest way
to do this is via the "Check Online Content" button in the main (intro)
menu or directly in the "AI / Game Scripts Settings" dialogue via the
"Check Online Content" button.
After a while of playing, colours get corrupted:
In Windows 7 the background slideshow corrupts the colour mapping
of OpenTTD's 8bpp screen modes. Workarounds for this are:
a) Switching to windowed mode, instead of fullscreen
b) Switching off background slideshow
c) Setting up the 32bpp-anim or 32bpp-optimized blitter
Custom vehicle type name is incorrectly aligned:
Some NewGRFs use sprites that are bigger than normal in the "buy
vehicle" window. Due to this they have to encode an offset for
the vehicle type name. Upon renaming the vehicle type this encoded
offset is stripped from the name because the "edit box" cannot show
this encoding. As a result the custom vehicle type names will get
the default alignment. The only way to (partially) fix this is by
adding spaces to the custom name.
Clipping problems [#119]:
In some cases sprites are not drawn as one would expect. Examples of
this are aircraft that might be hidden below the runway or trees that
in some cases are rendered over vehicles.
The primary cause of this problem is that OpenTTD does not have enough
data (like a 3D model) to properly determine what needs to be drawn in
front of what. OpenTTD has bounding boxes but in lots of cases they
are either too big or too small and then cause problems with what
needs to be drawn in front of what. Also some visual tricks are used.
For example trains at 8 pixels high, the catenary needs to be drawn
above that. When you want to draw bridges on top of that, which are
only one height level (= 8 pixels) higher, you are getting into some
big problems.
We can not change the height levels; it would require us to either
redraw all vehicle or all landscape graphics. Doing so would mean we
leave the Transport Tycoon graphics, which in effect means OpenTTD
will not be a Transport Tycoon clone anymore.
Mouse scrolling not possible at the edges of the screen [#383] [#3966]:
Scrolling the viewport with the mouse cursor at the edges of the screen
in the same direction of the edge will fail. If the cursor is near the
edge the scrolling will be very slow.
OpenTTD only receives cursor position updates when the cursor is inside
OpenTTD's window. It is not told how far you have moved the cursor
outside of OpenTTD's window.
Lost trains ignore (block) exit signals [#1473]:
If trains are lost they ignore block exit signals, blocking junctions
with presignals. This is caused because the path finders cannot tell
where the train needs to go. As such a random direction is chosen at
each junction. This causes the trains to occasionally to make choices
that are unwanted from a player's point of view.
This will not be fixed because lost trains are in almost all cases a
network problem, e.g. a train can never reach a specific place. This
makes the impact of fixing the bug enormously small against the amount
of work needed to write a system that prevents the lost trains from
taking the wrong direction.
Vehicle owner of last transfer leg gets paid for all [#2427]:
When you make a transfer system that switches vehicle owners. This
is only possible with 'industry stations', e.g. the oil rig station
the owner of the vehicle that does the final delivery gets paid for
the whole trip. It is not shared amongst the different vehicle
owners that have participated in transporting the cargo.
This sharing is not done because it would enormously increase the
memory and CPU usage in big games for something that is happening
in only one corner case. We think it is not worth the effort until
sharing of stations is an official feature.
Forbid 90 degree turns does not work for crossing PBS paths [#2737]:
When you run a train through itself on a X junction with PBS turned on
the train will not obey the 'forbid 90 degree turns' setting. This is
due to the fact that we can not be sure that the setting was turned
off when the track was reserved, which means that we assume it was
turned on and that the setting does not hold at the time. We made it
this way to allow one to change the setting in-game, but it breaks
slightly when you are running your train through itself. Running a
train through means that your network is broken and is thus a user
error which OpenTTD tries to graciously handle.
Fixing this bug means that we need to record whether this particular
setting was turned on or off at the time the reservation was made. This
means adding quite a bit of data to the savegame for solving an issue
that is basically an user error. We think it is not worth the effort.
Duplicate (station) names after renaming [#3204]:
After renaming stations one can create duplicate station names. This
is done giving a station the same custom name as another station with
an automatically generated name.
The major part of this problem is that station names are translatable.
Meaning that a station is called e.g. '<TOWN> Central' in English and
'<TOWN> Centraal' in Dutch. This means that in network games the
renaming of a town could cause the rename to succeed on some clients
and fail at others. This creates an inconsistent game state that will
be seen as a 'desync'. Secondly the custom names are intended to fall
completely outside of the '<TOWN> <name>' naming of stations, so when
you rename a town all station names are updated accordingly.
As a result the decision has been made that all custom names are only
compared to the other custom names in the same class and not compared
to the automatically generated names.
Extreme CPU usage/hangs when using SDL and PulseAudio [#3294],
OpenTTD hangs/freezes when closing, OpenTTD is slow, OpenTTD uses a lot of CPU:
OpenTTD can be extremely slow/use a lot of CPU when the sound is
played via SDL and then through PulseAudio's ALSA wrapper. Under the
same configuration OpenTTD, or rather SDL, might hang when exiting
the game. This problem is seen most in Ubuntu 9.04 and higher.
This is because recent versions of the PulseAudio sound server
are configured to use timer-based audio scheduling rather than
interrupt-based audio scheduling. Configuring PulseAudio to force
use of interrupt-based scheduling may resolve sound problems for
some users. Under recent versions of Ubuntu Linux (9.04 and higher)
this can be accomplished by changing the following line in the
/etc/pulse/default.pa file:
load-module module-udev-detect
to
load-module module-udev-detect tsched=0
Note that PulseAudio must be restarted for changes to take effect. Older
versions of PulseAudio may use the module-hal-detect module instead.
Adding tsched=0 to the end of that line will have a similar effect.
Another possible solution is selecting the "pulse" backend of SDL
by either using "SDL_AUDIODRIVER=pulse openttd" at the command
prompt or installing the 'libsdl1.2debian-pulseaudio' package from
Ubuntu's Universe repository. For other distributions a similar
package needs to be installed.
OpenTTD not properly resizing with SDL on X [#3305]:
Under some X window managers OpenTTD's window does not properly
resize. You will either end up with a black bar at the right/bottom
side of the window or you cannot see the right/bottom of the window,
e.g. you cannot see the status bar. The problem is that OpenTTD does
not always receive a resize event from SDL making it impossible for
OpenTTD to know that the window was resized; sometimes moving the
window will solve the problem.
Window managers that are known to exhibit this behaviour are GNOME's
and KDE's. With the XFCE's and LXDE's window managers the resize
event is sent when the user releases the mouse.
Incorrect colours, crashes upon exit, debug warnings and smears upon
window resizing with SDL on Mac OS X [FS#3447]
Video handling with (lib)SDL under Mac OS X is known to fail on some
versions of Mac OS X with some hardware configurations. Some of the
problems happen only under some circumstances whereas others are
always present.
We suggest that the SDL video/sound backend is not used for OpenTTD
in combinations with Mac OS X.
Train crashes entering same junction from block and path signals [FS#3928]
When a train has reserved a path from a path signal to a two way
block signal and the reservation passes a path signal through the
back another train can enter the reserved path (only) via that same
two way block signal.
The reason for this has to do with optimisation; to fix this issue
the signal update has to pass all path signals until it finds either
a train or a backwards facing signal. This is a very expensive task.
The (signal) setups that allow these crashes can furthermore be
considered incorrectly signalled; one extra safe waiting point for
the train entering from path signal just after the backwards facing
signal (from the path signal train) resolves the issue.
Crashes when playing music [FS#3941]
Mac OS X's QuickTime (default music driver) and Windows' MCI (win32
music driver) crash on some songs from OpenMSX. OpenTTD cannot do
anything about this. Please report these crashes to the authors of
OpenMSX so the crash causing songs can be removed or fixed.
Crashes when run in a VM using Parallels Desktop [FS#4003]
When the Windows version of OpenTTD is executed in a VM under
Parallels Desktop a privileged instruction exception may be thrown.
As OpenTTD works natively on OSX as well as natively on Windows and
these native builds both don't exhibit this behaviour this crash is
most likely due to a bug in the virtual machine, something out of
the scope of OpenTTD. Most likely this is due to Parallels Desktop
lacking support for RDTSC calls. The problem can be avoided by using
other VM-software, Wine, or running natively on OSX.
OpenTTD hangs when started on 32 bits Windows [FS#4083]
Under some circumstances OpenTTD might hang for hours on the
initialisation of the music driver. The exact circumstances are
unknown except that it is the "dmusic" music driver that has the
problem and that the "win32" music driver does not.
As a result using the "win32" music driver will work around this
issue.
As the exact circumstances are unknown, and the obvious
configuration settings related to the music driver are at their
default we are not able to detect this failure, except when Windows'
music initialisation function returns after several hours and then
there is no point in switching the music driver anymore.
The reason we still use the "win32" music driver as default are
described in the "Long delay between switching music/song" section
of this document.
Pre- and exit signals are not dragged [FS#4378]
Unlike all other signal types, the entry- and exit signals are not
dragged but instead normal signals are placed on subsequent track
sections. This is done on purpose as this is the usually more con-
venient solution. There are little to no occasions where more than
one entry or exit signal in a row are useful. This is different
for all other signal types where several in a row can serve one
purpose or another.
Station build date is incorrect [FS#4415]
The tile query tool will show the date of the last (re)construction
at the station and not the date of the first construction. This is
due to compatability reasons with NewGRFs and the fact that it is
wrong to say that the station is built in a particular year when it
was completely destroyed/rebuilt later on.
The tile query tool can be fixed by changing the "Build date" text
to "Date at which the last (re)construction took place" but this is
deemed too specific and long for that window.
Can't change volume inside OpenTTD [FS#4416]
Some backends do not provide a means to change the volume of sound
effects or music. The mixing of music and sound is left to external
libraries/the operating system we can't handle the volume control
in OpenTTD. As a result you can't change the volume inside OpenTTD
for backends such as SDL; just use the volume control provided by
your operating system.
Can't run OpenTTD with the -d option from a MSYS console [FS#4587]
The MSYS console does not allow OpenTTD to open an extra console for
debugging output. Compiling OpenTTD with the --enable-console
configure option prevents this issue and allows the -d option to use
the MSYS console for its output.
Unreadable characters for non-latin locales [FS#4607]
OpenTTD does not ship a non-latin font in its graphics files. As a
result OpenTTD needs to acquire the font from somewhere else. What
OpenTTD does is ask the operating system, or a system library, for
the best font for a given language if the currently loaded font
does not provide all characters of the chosen translation. This
means that OpenTTD has no influence over the quality of the chosen
font; it just does the best it can do.
If the text is unreadable there are several steps that you can take
to improve this. The first step is finding a good font and configure
this in the configuration file. See section 9.0 of readme.txt for
more information. You can also increase the font size to make the
characters bigger and possible better readable.
If the problem is with the clarity of the font you might want to
enable anti-aliasing by setting the small_aa/medium_aa/large_aa
settings to "true". However, anti-aliasing only works when a 32 bits
blitter has been selected, e.g. blitter = "32bpp-anim", as with the
8 bits blitter there are not enough colours to properly perform the
anti-aliasing.
(Temporary) wrong colours when switching to full screen [FS#4511]:
On Windows it can happen that you temporarily see wrong colours
when switching to full screen OpenTTD, either by starting
OpenTTD in full screen mode, changing to full screen mode or by
ALT-TAB-ing into a full screen OpenTTD. This is caused by the
fact that OpenTTD, by default, uses 8bpp paletted output. The
wrong colours you are seeing is a temporary effect of the video
driver switching to 8bpp palette mode.
This issue can be worked around in two ways:
a) Setting fullscreen_bpp to 32
b) Setting up the 32bpp-anim or 32bpp-optimized blitter
Train does not crash with itself [FS#4635]:
When a train drives in a circle the front engine passes through
wagons of the same train without crashing. This is intentional.
Signals are only aware of tracks, they do not consider the train
length and whether there would be enough room for a train in some
circle it might drive on. Also the path a train might take is not
necessarily known when passing a signal.
Checking all circumstances would take a lot of additional computational
power for signals, which is not considered worth the effort, as
it does not add anything to gameplay.
Nevertheless trains shall not crash in normal operation, so making
a train not crash with itself is the best solution for everyone.
Aircraft coming through wall in rotated airports [FS#4705]:
With rotated airports, specifically hangars, you will see that the
aircraft will show a part through the back wall of the hangar.
This can be solved by only drawing a part of the plane when being
at the back of the hangar, however then with transparency turned on
the aircraft would be shown partially which would be even weirder.
As such the current behaviour is deemed the least bad.
The same applies to overly long ships and their depots.
Vehicles not keeping their "maximum" speed [FS#4815]:
Vehicles that have not enough power to reach and maintain their
advertised maximum speed might be constantly jumping between two
speeds. This is due to the fact that speed and its calculations
are done with integral numbers instead of floating point numbers.
As a result of this a vehicle will never reach its equilibrium
between the drag/friction and propulsion. So in effect it will be
in a vicious circle of speeding up and slowing down due to being
just at the other side of the equilibrium.
Not speeding up when near the equilibrium will cause the vehicle
to never come in the neighbourhood of the equilibrium and not
slowing down when near the equilibrium will cause the vehicle
to never slow down towards the equilibrium once it has come down
a hill.
It is possible to calculate whether the equilibrium will be
passed, but then all acceleration calculations need to be done
twice.
Settings not saved when OpenTTD crashes [FS#4846]:
The settings are not saved when OpenTTD crashes for several reasons.
The most important is that the game state is broken and as such the
settings might contain invalid values, or the settings have not even
been loaded yet. This would cause invalid or totally wrong settings
to be written to the configuration file.
A solution to that would be saving the settings whenever one changes,
however due to the way the configuration file is saved this requires
a flush of the file to the disk and OpenTTD needs to wait till that
is finished. On some file system implementations this causes the
flush of all 'write-dirty' caches, which can be a significant amount
of data to be written. This can further be aggravated by spinning
down disks to conserve power, in which case this disk needs to be
spun up first. This means that many seconds may pass before the
configuration file is actually written, and all that time OpenTTD
will not be able to show any progress. Changing the way the
configuration file is saved is not an option as that leaves us more
vulnerable to corrupt configuration files.
Finally, crashes should not be happening. If they happen they should
be reported and fixed, so essentially fixing this is fixing the
wrong thing. If you really need the configuration changes to be
saved, and you need to run a version that crashes regularly, then
you can use the 'saveconfig' command in the console to save the
settings.
Not all NewGRFs, AIs, game scripts are found [FS#4887]:
Under certain situations, where the path for the content within a
tar file is the same as other content on the file system or in another
tar file, it is possible that content is not found. A more thorough
explanation and solutions are described in section 4.4 of readme.txt.
Mouse cursor going missing with SDL [FS#4997]:
Under certain circumstances SDL does not notify OpenTTD of changes
with respect to the mouse pointer, specifically whether the mouse
pointer is within the bounds of OpenTTD or not. For example, if you
Alt-tab to another application the mouse cursor will still be shown
in OpenTTD, and when you move the mouse outside of the OpenTTD
window so the cursor gets hidden, open/move another application on
top of the OpenTTD window and then Alt-tab back into OpenTTD the
cursor will not be shown.
We cannot fix this problem as SDL simply does not provide the
required information in these corner cases. This is a bug in SDL
and as such there is little that we can do about it.
Inconsistent catchment areas [FS#5661]:
Due to performance decisions the catchment area for cargo accepted
by a station for delivery to houses or industries differs from the
catchment area for cargo that is delivered to stations from houses
or industries.
Conceptually they work the same, but the effect in game differs.
They work by finding the closest destination "around" the source
which is within a certain distance. This distance depends on the
type of station, e.g. road stops have a smaller catchment area than
large airports. In both cases the bounding box, the smallest
rectangle that contains all tiles of something, is searched for the
target of the cargo, and then spiraling outwards finding the closest
tile of the target.
In the case of a station with two tiles spread far apart with a house
that is within the station's bounding box, it would be possible that
the spiraling search from the house does not reach one of the station
tiles before the search ends, i.e. all tiles within that distance
are searched. So the house does not deliver cargo to the station. On
the other hand, the station will deliver cargo because the house
falls within the bounding box, and thus search area.
It is possible to make these consistent, but then cargo from a house
to a station needs to search up to 32 tiles around itself, i.e. 64
by 64 tiles, to find all possible stations it could deliver to
instead of 10 by 10 tiles (40 times more tiles). Alternatively the
search from a station could be changed to use the actual tiles, but
that would require considering checking 10 by 10 tiles for each of
the tiles of a station, instead of just once.
Trains might not stop at platforms that are currently being changed [FS#5553]:
If you add tiles to or remove tiles from a platform while a train is
approaching to stop at the same platform, that train can miss the place
where it's supposed to stop and pass the station without stopping. This
is caused by the fact that the train is considered to already have stopped
if it's beyond its assigned stopping location. We can't let the train stop
just anywhere in the station because then it would never leave the station
if you have the same station in the order list multiple times in a row or
if there is only one station in the order list (see FS#5684).
Some houses and industries are not affected by transparency [FS#5817]:
Some of the default houses and industries (f.e. the iron ore mine) are
not affected by the transparency options. This is because the graphics do
not (completely) separate the ground from the building.
This is a bug of the original graphics, and unfortunately cannot be
fixed with OpenGFX for the sake of maintaining compatibility with the
original graphics.
Involuntary cargo exchange with cargodist via neutral station [FS#6114]:
When two players serve a neutral station at an industry, a cross-company
chain for cargo flow can and will be established which can only be
interrupted if one of the players stops competing for the ressources of
that industry. There is an easy fix for this: If you are loading at the
shared station make the order "no unload" and if you're unloading make
it "no load". Cargodist will then figure out that it should not create
such a route.
window resizing with SDL on macOS [#3447]:
Video handling with (lib)SDL under macOS is known to fail on some
versions of macOS with some hardware configurations. Some of
the problems happen only under some circumstances whereas others
are always present.
We suggest that the SDL video/sound backend is not used for OpenTTD
in combinations with macOS.
Train crashes entering same junction from block and path signals [#3928]:
When a train has reserved a path from a path signal to a two way
block signal and the reservation passes a path signal through the
back another train can enter the reserved path (only) via that
same two way block signal.
The reason for this has to do with optimisation; to fix this issue
the signal update has to pass all path signals until it finds either
a train or a backwards facing signal. This is a very expensive task.
The (signal) setups that allow these crashes can furthermore be
considered incorrectly signalled; one extra safe waiting point for
the train entering from path signal just after the backwards facing
signal (from the path signal train) resolves the issue.
Crashes when run in a VM using Parallels Desktop [#4003]:
When the Windows version of OpenTTD is executed in a VM under
Parallels Desktop a privileged instruction exception may be thrown.
As OpenTTD works natively on macOS as well as natively on Windows and
these native builds both don't exhibit this behaviour this crash is
most likely due to a bug in the virtual machine, something out of
the scope of OpenTTD. Most likely this is due to Parallels Desktop
lacking support for RDTSC calls. The problem can be avoided by using
other VM-software, Wine, or running natively on macOS.
Entry- and exit signals are not dragged [#4378]:
Unlike all other signal types, the entry- and exit signals are not
dragged but instead normal signals are placed on subsequent track
sections. This is done on purpose as this is the usually more
convenient solution. There are little to no occasions where more
than one entry or exit signal in a row are useful. This is different
for all other signal types where several in a row can serve one
purpose or another.
Station build date is incorrect [#4415]:
The tile query tool will show the date of the last (re)construction
at the station and not the date of the first construction. This is
due to compatability reasons with NewGRFs and the fact that it is
wrong to say that the station is built in a particular year when it
was completely destroyed/rebuilt later on.
The tile query tool can be fixed by changing the "Build date" text
to "Date at which the last (re)construction took place" but this is
deemed too specific and long for that window.
(Temporary) wrong colours when switching to full screen [#4511]:
On Windows it can happen that you temporarily see wrong colours
when switching to full screen OpenTTD, either by starting
OpenTTD in full screen mode, changing to full screen mode or by
ALT-TAB-ing into a full screen OpenTTD. This is caused by the
fact that OpenTTD, by default, uses 8bpp paletted output. The
wrong colours you are seeing is a temporary effect of the video
driver switching to 8bpp palette mode.
This issue can be worked around in two ways:
a) Setting fullscreen_bpp to 32
b) Setting up the 32bpp-anim or 32bpp-optimized blitter
Can't run OpenTTD with the -d option from a MSYS console [#4587]:
The MSYS console does not allow OpenTTD to open an extra console for
debugging output. Compiling OpenTTD with the --enable-console
configure option prevents this issue and allows the -d option to use
the MSYS console for its output.
Unreadable characters for non-latin locales [#4607]:
OpenTTD does not ship a non-latin font in its graphics files. As a
result OpenTTD needs to acquire the font from somewhere else. What
OpenTTD does is ask the operating system, or a system library, for
the best font for a given language if the currently loaded font
does not provide all characters of the chosen translation. This
means that OpenTTD has no influence over the quality of the chosen
font; it just does the best it can do.
If the text is unreadable there are several steps that you can take
to improve this. The first step is finding a good font and configure
this in the configuration file. See section 9.0 of README.md for
more information. You can also increase the font size to make the
characters bigger and possible better readable.
If the problem is with the clarity of the font you might want to
enable anti-aliasing by setting the small_aa/medium_aa/large_aa
settings to "true". However, anti-aliasing only works when a 32-bit
blitter has been selected, e.g. blitter = "32bpp-anim", as with the
8 bits blitter there are not enough colours to properly perform the
anti-aliasing.
Train does not crash with itself [#4635]:
When a train drives in a circle the front engine passes through
wagons of the same train without crashing. This is intentional.
Signals are only aware of tracks, they do not consider the train
length and whether there would be enough room for a train in some
circle it might drive on. Also the path a train might take is not
necessarily known when passing a signal.
Checking all circumstances would take a lot of additional
computational power for signals, which is not considered worth
the effort, as it does not add anything to gameplay.
Nevertheless trains shall not crash in normal operation, so making
a train not crash with itself is the best solution for everyone.
Aircraft coming through wall in rotated airports [#4705]:
With rotated airports, specifically hangars, you will see that the
aircraft will show a part through the back wall of the hangar.
This can be solved by only drawing a part of the plane when being
at the back of the hangar, however then with transparency turned on
the aircraft would be shown partially which would be even weirder.
As such the current behaviour is deemed the least bad.
The same applies to overly long ships and their depots.
Vehicles not keeping their "maximum" speed [#4815]:
Vehicles that have not enough power to reach and maintain their
advertised maximum speed might be constantly jumping between two
speeds. This is due to the fact that speed and its calculations
are done with integral numbers instead of floating point numbers.
As a result of this a vehicle will never reach its equilibrium
between the drag/friction and propulsion. So in effect it will be
in a vicious circle of speeding up and slowing down due to being
just at the other side of the equilibrium.
Not speeding up when near the equilibrium will cause the vehicle to
never come in the neighbourhood of the equilibrium and not slowing
down when near the equilibrium will cause the vehicle to never slow
down towards the equilibrium once it has come down a hill.
It is possible to calculate whether the equilibrium will be passed,
but then all acceleration calculations need to be done twice.
Settings not saved when OpenTTD crashes [#4846]:
The settings are not saved when OpenTTD crashes for several reasons.
The most important is that the game state is broken and as such the
settings might contain invalid values, or the settings have not even
been loaded yet. This would cause invalid or totally wrong settings
to be written to the configuration file.
A solution to that would be saving the settings whenever one changes,
however due to the way the configuration file is saved this requires
a flush of the file to the disk and OpenTTD needs to wait till that
is finished. On some file system implementations this causes the
flush of all 'write-dirty' caches, which can be a significant amount
of data to be written. This can further be aggravated by spinning
down disks to conserve power, in which case this disk needs to be
spun up first. This means that many seconds may pass before the
configuration file is actually written, and all that time OpenTTD
will not be able to show any progress. Changing the way the
configuration file is saved is not an option as that leaves us more
vulnerable to corrupt configuration files.
Finally, crashes should not be happening. If they happen they should
be reported and fixed, so essentially fixing this is fixing the wrong
thing. If you really need the configuration changes to be saved,
and you need to run a version that crashes regularly, then you can
use the 'saveconfig' command in the console to save the settings.
Not all NewGRFs, AIs, game scripts are found [#4887]:
Under certain situations, where the path for the content within a
tar file is the same as other content on the file system or in another
tar file, it is possible that content is not found. A more thorough
explanation and solutions are described in section 4.4 of README.md.
Mouse cursor going missing with SDL [#4997]:
Under certain circumstances SDL does not notify OpenTTD of changes with
respect to the mouse pointer, specifically whether the mouse pointer
is within the bounds of OpenTTD or not. For example, if you "Alt-Tab"
to another application the mouse cursor will still be shown in OpenTTD,
and when you move the mouse outside of the OpenTTD window so the cursor
gets hidden, open/move another application on top of the OpenTTD window
and then Alt-tab back into OpenTTD the cursor will not be shown.
We cannot fix this problem as SDL simply does not provide the required
information in these corner cases. This is a bug in SDL and as such
there is little that we can do about it.
Trains might not stop at platforms that are currently being changed [#5553]:
If you add tiles to or remove tiles from a platform while a train is
approaching to stop at the same platform, that train can miss the place
where it's supposed to stop and pass the station without stopping.
This is caused by the fact that the train is considered to already
have stopped if it's beyond its assigned stopping location. We can't
let the train stop just anywhere in the station because then it would
never leave the station if you have the same station in the order
list multiple times in a row or if there is only one station
in theorder list (see #5684).
Inconsistent catchment areas [#5661]:
Due to performance decisions the catchment area for cargo accepted by a
station for delivery to houses or industries differs from the catchment
area for cargo that is delivered to stations from houses or industries.
Conceptually they work the same, but the effect in game differs. They
work by finding the closest destination "around" the source which is
within a certain distance. This distance depends on the type of station,
e.g. road stops have a smaller catchment area than large airports.
In both cases the bounding box, the smallest rectangle that contains
all tiles of something, is searched for the target of the cargo,
and then spiraling outwards finding the closest tile of the target.
In the case of a station with two tiles spread far apart with a house
that is within the station's bounding box, it would be possible that
the spiraling search from the house does not reach one of the station
tiles before the search ends, i.e. all tiles within that distance
are searched. So the house does not deliver cargo to the station.
On the other hand, the station will deliver cargo because the house
falls within the bounding box, and thus search area.
It is possible to make these consistent, but then cargo from a house
to a station needs to search up to 32 tiles around itself, i.e. 64
by 64 tiles, to find all possible stations it could deliver to
instead of 10 by 10 tiles (40 times more tiles). Alternatively the
search from a station could be changed to use the actual tiles, but
that would require considering checking 10 by 10 tiles for each of
the tiles of a station, instead of just once.
Some houses and industries are not affected by transparency [#5817]:
Some of the default houses and industries (f.e. the iron ore mine) are
not affected by the transparency options. This is because the graphics
do not (completely) separate the ground from the building.
This is a bug of the original graphics, and unfortunately cannot be
fixed with OpenGFX for the sake of maintaining compatibility with
the original graphics.
Involuntary cargo exchange with cargodist via neutral station [#6114]:
When two players serve a neutral station at an industry, a cross-company
chain for cargo flow can and will be established which can only be
interrupted if one of the players stops competing for the ressources of
that industry. There is an easy fix for this: If you are loading at the
shared station make the order "no unload" and if you're unloading make
it "no load". Cargodist will then figure out that it should not create
such a route.

@ -447,6 +447,7 @@ music/qtmidi.h
os/macosx/macos.h
os/macosx/osx_stdafx.h
os/macosx/splash.h
os/macosx/string_osx.h
sound/cocoa_s.h
video/cocoa/cocoa_keys.h
video/cocoa/cocoa_v.h
@ -1222,6 +1223,7 @@ sound/null_s.cpp
music/cocoa_m.cpp
sound/cocoa_s.cpp
os/macosx/splash.cpp
os/macosx/string_osx.cpp
#end
#end

@ -208,6 +208,7 @@ class FreeTypeFontCache : public FontCache {
private:
FT_Face face; ///< The font face associated with this font.
int req_size; ///< Requested font size.
int used_size; ///< Used font size.
typedef SmallMap<uint32, SmallPair<size_t, const void*> > FontTable; ///< Table with font table cache
FontTable font_tables; ///< Cached font tables.
@ -241,6 +242,7 @@ private:
public:
FreeTypeFontCache(FontSize fs, FT_Face face, int pixels);
~FreeTypeFontCache();
virtual int GetFontSize() const { return this->used_size; }
virtual SpriteID GetUnicodeGlyph(WChar key) { return this->parent->GetUnicodeGlyph(key); }
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite) { this->parent->SetUnicodeGlyph(key, sprite); }
@ -295,6 +297,7 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels)
pixels = Clamp(min(head->Lowest_Rec_PPEM, 20) + diff, scaled_height, MAX_FONT_SIZE);
}
}
this->used_size = pixels;
FT_Error err = FT_Set_Pixel_Sizes(this->face, 0, pixels);
if (err != FT_Err_Ok) {

@ -68,6 +68,12 @@ public:
*/
inline int GetUnitsPerEM() const { return this->units_per_em; }
/**
* Get the nominal font size of the font.
* @return The nominal font size.
*/
virtual int GetFontSize() const { return this->height; }
/**
* Get the SpriteID mapped to the given key
* @param key The key to get the sprite for.

@ -25,6 +25,10 @@
#include "os/windows/string_uniscribe.h"
#endif /* WITH_UNISCRIBE */
#ifdef WITH_COCOA
#include "os/macosx/string_osx.h"
#endif
#include "safeguards.h"
@ -670,7 +674,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
} else {
/* Line is new, layout it */
FontState old_state = state;
#if defined(WITH_ICU_LAYOUT) || defined(WITH_UNISCRIBE)
#if defined(WITH_ICU_LAYOUT) || defined(WITH_UNISCRIBE) || defined(WITH_COCOA)
const char *old_str = str;
#endif
@ -698,6 +702,16 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
}
#endif
#ifdef WITH_COCOA
if (line.layout == NULL) {
GetLayouter<CoreTextParagraphLayoutFactory>(line, str, state);
if (line.layout == NULL) {
state = old_state;
str = old_str;
}
}
#endif
if (line.layout == NULL) {
GetLayouter<FallbackParagraphLayoutFactory>(line, str, state);
}
@ -841,6 +855,9 @@ void Layouter::ResetFontCache(FontSize size)
#if defined(WITH_UNISCRIBE)
UniscribeResetScriptCache(size);
#endif
#if defined(WITH_COCOA)
MacOSResetScriptCache(size);
#endif
}
/**

@ -2797,36 +2797,36 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD
# Framerate display window
STR_FRAMERATE_CAPTION :{WHITE}Broj sličica
STR_FRAMERATE_CAPTION_SMALL :{STRING}{WHITE} ({DECIMAL}x)
STR_FRAMERATE_RATE_GAMELOOP :{WHITE}Stopa simulacije: {STRING}
STR_FRAMERATE_RATE_GAMELOOP :{BLACK}Stopa simulacije: {STRING}
STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Broj otkucaja igre simuliranih u sekundi.
STR_FRAMERATE_RATE_BLITTER :{WHITE}Broj sličica u sekundi: {STRING}
STR_FRAMERATE_RATE_BLITTER :{BLACK}Broj sličica u sekundi: {STRING}
STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Broj sličica videa prikayanih u sekundi.
STR_FRAMERATE_SPEED_FACTOR :{WHITE}Trenutni faktor brzine igre: {DECIMAL}x
STR_FRAMERATE_SPEED_FACTOR :{BLACK}Trenutni faktor brzine igre: {DECIMAL}x
STR_FRAMERATE_SPEED_FACTOR_TOOLTIP :{BLACK}Koliko brzo se igra izvodi trenutno u usporedbi sa očekivanom brzinom u uobičajenoj simulaciji.
STR_FRAMERATE_CURRENT :{WHITE}Trenutno
STR_FRAMERATE_AVERAGE :{WHITE}Prosječno
STR_FRAMERATE_DATA_POINTS :{WHITE}Podaci bazirani na {COMMA} mjerama
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL}{WHITE} ms
STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL}{WHITE} ms
STR_FRAMERATE_MS_BAD :{RED}{DECIMAL}{WHITE} ms
STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL}{WHITE} sličica/s
STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL}{WHITE} sličica/s
STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL}{WHITE} sličica/s
STR_FRAMERATE_DATA_POINTS :{BLACK}Podaci bazirani na {COMMA} mjerama
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL} ms
STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL} ms
STR_FRAMERATE_MS_BAD :{RED}{DECIMAL} ms
STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL} sličica/s
STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL} sličica/s
STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL} sličica/s
STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} ms
STR_FRAMERATE_GRAPH_SECONDS :{TINY_FONT}{COMMA} s
############ Leave those lines in this order!!
STR_FRAMERATE_GAMELOOP :{WHITE}Zbroj petlji igre:
STR_FRAMERATE_GL_ECONOMY :{WHITE} Korištenje tereta:
STR_FRAMERATE_GL_TRAINS :{WHITE} Otkucaji vlakova:
STR_FRAMERATE_GL_ROADVEHS :{WHITE} Otkucaji cestovnih vozila:
STR_FRAMERATE_GL_SHIPS :{WHITE} Otkucaji brodova:
STR_FRAMERATE_GL_AIRCRAFT :{WHITE} Otkucaji aviona:
STR_FRAMERATE_GL_LANDSCAPE :{WHITE} Otkucaji svijeta:
STR_FRAMERATE_GL_LINKGRAPH :Odmak linka grafikona
STR_FRAMERATE_DRAWING :{WHITE}Prikaz grafike:
STR_FRAMERATE_DRAWING_VIEWPORTS :{WHITE} Prikazi svijeta:
STR_FRAMERATE_VIDEO :{WHITE}Video izlaz:
STR_FRAMERATE_SOUND :{WHITE}Miksanje zvukova:
STR_FRAMERATE_GAMELOOP :{BLACK}Zbroj petlji igre:
STR_FRAMERATE_GL_ECONOMY :{BLACK} Korištenje tereta:
STR_FRAMERATE_GL_TRAINS :{BLACK} Otkucaji vlakova:
STR_FRAMERATE_GL_ROADVEHS :{BLACK} Otkucaji cestovnih vozila:
STR_FRAMERATE_GL_SHIPS :{BLACK} Otkucaji brodova:
STR_FRAMERATE_GL_AIRCRAFT :{BLACK} Otkucaji aviona:
STR_FRAMERATE_GL_LANDSCAPE :{BLACK} Otkucaji svijeta:
STR_FRAMERATE_GL_LINKGRAPH :{BLACK} Odmak linka grafikona:
STR_FRAMERATE_DRAWING :{BLACK}Prikaz grafike:
STR_FRAMERATE_DRAWING_VIEWPORTS :{BLACK} Prikazi svijeta:
STR_FRAMERATE_VIDEO :{BLACK}Video izlaz:
STR_FRAMERATE_SOUND :{BLACK}Miksanje zvukova:
############ End of leave-in-this-order
############ Leave those lines in this order!!
STR_FRAMETIME_CAPTION_GAMELOOP :Petlja igre
@ -2866,6 +2866,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}Detalji
STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}Nema dostupnih informacija.
STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING}
STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF: {WHITE}{STRING}
STR_SAVELOAD_FILTER_TITLE :{BLACK}Filtriraj niz:
STR_SAVELOAD_OSKTITLE :{BLACK}Upiši ime za spremanje igre

@ -2731,36 +2731,36 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD
# Framerate display window
STR_FRAMERATE_CAPTION :{WHITE}Frame rate
STR_FRAMERATE_CAPTION_SMALL :{STRING}{WHITE} ({DECIMAL}x)
STR_FRAMERATE_RATE_GAMELOOP :{WHITE}Velocità simulazione: {STRING}
STR_FRAMERATE_RATE_GAMELOOP :{BLACK}Velocità simulazione: {STRING}
STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Numero di cicli di simulazione della partita in un secondo
STR_FRAMERATE_RATE_BLITTER :{WHITE}Frame rate grafica: {STRING}
STR_FRAMERATE_RATE_BLITTER :{BLACK}Frame rate grafica: {STRING}
STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Numero di fotogrammi video renderizzati in un secondo
STR_FRAMERATE_SPEED_FACTOR :{WHITE}Fattore di velocità corrente della partita: {DECIMAL}x
STR_FRAMERATE_SPEED_FACTOR :{BLACK}Fattore di velocità corrente della partita: {DECIMAL}x
STR_FRAMERATE_SPEED_FACTOR_TOOLTIP :{BLACK}Prestazioni correnti della partita, confrontate con le prestazioni attese alla velocità di giorno normale.
STR_FRAMERATE_CURRENT :{WHITE}Corrente
STR_FRAMERATE_AVERAGE :{WHITE}Media
STR_FRAMERATE_DATA_POINTS :{WHITE}Dati basati su {COMMA} misurazioni
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL}{WHITE} ms
STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL}{WHITE} ms
STR_FRAMERATE_MS_BAD :{RED}{DECIMAL}{WHITE} ms
STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL}{WHITE} frame/s
STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL}{WHITE} frame/s
STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL}{WHITE} frame/s
STR_FRAMERATE_DATA_POINTS :{BLACK}Dati basati su {COMMA} misurazioni
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL} ms
STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL} ms
STR_FRAMERATE_MS_BAD :{RED}{DECIMAL} ms
STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL} frame/s
STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL} frame/s
STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL} frame/s
STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} ms
STR_FRAMERATE_GRAPH_SECONDS :{TINY_FONT}{COMMA} s
############ Leave those lines in this order!!
STR_FRAMERATE_GAMELOOP :{WHITE}Totale ciclo simulazione:
STR_FRAMERATE_GL_ECONOMY :{WHITE} Gestione carichi:
STR_FRAMERATE_GL_TRAINS :{WHITE} Aggiornamento treni:
STR_FRAMERATE_GL_ROADVEHS :{WHITE} Aggiornamento automezzi:
STR_FRAMERATE_GL_SHIPS :{WHITE} Aggiornamento navi:
STR_FRAMERATE_GL_AIRCRAFT :{WHITE} Aggiornamento aeromobili:
STR_FRAMERATE_GL_LANDSCAPE :{WHITE} Aggiornamento mondo:
STR_FRAMERATE_GL_LINKGRAPH :{WHITE} Ritardo grafo di distribuzione:
STR_FRAMERATE_DRAWING :{WHITE}Renderizzazione grafica:
STR_FRAMERATE_DRAWING_VIEWPORTS :{WHITE} Visuali mondo:
STR_FRAMERATE_VIDEO :{WHITE}Output video:
STR_FRAMERATE_SOUND :{WHITE}Missaggio suoni:
STR_FRAMERATE_GAMELOOP :{BLACK}Totale ciclo simulazione:
STR_FRAMERATE_GL_ECONOMY :{BLACK} Gestione carichi:
STR_FRAMERATE_GL_TRAINS :{BLACK} Aggiornamento treni:
STR_FRAMERATE_GL_ROADVEHS :{BLACK} Aggiornamento automezzi:
STR_FRAMERATE_GL_SHIPS :{BLACK} Aggiornamento navi:
STR_FRAMERATE_GL_AIRCRAFT :{BLACK} Aggiornamento aeromobili:
STR_FRAMERATE_GL_LANDSCAPE :{BLACK} Aggiornamento mondo:
STR_FRAMERATE_GL_LINKGRAPH :{BLACK} Ritardo grafo di distribuzione:
STR_FRAMERATE_DRAWING :{BLACK}Renderizzazione grafica:
STR_FRAMERATE_DRAWING_VIEWPORTS :{BLACK} Visuali mondo:
STR_FRAMERATE_VIDEO :{BLACK}Output video:
STR_FRAMERATE_SOUND :{BLACK}Missaggio suoni:
############ End of leave-in-this-order
############ Leave those lines in this order!!
STR_FRAMETIME_CAPTION_GAMELOOP :Ciclo simulazione
@ -2800,6 +2800,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}Dettagli
STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}Informazioni non disponibili
STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING}
STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF: {WHITE}{STRING}
STR_SAVELOAD_FILTER_TITLE :{BLACK}Filtro:
STR_SAVELOAD_OSKTITLE :{BLACK}Inserire un nome per il salvataggio

@ -1833,8 +1833,8 @@ STR_LIVERY_TRUCK :Veículo de Mer
STR_LIVERY_PASSENGER_SHIP :Barco de Passageiros
STR_LIVERY_FREIGHT_SHIP :Barco Cargueiro
STR_LIVERY_HELICOPTER :Helicóptero
STR_LIVERY_SMALL_PLANE :Aeronave de Pequenas Dimensões
STR_LIVERY_LARGE_PLANE :Aeronave de Grandes Dimensões
STR_LIVERY_SMALL_PLANE :Avião de Pequenas Dimensões
STR_LIVERY_LARGE_PLANE :Avião de Grandes Dimensões
STR_LIVERY_PASSENGER_TRAM :Eléctrico de Passageiros
STR_LIVERY_FREIGHT_TRAM :Eléctrico de Mercadorias

@ -475,6 +475,7 @@ STR_ABOUT_MENU_SCREENSHOT :屏幕截图
STR_ABOUT_MENU_ZOOMIN_SCREENSHOT :高清截图
STR_ABOUT_MENU_DEFAULTZOOM_SCREENSHOT :默认缩放模式下的屏幕截图
STR_ABOUT_MENU_GIANT_SCREENSHOT :全地图截图
STR_ABOUT_MENU_SHOW_FRAMERATE :显示帧率
STR_ABOUT_MENU_ABOUT_OPENTTD :关于 'OpenTTD'
STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite 对齐
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :切换边界框
@ -650,6 +651,7 @@ STR_MUSIC_RULER_MARKER :{TINY_FONT}{BLA
STR_MUSIC_TRACK_NONE :{TINY_FONT}{DKGREEN}--
STR_MUSIC_TRACK_DIGIT :{TINY_FONT}{DKGREEN}{ZEROFILL_NUM}
STR_MUSIC_TITLE_NONE :{TINY_FONT}{DKGREEN}------
STR_MUSIC_TITLE_NOMUSIC :{TINY_FONT}{DKGREEN}没有可用的音乐包
STR_MUSIC_TITLE_NAME :{TINY_FONT}{DKGREEN}"{STRING}"
STR_MUSIC_TRACK :{TINY_FONT}{BLACK}音轨
STR_MUSIC_XTITLE :{TINY_FONT}{BLACK}乐曲主题
@ -812,6 +814,7 @@ STR_NEWS_MERGER_TAKEOVER_TITLE :{BIG_FONT}{BLAC
STR_PRESIDENT_NAME_MANAGER :{BLACK}{PRESIDENT_NAME}{}(总裁)
STR_NEWS_NEW_TOWN :{BLACK}{BIG_FONT}{STRING} 赞助了城镇 {TOWN} 的建设!
STR_NEWS_NEW_TOWN_UNSPONSORED :{BLACK}{BIG_FONT}一个名叫{TOWN}的城镇刚刚成立了!
STR_NEWS_INDUSTRY_CONSTRUCTION :{BIG_FONT}{BLACK}新 {STRING} 正在 {TOWN} 加紧建设!
STR_NEWS_INDUSTRY_PLANTED :{BIG_FONT}{BLACK}新 {STRING} 即将落户 {TOWN}
@ -1336,7 +1339,9 @@ STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_HELPTEXT :设置缩略地
STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_GREEN :绿色
STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_DARK_GREEN :深绿色
STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_VIOLET :紫色
STR_CONFIG_SETTING_SCROLLMODE_DEFAULT :鼠标右键移动地图,鼠标指针不跟随移动
STR_CONFIG_SETTING_SCROLLMODE_RMB :鼠标右键移动地图
STR_CONFIG_SETTING_SCROLLMODE_LMB :鼠标左键移动地图
STR_CONFIG_SETTING_SMOOTH_SCROLLING :平滑视角滚动: {STRING}
STR_CONFIG_SETTING_SMOOTH_SCROLLING_HELPTEXT :设置在缩略图上点击或者发出转到特定目标的命令时主视角的转换方式,如果“打开”本选项,视角平缓滚动,“关闭”时直接跳转到目标位置
STR_CONFIG_SETTING_MEASURE_TOOLTIP :建设时显示测量数据:{STRING}
@ -1368,6 +1373,8 @@ STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_COMMAND :按住Command
STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_CONTROL :按住Ctrl键 点击
STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_OFF :关闭
STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE :右键关闭窗口: {STRING}
STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_HELPTEXT :使用在窗口内按右键关闭该窗口,本功能与右键工具提示不能共存!
STR_CONFIG_SETTING_AUTOSAVE :自动保存: {STRING}
STR_CONFIG_SETTING_AUTOSAVE_HELPTEXT :选择自动存档时间间隔
@ -1603,7 +1610,7 @@ STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :游戏开局时
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :每 {STRING}{NBSP}天刷新一次分配图
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :指定每次计算货物分配图之间的时间。由于每次重新计算只会处理一个货物分配图元件,因此本设定不代表“每若干日重新计算整个货物分配图”。{}如果此设定赋值越小,則系统需要使用更多处理器时间计算货物分配图。相反,如果此设定赋值越大,則货物被派往新路线所需的时间越长。
STR_CONFIG_SETTING_LINKGRAPH_TIME :容许系统用 {STRING}{NBSP}天时间刷新货物分配图
STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :當刷新货物分配图时,系统會衍生一条线程。本设定的值即为线程的持续时间。{}这设定赋值越小,线程越有可能在应当停止的时候还未完成,游戏会暂停运作至线程完成工作。相反,这设定赋值越大,則货物分配功能需要较长时间反映线路网変动的影晌。
STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :当刷新货物分配图时,系统会创建一条线程。此处设定的数值即该线程的持续时间。{}赋值越小,线程越有可能在应当停止的时候还未完成,游戏会暂停运作至线程完成工作。相反,赋值越大,则货物分配功能需要较长时间反映线路网变动的影晌。
STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :手动
STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :不对称
STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :对称
@ -1612,7 +1619,7 @@ STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :假设有交通
STR_CONFIG_SETTING_DISTRIBUTION_MAIL :邮件分配方式:{STRING}
STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :假设有交通路线连接甲、乙两站。“对称”指甲站往乙站的邮件数量與乙站往甲站的邮件数量大致相同。“不对称”指任何一站往另一站的邮件数量皆由系统随意决定。“手动”指系统不会自动分配邮件的目的地。
STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED :装甲货物分配方式:{STRING}
STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :“装甲货物”包括带场景的“贵重品”、寒带场景的“金块”及沙漠场景的“钻石”。使用 NewGRF 可能会改以上设置。{} 假设有交通路线连接甲、乙两站。“对称”指甲站往乙站的货物数量乙站往甲站的装甲货物数量大致相同。“不对称”指任何一站往另一站的装甲货物数量皆由系统随意决定。“手动”指系统不会自动分配装甲货物的目的地。{} 建议在带及沙漠场景使用“对称”,因为银行之间会相互发送贵重品或钻石;在寒带则应使用“不对称”,因为银行不会把金块送回金矿。
STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :“装甲货物”包括带场景的“贵重品”、寒带场景的“金块”及沙漠场景的“钻石”。使用 NewGRF 可能会改以上设置。{} 假设有交通路线连接甲、乙两站。“对称”指甲站往乙站的货物数量乙站往甲站的装甲货物数量大致相同。“不对称”指任何一站往另一站的装甲货物数量皆由系统随意决定。“手动”指系统不会自动分配装甲货物的目的地。{} 建议在带及沙漠场景使用“对称”,因为银行之间会相互发送贵重品或钻石;在寒带则应使用“不对称”,因为银行不会把金块送回金矿。
STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :其他货物分配方式:{STRING}
STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :如为此设置赋值“不对称”,则任何一站往另一站的货物数量皆由系统随意决定。如为此设置赋值“手动”,则系统不会依据交通路线分配货物的目的地。
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :分配精确度:{STRING}
@ -2255,7 +2262,7 @@ STR_CONTENT_ERROR_COULD_NOT_EXTRACT :{WHITE}无法
STR_MISSING_GRAPHICS_SET_CAPTION :{WHITE}缺失图形组
STR_MISSING_GRAPHICS_SET_MESSAGE :{BLACK}OpenTTD 需要基础图形组用以绘制界面。您是否希望 OpenTTD 下载并安装以下图形组?
STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}是的,下载之
STR_MISSING_GRAPHICS_YES_DOWNLOAD :{BLACK}好,开始下载
STR_MISSING_GRAPHICS_NO_QUIT :{BLACK}不退出OpenTTD
# Transparency settings window
@ -2685,7 +2692,19 @@ STR_ABOUT_VERSION :{BLACK}OpenTTD
STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT} 2002-2018 OpenTTD 团队
# Framerate display window
STR_FRAMERATE_CAPTION :{WHITE}帧率
STR_FRAMERATE_CAPTION_SMALL :{STRING}{WHITE} ({DECIMAL}x)
STR_FRAMERATE_RATE_BLITTER :{BLACK}帧率:{STRING}
STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}每秒渲染更新的图像帧。
STR_FRAMERATE_SPEED_FACTOR :{BLACK}当前游戏速度:{DECIMAL}x
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL} ms
STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL} fps
STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL} fps
STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL} fps
STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} ms
############ Leave those lines in this order!!
STR_FRAMERATE_VIDEO :{BLACK}视频输出:
STR_FRAMERATE_SOUND :{BLACK}混响:
############ End of leave-in-this-order
############ Leave those lines in this order!!
############ End of leave-in-this-order
@ -2713,6 +2732,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}游戏
STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}无可用信息
STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING}
STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF: {WHITE}{STRING}
STR_SAVELOAD_FILTER_TITLE :{BLACK}过滤字串:
STR_SAVELOAD_OSKTITLE :{BLACK}为存档命名
@ -3366,6 +3386,7 @@ STR_GROUP_RENAME_CAPTION :{BLACK}重命
STR_GROUP_PROFIT_THIS_YEAR :今年利润:
STR_GROUP_PROFIT_LAST_YEAR :去年利润
STR_GROUP_OCCUPANCY :当前使用量:
STR_GROUP_OCCUPANCY_VALUE :{NUM}%
# Build vehicle window
@ -3534,7 +3555,10 @@ STR_ENGINE_PREVIEW_MAGLEV_LOCOMOTIVE :磁悬浮机车
STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER :{BLACK}售价:{CURRENCY_LONG} 重量:{WEIGHT_SHORT}{}速度:{VELOCITY} 功率:{POWER}{}运行费用:{CURRENCY_LONG}/年{}运载能力: {CARGO_LONG}
STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE :{BLACK}售价:{CURRENCY_LONG} 重量:{WEIGHT_SHORT}{}速度:{VELOCITY} 功率:{POWER} 最大牵引力:{6:FORCE}{}运行费用{4:CURRENCY_LONG}/年{}运载能力:{5:CARGO_LONG}
STR_ENGINE_PREVIEW_COST_MAX_SPEED_CAP_RUNCOST :{BLACK}售价:{CURRENCY_LONG} 最大速度:{VELOCITY}{}运载能力:{CARGO_LONG}{}运行成本:{CURRENCY_LONG} /年
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_CAP_RUNCOST :{BLACK}售价:{CURRENCY_LONG} 最大速度:{VELOCITY}{}飞机类型:{STRING}{}运载能力:{CARGO_LONG}, {CARGO_LONG}{}运行成本: {CURRENCY_LONG}/年
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_CAP_RUNCOST :{BLACK}售价: {CURRENCY_LONG} 最大速度: {VELOCITY}{}飞机类型: {STRING}{}运载能力: {CARGO_LONG}{}运行成本: {CURRENCY_LONG}/年
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_CAP_RUNCOST :{BLACK}购买费用: {CURRENCY_LONG} 最大速度: {VELOCITY}{}飞机种类: {STRING} 最大航程: {COMMA} 格{}装载量: {CARGO_LONG}, {CARGO_LONG}{}运行费用: {CURRENCY_LONG}/年
STR_ENGINE_PREVIEW_COST_MAX_SPEED_TYPE_RANGE_CAP_RUNCOST :{BLACK}售价: {CURRENCY_LONG} 最大速度: {VELOCITY}{}飞机类型: {STRING} 续航里程: {COMMA} 格{}运载能力: {CARGO_LONG}{}运行成本: {CURRENCY_LONG}/年
# Autoreplace window
STR_REPLACE_VEHICLES_WHITE :{WHITE}更新 {STRING} - {STRING}
@ -4475,6 +4499,7 @@ STR_BASESOUNDS_WIN_DESCRIPTION :Transport Tycoo
STR_BASESOUNDS_NONE_DESCRIPTION :一个空的音效包.
STR_BASEMUSIC_WIN_DESCRIPTION :Transport Tycoon Deluxe运输大亨Windows豪华版的原版音乐包
STR_BASEMUSIC_DOS_DESCRIPTION :运输大亨DOS豪华版原版音乐。
STR_BASEMUSIC_TTO_DESCRIPTION :原版运输大亨DOS版及地图编辑器扩展音乐。
STR_BASEMUSIC_NONE_DESCRIPTION :一个没有实际内容的音乐包.
##id 0x2000

@ -925,6 +925,7 @@ STR_GAME_OPTIONS_CURRENCY_ZAR :Rand sudafrican
STR_GAME_OPTIONS_CURRENCY_CUSTOM :Personalizada...
STR_GAME_OPTIONS_CURRENCY_GEL :Lari Georgiano (GEL)
STR_GAME_OPTIONS_CURRENCY_IRR :Rial Iraní (IRR)
STR_GAME_OPTIONS_CURRENCY_RUB :Nuevo Rublo Ruso (RUB)
############ end of currency region
STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME :{BLACK}Vehículos de carretera
@ -1602,10 +1603,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Ninguna
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Multiplicador inicial del tamaño de ciudad: {STRING}
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Tamaño medio de las ciudades en relación a los pueblos normales al comienzo de la partida
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Actualizar el grafo de distribución cada {STRING}{NBSP}día{P 0:2 "" s}
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :Periodo de tiempo entre cálculos del grafo de distribución consecutivos. Esta opción se refiere a los cálculos para cada uno de los componentes del grafo, por lo cual fijar un valor no quiere decir que el grafo completo se actualizará tras ese número de días. Cuanto menor sea, mayor tiempo de CPU será necesario para calcular el grafo de distribución. Cuanto mayor sea, más tardará el grafo de distribución en adaptarse a nuevas rutas
STR_CONFIG_SETTING_LINKGRAPH_TIME :Usar {STRING}{NBSP}día{P 0:2 "" s} para el cálculo del grafo de distribución
STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Tiempo a emplear en el cálculo de cada uno de los componentes del grafo de distribución. Cuanto menor sea este valor, más probable es que se produzca ralentización en el juego. Cuanto mayor sea, más tiempo tardará la distribución en actualizarse cuando se producen cambios en las rutas
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Actualizar el gráfico de distribución cada {STRING}{NBSP}día{P 0:2 "" s}
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :Periodo de tiempo entre cálculos del gráfico de distribución consecutivos. Esta opción se refiere a los cálculos para cada uno de los componentes del gráfico, por lo cual fijar un valor no quiere decir que el gráfico completo se actualizará tras ese número de días. Cuanto menor sea, mayor tiempo de CPU será necesario para calcular el gráfico de distribución. Cuanto mayor sea, más tardará el gráfico de distribución en adaptarse a nuevas rutas.
STR_CONFIG_SETTING_LINKGRAPH_TIME :Usar {STRING}{NBSP}día{P 0:2 "" s} para el cálculo del gráfico de distribución
STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Tiempo a emplear en el cálculo de cada uno de los componentes del gráfico de distribución. Cuanto menor sea este valor, más probable es que se produzca ralentización en el juego. Cuanto mayor sea, más tiempo tardará la distribución en actualizarse cuando se producen cambios en las rutas.
STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :manual
STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :asimétrico
STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :simétrico
@ -1618,7 +1619,7 @@ STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :La clase de car
STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :Modo de distribución para otras clases de carga: {STRING}
STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Asimétrico" significa que se pueden mover cantidades arbitrarias de carga en ambas direcciones. "Manual" significa que no habrá distribución automática para estos tipos de carga.
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :Precisión de la distribución: {STRING}
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Este valor determina el tiempo de CPU empleado en calcular el grafo de distribución. Si es demasiado elevado puede producir ralentización en el juego. Si es demasiado bajo la distribución puede ser poco precisa, causando que ocasionalmente se produzcan errores en los lugares a los que va la carga
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Este valor determina el tiempo de CPU empleado en calcular el gráfico de distribución. Si es demasiado elevado puede producir ralentización en el juego. Si es demasiado bajo la distribución puede ser poco precisa, causando que ocasionalmente se produzcan errores en los lugares a los que va la carga.
STR_CONFIG_SETTING_DEMAND_DISTANCE :Efecto de la distancia en la demanda: {STRING}
STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT :Si se fija a un valor superior a 0, la distancia entre la estación origen A de cierta carga y un posible destino B afectará a la cantidad de carga que se enviará de A a B. Cuanto más lejos esté B de A, menos carga se enviará. Cuanto mayor sea el valor de esta opción, menos carga se enviará a estaciones distantes en favor de estaciones cercanas
STR_CONFIG_SETTING_DEMAND_SIZE :Cantidad de carga a devolver en modo simétrico: {STRING}
@ -1863,7 +1864,7 @@ STR_FACE_FACECODE :{BLACK}Cara del
STR_FACE_FACECODE_TOOLTIP :{BLACK}Ver y/o asignar número de cara de presidente
STR_FACE_FACECODE_CAPTION :{WHITE}Ver y/o asignar número de cara de presidente
STR_FACE_FACECODE_SET :{WHITE}Nuevo código de cara ha sido asignado
STR_FACE_FACECODE_ERR :{WHITE}No se puede asignar número de cara de presidente - ¡debe ser un número entre 0 y 4,294,967,295!
STR_FACE_FACECODE_ERR :{WHITE}No se puede asignar número de cara de presidente - ¡Ha de ser un número entre 0 y 4,294,967,295!
STR_FACE_SAVE :{BLACK}Guardar
STR_FACE_SAVE_TOOLTIP :{BLACK}Guardar cara favorita
STR_FACE_SAVE_DONE :{WHITE}Esta cara ha sido guardada como tu favorita en el fichero de configuración
@ -2689,14 +2690,25 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD
# Framerate display window
STR_FRAMERATE_CAPTION :{WHITE}Fotogramas por segundo - FPS
STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Número de fotogramas renderizados por segundo.
STR_FRAMERATE_CURRENT :{WHITE}Actual
STR_FRAMERATE_AVERAGE :{WHITE}Medio
STR_FRAMERATE_DATA_POINTS :{WHITE}Datos basados en {COMMA} medidas
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL}{WHITE} ms
STR_FRAMERATE_DATA_POINTS :{BLACK}Datos basados en {COMMA} medidas
STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL} ms
STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL} ms
STR_FRAMERATE_MS_BAD :{RED}{DECIMAL} ms
STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL} frames/s
STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL} frames/s
STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL} frames/s
STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} ms
STR_FRAMERATE_GRAPH_SECONDS :{TINY_FONT}{COMMA} s
############ Leave those lines in this order!!
STR_FRAMERATE_DRAWING :{BLACK}Renderizado gráfico:
############ End of leave-in-this-order
############ Leave those lines in this order!!
STR_FRAMETIME_CAPTION_DRAWING :Renderizado gráfico
STR_FRAMETIME_CAPTION_VIDEO :Salida de vídeo
STR_FRAMETIME_CAPTION_SOUND :Mezcla de sonido
############ End of leave-in-this-order
@ -2722,6 +2734,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}Detalles
STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}No hay información disponible
STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING}
STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF: {WHITE}{STRING}
STR_SAVELOAD_FILTER_TITLE :{BLACK}Patrón de filtrado:
STR_SAVELOAD_OSKTITLE :{BLACK}Introduce un nombre para el juego guardado
@ -4001,7 +4014,7 @@ STR_ERROR_AI_DEBUG_SERVER_ONLY :{YELLOW}La vent
# AI configuration window
STR_AI_CONFIG_CAPTION :{WHITE}Configuración de Scripts de Juego / IA
STR_AI_CONFIG_GAMELIST_TOOLTIP :{BLACK}Script de Juego que será cargada en la próxima partida
STR_AI_CONFIG_GAMELIST_TOOLTIP :{BLACK}Script de Juego que será cargado en la próxima partida
STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}IAs que serán cargadas en la próxima partida
STR_AI_CONFIG_HUMAN_PLAYER :Jugador Humano
STR_AI_CONFIG_RANDOM_AI :IA aleatoria
@ -4240,6 +4253,7 @@ STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD :{WHITE}... esta
STR_ERROR_DRIVE_THROUGH_DIRECTION :{WHITE}... carretera en la dirección incorrecta
STR_ERROR_DRIVE_THROUGH_CORNER :{WHITE}... las estaciones de autobús de paso no pueden tener esquinas
STR_ERROR_DRIVE_THROUGH_JUNCTION :{WHITE}... las estaciones de autobús de paso no pueden tener intersecciones
STR_ERROR_DRIVE_THROUGH_ON_ONEWAY_ROAD :{WHITE}... carretera de un solo sentido o bloqueada
# Station destruction related errors
STR_ERROR_CAN_T_REMOVE_PART_OF_STATION :{WHITE}No se puede retirar parte de la estación...
@ -4484,13 +4498,15 @@ STR_ERROR_CAN_T_DELETE_SIGN :{WHITE}No se pu
STR_DESKTOP_SHORTCUT_COMMENT :Un juego de simulación basado en Transport Tycoon Deluxe
# Translatable descriptions in media/baseset/*.ob* files
STR_BASEGRAPHICS_DOS_DESCRIPTION :Gráficos originales de Transport Tycoon Deluxe versión DOS.
STR_BASEGRAPHICS_DOS_DE_DESCRIPTION :Gráficos originales de Transport Tycoon Deluxe versión DOS (Alemán).
STR_BASEGRAPHICS_WIN_DESCRIPTION :Gráficos originales de Transport Tycoon Deluxe versión Windows.
STR_BASESOUNDS_DOS_DESCRIPTION :Sonidos originales de Transport Tycoon Deluxe versión DOS.
STR_BASESOUNDS_WIN_DESCRIPTION :Sonidos originales de Transport Tycoon Deluxe versión Windows.
STR_BASEGRAPHICS_DOS_DESCRIPTION :Gráficos originales de Transport Tycoon Deluxe, versión DOS.
STR_BASEGRAPHICS_DOS_DE_DESCRIPTION :Gráficos originales de Transport Tycoon Deluxe, versión DOS (Alemán).
STR_BASEGRAPHICS_WIN_DESCRIPTION :Gráficos originales de Transport Tycoon Deluxe, versión Windows.
STR_BASESOUNDS_DOS_DESCRIPTION :Sonidos originales de Transport Tycoon Deluxe, versión DOS.
STR_BASESOUNDS_WIN_DESCRIPTION :Sonidos originales de Transport Tycoon Deluxe, versión Windows.
STR_BASESOUNDS_NONE_DESCRIPTION :Un conjunto de sonidos vacío.
STR_BASEMUSIC_WIN_DESCRIPTION :Música original de Transport Tycoon Deluxe versión Windows.
STR_BASEMUSIC_WIN_DESCRIPTION :Música original de Transport Tycoon Deluxe, versión Windows.
STR_BASEMUSIC_DOS_DESCRIPTION :Música original de Transport Tycoon Deluxe, versión DOS.
STR_BASEMUSIC_TTO_DESCRIPTION :Música original de Transport Tycoon (Original/Editor de Mundos), versión DOS.
STR_BASEMUSIC_NONE_DESCRIPTION :Un conjunto de música vacío.
##id 0x2000

@ -22,13 +22,9 @@
#include "../debug.h"
#include "../base_media_base.h"
#define Rect OTTDRect
#define Point OTTDPoint
#include <CoreServices/CoreServices.h>
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>
#undef Rect
#undef Point
#include "../safeguards.h"

@ -0,0 +1,450 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file string_osx.cpp Functions related to localized text support on OSX. */
#include "../../stdafx.h"
#include "string_osx.h"
#include "../../string_func.h"
#include "../../strings_func.h"
#include "../../table/control_codes.h"
#include "../../fontcache.h"
#include "macos.h"
#include <CoreFoundation/CoreFoundation.h>
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
/** Cached current locale. */
static CFLocaleRef _osx_locale = NULL;
/** CoreText cache for font information, cleared when OTTD changes fonts. */
static CTFontRef _font_cache[FS_END];
/**
* Wrapper for doing layouts with CoreText.
*/
class CoreTextParagraphLayout : public ParagraphLayouter {
private:
const CoreTextParagraphLayoutFactory::CharType *text_buffer;
ptrdiff_t length;
const FontMap& font_map;
CTTypesetterRef typesetter;
CFIndex cur_offset = 0; ///< Offset from the start of the current run from where to output.
public:
/** Visual run contains data about the bit of text with the same font. */
class CoreTextVisualRun : public ParagraphLayouter::VisualRun {
private:
std::vector<GlyphID> glyphs;
std::vector<float> positions;
std::vector<int> glyph_to_char;
int total_advance = 0;
Font *font;
public:
CoreTextVisualRun(CTRunRef run, Font *font, const CoreTextParagraphLayoutFactory::CharType *buff);
virtual const GlyphID *GetGlyphs() const { return &this->glyphs[0]; }
virtual const float *GetPositions() const { return &this->positions[0]; }
virtual const int *GetGlyphToCharMap() const { return &this->glyph_to_char[0]; }
virtual const Font *GetFont() const { return this->font; }
virtual int GetLeading() const { return this->font->fc->GetHeight(); }
virtual int GetGlyphCount() const { return (int)this->glyphs.size(); }
int GetAdvance() const { return this->total_advance; }
};
/** A single line worth of VisualRuns. */
class CoreTextLine : public AutoDeleteSmallVector<CoreTextVisualRun *, 4>, public ParagraphLayouter::Line {
public:
CoreTextLine(CTLineRef line, const FontMap &fontMapping, const CoreTextParagraphLayoutFactory::CharType *buff)
{
CFArrayRef runs = CTLineGetGlyphRuns(line);
for (CFIndex i = 0; i < CFArrayGetCount(runs); i++) {
CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, i);
/* Extract font information for this run. */
CFRange chars = CTRunGetStringRange(run);
FontMap::const_iterator map = fontMapping.Begin();
while (map < fontMapping.End() - 1 && map->first <= chars.location) map++;
*this->Append() = new CoreTextVisualRun(run, map->second, buff);
}
CFRelease(line);
}
virtual int GetLeading() const;
virtual int GetWidth() const;
virtual int CountRuns() const { return this->Length(); }
virtual const VisualRun *GetVisualRun(int run) const { return *this->Get(run); }
int GetInternalCharLength(WChar c) const
{
/* CoreText uses UTF-16 internally which means we need to account for surrogate pairs. */
return c >= 0x010000U ? 2 : 1;
}
};
CoreTextParagraphLayout(CTTypesetterRef typesetter, const CoreTextParagraphLayoutFactory::CharType *buffer, ptrdiff_t len, const FontMap &fontMapping) : text_buffer(buffer), length(len), font_map(fontMapping), typesetter(typesetter)
{
this->Reflow();
}
virtual ~CoreTextParagraphLayout()
{
CFRelease(this->typesetter);
}
virtual void Reflow()
{
this->cur_offset = 0;
}
virtual const Line *NextLine(int max_width);
};
/** Get the width of an encoded sprite font character. */
static CGFloat SpriteFontGetWidth(void *ref_con)
{
FontSize fs = (FontSize)((size_t)ref_con >> 24);
WChar c = (WChar)((size_t)ref_con & 0xFFFFFF);
return GetGlyphWidth(fs, c);
}
static CTRunDelegateCallbacks _sprite_font_callback = {
kCTRunDelegateCurrentVersion, NULL, NULL, NULL,
&SpriteFontGetWidth
};
/* static */ ParagraphLayouter *CoreTextParagraphLayoutFactory::GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping)
{
if (!MacOSVersionIsAtLeast(10, 5, 0)) return NULL;
/* Can't layout an empty string. */
ptrdiff_t length = buff_end - buff;
if (length == 0) return NULL;
/* Can't layout our in-built sprite fonts. */
for (FontMap::const_iterator i = fontMapping.Begin(); i != fontMapping.End(); i++) {
if (i->second->fc->IsBuiltInFont()) return NULL;
}
/* Make attributed string with embedded font information. */
CFMutableAttributedStringRef str = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
CFAttributedStringBeginEditing(str);
CFStringRef base = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buff, length, kCFAllocatorNull);
CFAttributedStringReplaceString(str, CFRangeMake(0, 0), base);
CFRelease(base);
/* Apply font and colour ranges to our string. This is important to make sure
* that we get proper glyph boundaries on style changes. */
int last = 0;
for (FontMap::const_iterator i = fontMapping.Begin(); i != fontMapping.End(); i++) {
if (i->first - last == 0) continue;
if (_font_cache[i->second->fc->GetSize()] == NULL) {
/* Cache font information. */
CFStringRef font_name = CFStringCreateWithCString(kCFAllocatorDefault, i->second->fc->GetFontName(), kCFStringEncodingUTF8);
_font_cache[i->second->fc->GetSize()] = CTFontCreateWithName(font_name, i->second->fc->GetFontSize(), NULL);
CFRelease(font_name);
}
CFAttributedStringSetAttribute(str, CFRangeMake(last, i->first - last), kCTFontAttributeName, _font_cache[i->second->fc->GetSize()]);
CGColorRef color = CGColorCreateGenericGray((uint8)i->second->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
CFAttributedStringSetAttribute(str, CFRangeMake(last, i->first - last), kCTForegroundColorAttributeName, color);
CGColorRelease(color);
/* Install a size callback for our special sprite glyphs. */
for (ssize_t c = last; c < i->first; c++) {
if (buff[c] >= SCC_SPRITE_START && buff[c] <= SCC_SPRITE_END) {
CTRunDelegateRef del = CTRunDelegateCreate(&_sprite_font_callback, (void *)(size_t)(buff[c] | (i->second->fc->GetSize() << 24)));
CFAttributedStringSetAttribute(str, CFRangeMake(c, 1), kCTRunDelegateAttributeName, del);
CFRelease(del);
}
}
last = i->first;
}
CFAttributedStringEndEditing(str);
/* Create and return typesetter for the string. */
CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedString(str);
CFRelease(str);
return typesetter != NULL ? new CoreTextParagraphLayout(typesetter, buff, length, fontMapping) : NULL;
}
/* virtual */ const CoreTextParagraphLayout::Line *CoreTextParagraphLayout::NextLine(int max_width)
{
if (this->cur_offset >= this->length) return NULL;
/* Get line break position, trying word breaking first and breaking somewhere if that doesn't work. */
CFIndex len = CTTypesetterSuggestLineBreak(this->typesetter, this->cur_offset, max_width);
if (len <= 0) len = CTTypesetterSuggestClusterBreak(this->typesetter, this->cur_offset, max_width);
/* Create line. */
CTLineRef line = CTTypesetterCreateLine(this->typesetter, CFRangeMake(this->cur_offset, len));
this->cur_offset += len;
return line != NULL ? new CoreTextLine(line, this->font_map, this->text_buffer) : NULL;
}
CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font *font, const CoreTextParagraphLayoutFactory::CharType *buff) : font(font)
{
this->glyphs.resize(CTRunGetGlyphCount(run));
/* Query map of glyphs to source string index. */
CFIndex map[this->glyphs.size()];
CTRunGetStringIndices(run, CFRangeMake(0, 0), map);
this->glyph_to_char.resize(this->glyphs.size());
for (size_t i = 0; i < this->glyph_to_char.size(); i++) this->glyph_to_char[i] = (int)map[i];
CGPoint pts[this->glyphs.size()];
CTRunGetPositions(run, CFRangeMake(0, 0), pts);
this->positions.resize(this->glyphs.size() * 2 + 2);
/* Convert glyph array to our data type. At the same time, substitute
* the proper glyphs for our private sprite glyphs. */
CGGlyph gl[this->glyphs.size()];
CTRunGetGlyphs(run, CFRangeMake(0, 0), gl);
for (size_t i = 0; i < this->glyphs.size(); i++) {
if (buff[this->glyph_to_char[i]] >= SCC_SPRITE_START && buff[this->glyph_to_char[i]] <= SCC_SPRITE_END) {
this->glyphs[i] = font->fc->MapCharToGlyph(buff[this->glyph_to_char[i]]);
this->positions[i * 2 + 0] = pts[i].x;
this->positions[i * 2 + 1] = font->fc->GetAscender() - font->fc->GetGlyph(this->glyphs[i])->height - 1; // Align sprite glyphs to font baseline.
} else {
this->glyphs[i] = gl[i];
this->positions[i * 2 + 0] = pts[i].x;
this->positions[i * 2 + 1] = pts[i].y;
}
}
this->total_advance = (int)CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL);
this->positions[this->glyphs.size() * 2] = this->positions[0] + this->total_advance;
}
/**
* Get the height of the line.
* @return The maximum height of the line.
*/
int CoreTextParagraphLayout::CoreTextLine::GetLeading() const
{
int leading = 0;
for (const CoreTextVisualRun * const *run = this->Begin(); run != this->End(); run++) {
leading = max(leading, (*run)->GetLeading());
}
return leading;
}
/**
* Get the width of this line.
* @return The width of the line.
*/
int CoreTextParagraphLayout::CoreTextLine::GetWidth() const
{
if (this->Length() == 0) return 0;
int total_width = 0;
for (const CoreTextVisualRun * const *run = this->Begin(); run != this->End(); run++) {
total_width += (*run)->GetAdvance();
}
return total_width;
}
/** Delete CoreText font reference for a specific font size. */
void MacOSResetScriptCache(FontSize size)
{
if (_font_cache[size] != NULL) {
CFRelease(_font_cache[size]);
_font_cache[size] = NULL;
}
}
/** Store current language locale as a CoreFounation locale. */
void MacOSSetCurrentLocaleName(const char *iso_code)
{
if (!MacOSVersionIsAtLeast(10, 5, 0)) return;
if (_osx_locale != NULL) CFRelease(_osx_locale);
CFStringRef iso = CFStringCreateWithCString(kCFAllocatorNull, iso_code, kCFStringEncodingUTF8);
_osx_locale = CFLocaleCreate(kCFAllocatorDefault, iso);
CFRelease(iso);
}
/**
* Compares two strings using case insensitive natural sort.
*
* @param s1 First string to compare.
* @param s2 Second string to compare.
* @return 1 if s1 < s2, 2 if s1 == s2, 3 if s1 > s2, or 0 if not supported by the OS.
*/
int MacOSStringCompare(const char *s1, const char *s2)
{
static bool supported = MacOSVersionIsAtLeast(10, 5, 0);
if (!supported) return 0;
CFStringCompareFlags flags = kCFCompareCaseInsensitive | kCFCompareNumerically | kCFCompareLocalized | kCFCompareWidthInsensitive | kCFCompareForcedOrdering;
CFStringRef cf1 = CFStringCreateWithCString(kCFAllocatorDefault, s1, kCFStringEncodingUTF8);
CFStringRef cf2 = CFStringCreateWithCString(kCFAllocatorDefault, s2, kCFStringEncodingUTF8);
CFComparisonResult res = CFStringCompareWithOptionsAndLocale(cf1, cf2, CFRangeMake(0, CFStringGetLength(cf1)), flags, _osx_locale);
CFRelease(cf1);
CFRelease(cf2);
return (int)res + 2;
}
/* virtual */ void OSXStringIterator::SetString(const char *s)
{
const char *string_base = s;
this->utf16_to_utf8.clear();
this->str_info.clear();
this->cur_pos = 0;
/* CoreText operates on UTF-16, thus we have to convert the input string.
* To be able to return proper offsets, we have to create a mapping at the same time. */
std::vector<UniChar> utf16_str; ///< UTF-16 copy of the string.
while (*s != '\0') {
size_t idx = s - string_base;
WChar c = Utf8Consume(&s);
if (c < 0x10000) {
utf16_str.push_back((UniChar)c);
} else {
/* Make a surrogate pair. */
utf16_str.push_back((UniChar)(0xD800 + ((c - 0x10000) >> 10)));
utf16_str.push_back((UniChar)(0xDC00 + ((c - 0x10000) & 0x3FF)));
this->utf16_to_utf8.push_back(idx);
}
this->utf16_to_utf8.push_back(idx);
}
this->utf16_to_utf8.push_back(s - string_base);
/* Query CoreText for word and cluster break information. */
this->str_info.resize(utf16_to_utf8.size());
if (utf16_str.size() > 0) {
CFStringRef str = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, &utf16_str[0], utf16_str.size(), kCFAllocatorNull);
/* Get cluster breaks. */
for (CFIndex i = 0; i < CFStringGetLength(str); ) {
CFRange r = CFStringGetRangeOfComposedCharactersAtIndex(str, i);
this->str_info[r.location].char_stop = true;
i += r.length;
}
/* Get word breaks. */
CFStringTokenizerRef tokenizer = CFStringTokenizerCreate(kCFAllocatorDefault, str, CFRangeMake(0, CFStringGetLength(str)), kCFStringTokenizerUnitWordBoundary, _osx_locale);
CFStringTokenizerTokenType tokenType = kCFStringTokenizerTokenNone;
while ((tokenType = CFStringTokenizerAdvanceToNextToken(tokenizer)) != kCFStringTokenizerTokenNone) {
/* Skip tokens that are white-space or punctuation tokens. */
if ((tokenType & kCFStringTokenizerTokenHasNonLettersMask) != kCFStringTokenizerTokenHasNonLettersMask) {
CFRange r = CFStringTokenizerGetCurrentTokenRange(tokenizer);
this->str_info[r.location].word_stop = true;
}
}
CFRelease(tokenizer);
CFRelease(str);
}
/* End-of-string is always a valid stopping point. */
this->str_info.back().char_stop = true;
this->str_info.back().word_stop = true;
}
/* virtual */ size_t OSXStringIterator::SetCurPosition(size_t pos)
{
/* Convert incoming position to an UTF-16 string index. */
size_t utf16_pos = 0;
for (size_t i = 0; i < this->utf16_to_utf8.size(); i++) {
if (this->utf16_to_utf8[i] == pos) {
utf16_pos = i;
break;
}
}
/* Sanitize in case we get a position inside a grapheme cluster. */
while (utf16_pos > 0 && !this->str_info[utf16_pos].char_stop) utf16_pos--;
this->cur_pos = utf16_pos;
return this->utf16_to_utf8[this->cur_pos];
}
/* virtual */ size_t OSXStringIterator::Next(IterType what)
{
assert(this->cur_pos <= this->utf16_to_utf8.size());
assert(what == StringIterator::ITER_CHARACTER || what == StringIterator::ITER_WORD);
if (this->cur_pos == this->utf16_to_utf8.size()) return END;
do {
this->cur_pos++;
} while (this->cur_pos < this->utf16_to_utf8.size() && (what == ITER_WORD ? !this->str_info[this->cur_pos].word_stop : !this->str_info[this->cur_pos].char_stop));
return this->cur_pos == this->utf16_to_utf8.size() ? END : this->utf16_to_utf8[this->cur_pos];
}
/* virtual */ size_t OSXStringIterator::Prev(IterType what)
{
assert(this->cur_pos <= this->utf16_to_utf8.size());
assert(what == StringIterator::ITER_CHARACTER || what == StringIterator::ITER_WORD);
if (this->cur_pos == 0) return END;
do {
this->cur_pos--;
} while (this->cur_pos > 0 && (what == ITER_WORD ? !this->str_info[this->cur_pos].word_stop : !this->str_info[this->cur_pos].char_stop));
return this->utf16_to_utf8[this->cur_pos];
}
/* static */ StringIterator *OSXStringIterator::Create()
{
if (!MacOSVersionIsAtLeast(10, 5, 0)) return NULL;
return new OSXStringIterator();
}
#else
void MacOSResetScriptCache(FontSize size) {}
void MacOSSetCurrentLocaleName(const char *iso_code) {}
int MacOSStringCompare(const char *s1, const char *s2)
{
return 0;
}
/* static */ StringIterator *OSXStringIterator::Create()
{
return NULL;
}
/* static */ ParagraphLayouter *CoreTextParagraphLayoutFactory::GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping)
{
return NULL;
}
#endif /* (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) */

@ -0,0 +1,90 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file string_osx.h Functions related to localized text support on OSX. */
#ifndef STRING_OSX_H
#define STRING_OSX_H
#include "../../gfx_layout.h"
#include "../../string_base.h"
#include <vector>
/** String iterator using CoreText as a backend. */
class OSXStringIterator : public StringIterator {
/** Break info for a character. */
struct CharInfo {
bool word_stop : 1; ///< Code point is suitable as a word break.
bool char_stop : 1; ///< Code point is the start of a grapheme cluster, i.e. a "character".
};
std::vector<CharInfo> str_info; ///< Break information for each code point.
std::vector<size_t> utf16_to_utf8; ///< Mapping from UTF-16 code point position to index in the UTF-8 source string.
size_t cur_pos; ///< Current iteration position.
public:
virtual void SetString(const char *s);
virtual size_t SetCurPosition(size_t pos);
virtual size_t Next(IterType what);
virtual size_t Prev(IterType what);
static StringIterator *Create();
};
/**
* Helper class to construct a new #CoreTextParagraphLayout.
*/
class CoreTextParagraphLayoutFactory {
public:
/** Helper for GetLayouter, to get the right type. */
typedef UniChar CharType;
/** Helper for GetLayouter, to get whether the layouter supports RTL. */
static const bool SUPPORTS_RTL = true;
/**
* Get the actual ParagraphLayout for the given buffer.
* @param buff The begin of the buffer.
* @param buff_end The location after the last element in the buffer.
* @param fontMapping THe mapping of the fonts.
* @return The ParagraphLayout instance.
*/
static ParagraphLayouter *GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping);
/**
* Append a wide character to the internal buffer.
* @param buff The buffer to append to.
* @param buffer_last The end of the buffer.
* @param c The character to add.
* @return The number of buffer spaces that were used.
*/
static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, WChar c)
{
if (c >= 0x010000U) {
/* Character is encoded using surrogates in UTF-16. */
if (buff + 1 <= buffer_last) {
buff[0] = (CharType)(((c - 0x010000U) >> 10) + 0xD800);
buff[1] = (CharType)(((c - 0x010000U) & 0x3FF) + 0xDC00);
} else {
/* Not enough space in buffer. */
*buff = 0;
}
return 2;
} else {
*buff = (CharType)(c & 0xFFFF);
return 1;
}
}
};
void MacOSResetScriptCache(FontSize size);
void MacOSSetCurrentLocaleName(const char *iso_code);
int MacOSStringCompare(const char *s1, const char *s2);
#endif /* STRING_OSX_H */

@ -195,6 +195,7 @@ static bool UniscribeShapeRun(const UniscribeParagraphLayoutFactory::CharType *b
for (int i = 0; i < range.len; i++) {
if (buff[range.pos + i] >= SCC_SPRITE_START && buff[range.pos + i] <= SCC_SPRITE_END) {
range.ft_glyphs[range.char_to_glyph[i]] = range.font->fc->MapCharToGlyph(buff[range.pos + i]);
range.offsets[range.char_to_glyph[i]].dv = range.font->fc->GetAscender() - range.font->fc->GetGlyph(range.ft_glyphs[range.char_to_glyph[i]])->height - 1; // Align sprite glyphs to font baseline.
}
}

@ -363,7 +363,7 @@ private:
class ScriptEventCompanyAskMerger : public ScriptEvent {
public:
/**
* @param owner The company that can be bough.
* @param owner The company that can be bought.
* @param value The value/costs of buying the company.
*/
ScriptEventCompanyAskMerger(Owner owner, int32 value) :

@ -33,6 +33,10 @@
#include "os/windows/string_uniscribe.h"
#endif
#if defined(WITH_COCOA)
#include "os/macosx/string_osx.h"
#endif
#ifdef WITH_ICU_SORT
/* Required by strnatcmp. */
#include <unicode/ustring.h>
@ -679,6 +683,11 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
if (res != 0) return res - 2; // Convert to normal C return values.
#endif
#if defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN)
int res = MacOSStringCompare(s1, s2);
if (res != 0) return res - 2; // Convert to normal C return values.
#endif
/* Do a manual natural sort comparison if ICU is missing or if we cannot create a collator. */
return _strnatcmpIntl(s1, s2);
}
@ -951,9 +960,19 @@ public:
}
};
#if defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN)
/* static */ StringIterator *StringIterator::Create()
{
StringIterator *i = OSXStringIterator::Create();
if (i != NULL) return i;
return new DefaultStringIterator();
}
#else
/* static */ StringIterator *StringIterator::Create()
{
return new DefaultStringIterator();
}
#endif /* defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN) */
#endif

@ -2051,6 +2051,11 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
Win32SetCurrentLocaleName(_current_language->isocode);
#endif
#ifdef WITH_COCOA
extern void MacOSSetCurrentLocaleName(const char *iso_code);
MacOSSetCurrentLocaleName(_current_language->isocode);
#endif
#ifdef WITH_ICU_SORT
/* Delete previous collator. */
if (_current_collator != NULL) {
@ -2394,7 +2399,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
/* Update the font with cache */
LoadStringWidthTable(searcher->Monospace());
#if !defined(WITH_ICU_LAYOUT) && !defined(WITH_UNISCRIBE)
#if !defined(WITH_ICU_LAYOUT) && !defined(WITH_UNISCRIBE) && !defined(WITH_COCOA)
/*
* For right-to-left languages we need the ICU library. If
* we do not have support for that library we warn the user

Loading…
Cancel
Save