mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-15 18:49:10 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
89f9c9ce20 | ||
|
b6834cf135 | ||
|
a1fb44c417 | ||
|
c607e6cb37 | ||
|
49ac7c9338 | ||
|
b4ba357017 | ||
|
e4b45169c1 | ||
|
d8c4ed5118 | ||
|
7b6e449f15 | ||
|
072270f9b9 | ||
|
9360409b4e |
@@ -1,3 +1,40 @@
|
||||
0.7.4 (2009-12-01)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: Endianness issue with saving the zoom level [FS#3333] (r18351)
|
||||
- Fix: [NewGRF] When starting a new game the values of action D variable 13 were incorrect [FS#3324] (r18207)
|
||||
|
||||
|
||||
0.7.4-RC1 (2009-11-15)
|
||||
------------------------------------------------------------------------
|
||||
- Change: Prefer extmidi over allegro midi and allegro over null driver [FS#3272] (r17875)
|
||||
- Change: [NewGRF] Apply default refitmasks only when the NewGRF did not set any of the three refittability properties (xor mask, positive classes, negative classes) (r17663)
|
||||
- Fix: Crash when an articulated RV is turning on a drive through road station that gets forcefully (bankrupt) removed [FS#3310] (r18049)
|
||||
- Fix: GCC 4.5 compiling (r18045)
|
||||
- Fix: AIs failed to load their data from savegames by crashing them when they tried [FS#3290] (r18038)
|
||||
- Fix: Screen jumped a bit for at least SDL and Allegro when right-click-dragging (r18030)
|
||||
- Fix: [NewGRF] Improve parsing of RIFF data. Skip unknown chunks and check chunk sizes (r17999)
|
||||
- Fix: When you start giving money (input window for amount), then get moved to spectators and you click 'Ok' a crash would occur (r17953)
|
||||
- Fix: Use 24bpp BMP format instead of 32bpp for screenshots. Saves space and is supported by more image viewers (r17943)
|
||||
- Fix: Close BMP file when making screenshot fails (r17941)
|
||||
- Fix: Deadlock when trying to create screenshot with too long name (including path) (r17936)
|
||||
- Fix: Crash when closing NewGRF parameter window with no NewGRF selected [FS#3291] (r17922)
|
||||
- Fix: 32bpp BMP screenshots were in wrong colours on big endian machines and broken when screen width was not a multiple of 4 (r17910, r17909)
|
||||
- Fix: Uninitialised values in some paths of loading TTO savegames [FS#3288] (r17908)
|
||||
- Fix: Make the plane speed setting unchangeable in network games because it can be read by NewGRFs on game load and thus if it changes cause desyncs (r17902)
|
||||
- Fix: [NewGRF] 'subtract-in' is also signed for production callback version 0 (r17857)
|
||||
- Fix: [NewGRF] _date_fract runs from 0 to 73 since r2041. Variable 0x09 should not (r17824)
|
||||
- Fix: Do not fail hard when no soundcard could be detected; just fall back on the null-driver [FS#3268] (r17788)
|
||||
- Fix: CJK languages do not have spaces, so for adding newlines (multi line strings) we need to (properly) handle the case when there are no spaces instead of truncating the string [FS#3264] (r17772)
|
||||
- Fix: Powernaut Helicopter got wrong 'load amount' (r17758)
|
||||
- Fix: [NewGRF] 'last_value' and 'reseed' are shared between procedure and main chain, 'scope' and 'count' are not (r17672)
|
||||
- Fix: Count only active clients (not those waiting for map download) when checking min_active_clients limit (r16506)
|
||||
|
||||
|
||||
0.7.3 (2009-10-01)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: [NewGRF] Crash when trying to build an industry that has no industry layout defined [FS#3233] (r17638, r17633)
|
||||
|
||||
|
||||
0.7.3-RC2 (2009-09-24)
|
||||
------------------------------------------------------------------------
|
||||
- Update: Documentation about bug reporting and known bugs (r17554)
|
||||
@@ -9,12 +46,12 @@
|
||||
- Fix: Assertion triggered when the second vehicle in a 101+ (or 11+ if mammoth trains is disabled) vehicle free wagon chain is an engine and the first vehicle is moved to another chain [FS#3208] (r17576)
|
||||
- Fix: [NewGRF] Memory leak when viewing the NewGRF settings of a server (r17563)
|
||||
- Fix: [NewGRF] The NewGRF settings of (remote) network games did not get properly updated when the NewGRFs were rescanned causing reading of freed data [FS#2972] (r17562)
|
||||
- Fix: [NewGRF] Close the "Add NewGRF" window when you close the "NewGRF Settings" window. The add window has a pointer to the settings which means that not deleting it would cause dereferencing an already freed pointer [FS#3206] (r17559)
|
||||
- Fix: [NewGRF] Close the 'Add NewGRF' window when you close the 'NewGRF Settings' window. The add window has a pointer to the settings which means that not deleting it would cause dereferencing an already freed pointer [FS#3206] (r17559)
|
||||
- Fix: Vehicles waiting for their time table did not load anymore after their initial load was completed [FS#3201] (r17551)
|
||||
- Fix: Aircraft were given an unfair advantage in station rating calculations (r17550)
|
||||
- Fix: [NewGRF] Sign extending of profit calculation did not work (r17546)
|
||||
- Fix: [NoAI] AIs had "infinite" time when running code from the global scope [FS#3202] (r17545)
|
||||
- Fix: [NoAI] Crash when doing commands in the "global" scope [FS#3202] (r17544)
|
||||
- Fix: [NoAI] AIs had 'infinite' time when running code from the global scope [FS#3202] (r17545)
|
||||
- Fix: [NoAI] Crash when doing commands in the 'global' scope [FS#3202] (r17544)
|
||||
|
||||
|
||||
0.7.3-RC1 (2009-09-13)
|
||||
|
21
config.lib
21
config.lib
@@ -5,7 +5,7 @@ log() {
|
||||
}
|
||||
|
||||
set_default() {
|
||||
released_version="0.7.3-RC2"
|
||||
released_version="0.7.4"
|
||||
|
||||
ignore_extra_parameters="0"
|
||||
# We set all kinds of defaults for params. Later on the user can override
|
||||
@@ -47,8 +47,8 @@ set_default() {
|
||||
enable_static="1"
|
||||
enable_translator="0"
|
||||
enable_unicode="1"
|
||||
enable_assert="1"
|
||||
enable_strip="0"
|
||||
enable_assert="0"
|
||||
enable_strip="1"
|
||||
enable_universal="1"
|
||||
enable_osx_g5="0"
|
||||
enable_cocoa_quartz="1"
|
||||
@@ -71,6 +71,7 @@ set_default() {
|
||||
with_freetype="1"
|
||||
with_fontconfig="1"
|
||||
with_icu="1"
|
||||
static_icu="0"
|
||||
with_psp_config="1"
|
||||
with_threads="1"
|
||||
with_distcc="1"
|
||||
@@ -137,6 +138,7 @@ set_default() {
|
||||
with_freetype
|
||||
with_fontconfig
|
||||
with_icu
|
||||
static_icu
|
||||
with_psp_config
|
||||
with_threads
|
||||
with_distcc
|
||||
@@ -334,6 +336,10 @@ detect_params() {
|
||||
--with-libicu) with_icu="2";;
|
||||
--without-libicu) with_icu="0";;
|
||||
--with-libicu=*) with_icu="$optarg";;
|
||||
--static-icu) static_icu="1";;
|
||||
--static-icu=*) static_icu="$optarg";;
|
||||
--static-libicu) static_icu="1";;
|
||||
--static-libicu=*) static_icu="$optarg";;
|
||||
|
||||
--with-psp-config) with_psp_config="2";;
|
||||
--without-psp-config) with_psp_config="0";;
|
||||
@@ -1302,7 +1308,11 @@ make_cflags_and_ldflags() {
|
||||
CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
|
||||
|
||||
# Some icu-configs have the 'feature' of not adding a space where others do add the space
|
||||
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
|
||||
if [ "$static_icu" != "0" ]; then
|
||||
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' ' | sed s/licu/lsicu/g`"
|
||||
else
|
||||
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -1799,6 +1809,7 @@ detect_os() {
|
||||
/cygwin/ { print "CYGWIN"; exit}
|
||||
/mingw/ { print "MINGW"; exit}
|
||||
/os\/2/ { print "OS2"; exit}
|
||||
/gnu/ { print "UNIX"; exit}
|
||||
'`
|
||||
fi
|
||||
|
||||
@@ -2844,6 +2855,8 @@ showhelp() {
|
||||
echo " --with-fontconfig[=pkg-config fontconfig]"
|
||||
echo " enables fontconfig support"
|
||||
echo " --with-icu[=icu-config] enables icu (used for right-to-left support)"
|
||||
echo " --static-icu try to link statically (libsicu instead of"
|
||||
echo " libicu; can fail as the new name is guessed)"
|
||||
echo " --with-iconv[=iconv-path] enables iconv support"
|
||||
echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
|
||||
echo " --with-makedepend[=makedepend] enables makedepend support"
|
||||
|
101
known-bugs.txt
101
known-bugs.txt
@@ -1,6 +1,6 @@
|
||||
OpenTTD's known bugs
|
||||
Last updated: 2009-08-18
|
||||
Release version: 0.7.2
|
||||
Last updated: 2009-12-01
|
||||
Release version: 0.7.4
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -34,23 +34,25 @@ that you can find at: http://bugs.openttd.org
|
||||
If the bugs are closed but still listed here it means that the bug is fixed
|
||||
and that the nightlies and next major release will not have that bug.
|
||||
|
||||
- 3198 [OSX] "Could not get system colour space" error on some Mac OS X 10.6
|
||||
- 3194 [OSX] Full screen 'strobing' on some Mac OS X 10.6
|
||||
- 3190 [OSX] Compiling fails on some Mac OS X 10.6
|
||||
- 3159 [NewGRF] Autoreplace resets (or does not keep) value of variable F2
|
||||
- 3057 Road vehicle sometimes 'forget' the need for servicing
|
||||
- 3040 Not all alternatives are always shown in the "Join station" list
|
||||
- 2955 With path signals depots are less likely to be visited
|
||||
- 2891 Ignore signal does not keep the train running when in path signalled block till the next signal
|
||||
- 2769 No offer for buying bankrupt AIs
|
||||
- 2737 Self-crossing trains ignore "forbid 90 degree turn" setting
|
||||
- 2616 Cloning creates vehicles with invalid subcargos
|
||||
- 2616 [NewGRF] Cloning creates vehicles with invalid subcargos
|
||||
- 2613 [NewGRF] House property 15 does not work
|
||||
- 2585 [OSX] OS' mouse pointer showing
|
||||
- 2484 [OSX] Cannot enter CJK characters
|
||||
- 2427 Vehicle owner gets paid for whole cargo feeder share
|
||||
- 1944 Road vehicles not picking empty drivethrough platform
|
||||
- 1762 Strange Autoreplace behaviour
|
||||
- 1495 Long vehicles might block multistop drivethrough stations
|
||||
- 1473 Lost trains ignore exit signals
|
||||
- 1140 [OSX] Not smooth moving map with touchpad
|
||||
- 1072 Text overflows in several windows
|
||||
- 119 Clipping problems with vehicles on slopes
|
||||
|
||||
|
||||
3) Known bugs that will not be solved:
|
||||
@@ -60,7 +62,18 @@ 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.
|
||||
|
||||
Clipping problems
|
||||
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: you must change the settings so no AI is started,
|
||||
this is done in the difficulty 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 via
|
||||
"AI Settings" -> "Select AI" -> "Check Online Content" which is also
|
||||
accessed via the main menu.
|
||||
|
||||
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.
|
||||
@@ -78,7 +91,34 @@ Clipping problems
|
||||
leave the Transport Tycoon graphics, which in effect means OpenTTD
|
||||
will not be a Transport Tycoon clone anymore.
|
||||
|
||||
Duplicate (station) names after renaming
|
||||
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.
|
||||
|
||||
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.
|
||||
@@ -94,29 +134,24 @@ Duplicate (station) names after renaming
|
||||
compared to the other custom names in the same class and not compared
|
||||
to the automatically generated names.
|
||||
|
||||
Forbid 90 degree turns does not work for crossing PBS paths
|
||||
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.
|
||||
Extreme CPU usage/hangs when using SDL and PulseAudio [FS#3294]
|
||||
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 setup seems to be the default configuration for
|
||||
Ubuntu 9.04 and later. For Ubuntu this issue can be solved by
|
||||
installing the 'libsdl1.2debian-pulseaudio' package from Ubuntu's
|
||||
Universe repository. For other distributions a similar package needs
|
||||
to be installed.
|
||||
|
||||
Lost trains ignore (block) exit signals
|
||||
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.
|
||||
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.
|
||||
|
@@ -1,3 +1,21 @@
|
||||
openttd (0.7.4) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 01 Dec 2009 01:23:45 +0100
|
||||
|
||||
openttd (0.7.4~RC1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Sun, 15 Nov 2009 16:30:07 +0100
|
||||
|
||||
openttd (0.7.3) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 01 Oct 2009 12:35:47 +0200
|
||||
|
||||
openttd (0.7.3~RC2) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
Name: openttd
|
||||
Version: 0.7.3
|
||||
Version: 0.7.4
|
||||
Release: 1%{?dist}
|
||||
|
||||
Group: Amusements/Games
|
||||
@@ -24,10 +24,9 @@ Summary: OpenTTD is an Open Source clone of Chris Sawyer's Transport Tycoo
|
||||
Source: %{name}-%{version}-source.tar.bz2
|
||||
|
||||
Requires: fontconfig
|
||||
Requires: libicu
|
||||
Requires: libpng
|
||||
Requires: SDL
|
||||
Requires: zlib
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: fontconfig-devel
|
||||
BuildRequires: libpng-devel
|
||||
BuildRequires: libicu-devel
|
||||
@@ -38,33 +37,32 @@ BuildRequires: zlib-devel
|
||||
Requires: freetype
|
||||
BuildRequires: freetype-devel
|
||||
%endif
|
||||
%if %{_vendor}=="MandrakeSoft" || %{_vendor}=="mandriva"
|
||||
Requires: freetype2
|
||||
BuildRequires: libfreetype6-devel
|
||||
%endif
|
||||
%if %{_vendor}=="redhat" || %{_vendor}=="fedora"
|
||||
Requires: freetype
|
||||
BuildRequires: freetype-devel
|
||||
BuildRequires: desktop-file-utils
|
||||
%endif
|
||||
%if %{_vendor}=="suse"
|
||||
%if %{_vendor}=="suse" || %{_vendor}=="mandriva"
|
||||
Requires: freetype2
|
||||
BuildRequires: freetype2-devel
|
||||
%endif
|
||||
%if %{_vendor}=="suse"
|
||||
BuildRequires: update-desktop-files
|
||||
%endif
|
||||
|
||||
# recommends works for suse (not sles9) and mandriva, only
|
||||
%if 0%{?suse_version} > 910 || %{_vendor}=="mandriva"
|
||||
Recommends: opengfx
|
||||
# for 0.8.0
|
||||
#Recommends: opensfx
|
||||
%endif
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
|
||||
%description
|
||||
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
|
||||
with lots of new features and enhancements. To play the game you need to copy
|
||||
the following 6 data files from your Transport Tycoon Deluxe CD to the game
|
||||
data directory in %{_datadir}/games/%{name}/data:
|
||||
|
||||
From the Windows version of TTD you need:
|
||||
sample.cat trg1r.grf trgcr.grf trghr.grf trgir.grf trgtr.grf
|
||||
|
||||
Or if you have the DOS version you need:
|
||||
sample.cat TRG1.GRF TRGC.GRF TRGH.GRF TRGI.GRF TRGT.GRF
|
||||
with lots of new features and enhancements. To play the game you need either
|
||||
the original data from the game or install the recommend package OpenGFX.
|
||||
|
||||
OpenTTD is licensed under the GNU General Public License version 2.0. For more
|
||||
information, see the file 'COPYING' included with every release and source
|
||||
@@ -74,22 +72,29 @@ download of the game.
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
# suse sle <10 has no support for makedepend
|
||||
%if 0%{?sles_version} == 9 || 0%{?sles_version} == 10
|
||||
%define do_makedepend 0
|
||||
%else
|
||||
%define do_makedepend 1
|
||||
%endif
|
||||
./configure \
|
||||
--revision=%{version} \
|
||||
--prefix-dir="%{_prefix}" \
|
||||
--binary-dir="bin" \
|
||||
--binary-name="%{name}" \
|
||||
--enable-debug=0 \
|
||||
--with-sdl \
|
||||
--with-zlib \
|
||||
--with-png \
|
||||
--with-freetype \
|
||||
--with-fontconfig \
|
||||
--with-icu \
|
||||
--enable-strip \
|
||||
--binary-dir="bin" \
|
||||
--data-dir="share/%{name}" \
|
||||
--with-makedepend="%{do_makedepend}" \
|
||||
# --revision="%{ver}%{?prever:-%{prever}}" \
|
||||
# --enable-debug=0 \
|
||||
# --with-sdl \
|
||||
# --with-zlib \
|
||||
# --with-png \
|
||||
# --with-freetype \
|
||||
# --with-fontconfig \
|
||||
# --with-icu \
|
||||
# --menu_group="Game;" \
|
||||
# --menu-name="OpenTTD" \
|
||||
# --data-dir="share\games\%{name}" \
|
||||
# --doc-dir="share\doc\%{name}" \
|
||||
# --icon-dir="share/pixmaps" \
|
||||
# --icon-theme-dir="share/icons/hicolor" \
|
||||
@@ -99,7 +104,6 @@ download of the game.
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -rf "%{buildroot}"
|
||||
make install INSTALL_DIR="%{buildroot}"
|
||||
|
||||
# Validate menu entrys (vendor specific)
|
||||
@@ -111,13 +115,28 @@ desktop-file-install \
|
||||
"%{buildroot}/%{_datadir}/applications/%{name}.desktop" \
|
||||
# --delete-original
|
||||
%endif
|
||||
%if %{_vendor}=="suse"
|
||||
%__cat > %{name}.desktop << EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=OpenTTD
|
||||
Comment=OpenTTD - A clone of the Microprose game 'Transport Tycoon Deluxe'
|
||||
GenericName=OpenTTD
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Exec=%{name}
|
||||
Icon=%{name}
|
||||
Categories=Game;StrategyGame;
|
||||
EOF
|
||||
%suse_update_desktop_file -i %{name} Game StrategyGame
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf "%{buildroot}"
|
||||
#rm -rf "%{buildroot}"
|
||||
|
||||
%post
|
||||
# Update the icon cache (vendor specific)
|
||||
%if %{_vendor}=="MandrakeSoft" || %{_vendor}=="mandriva"
|
||||
%if %{_vendor}=="mandriva"
|
||||
%update_icon_cache hicolor
|
||||
%endif
|
||||
|
||||
@@ -130,7 +149,7 @@ fi
|
||||
|
||||
%postun
|
||||
# Update the icon cache (vendor specific)
|
||||
%if %{_vendor}=="MandrakeSoft" || %{_vendor}=="mandriva"
|
||||
%if %{_vendor}=="mandriva"
|
||||
%update_icon_cache hicolor
|
||||
%endif
|
||||
|
||||
@@ -144,38 +163,39 @@ fi
|
||||
%files
|
||||
%defattr(-, root, games, -)
|
||||
%dir %{_datadir}/doc/%{name}
|
||||
%dir %{_datadir}/games/%{name}
|
||||
%dir %{_datadir}/games/%{name}/lang
|
||||
%dir %{_datadir}/games/%{name}/data
|
||||
%dir %{_datadir}/games/%{name}/gm
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/lang
|
||||
%dir %{_datadir}/%{name}/data
|
||||
%dir %{_datadir}/%{name}/gm
|
||||
%dir %{_datadir}/%{name}/scripts
|
||||
%attr(755, root, games) %{_bindir}/%{name}
|
||||
%{_datadir}/doc/%{name}/*
|
||||
%{_datadir}/games/%{name}/lang/*
|
||||
%{_datadir}/games/%{name}/data/*
|
||||
%{_datadir}/games/%{name}/scripts/*
|
||||
%{_datadir}/%{name}/lang/*
|
||||
%{_datadir}/%{name}/data/*
|
||||
%{_datadir}/%{name}/scripts/*
|
||||
%{_datadir}/applications/*%{name}.desktop
|
||||
%{_datadir}/pixmaps/*
|
||||
%{_datadir}/icons/hicolor/*/apps/%{name}.png
|
||||
%doc %{_mandir}/man6/%{name}.6.gz
|
||||
%{_datadir}/icons/*
|
||||
%doc %{_mandir}/man6/%{name}.6.*
|
||||
|
||||
%changelog
|
||||
* Mon Oct 20 2008 Benedikt Brüggemeier <skidd13@openttd.org>
|
||||
* Sat Sep 26 2009 Marcel Gmür <ammler@openttdcoop.org> - 0.7.2
|
||||
- no subfolder games for datadir
|
||||
- cleanup: no post and postun anymore
|
||||
- Recommends: opengfx (for suse and mandriva)
|
||||
- add SUSE support
|
||||
|
||||
* Mon Oct 20 2008 Benedikt Brüggemeier <skidd13@openttd.org>
|
||||
- Added libicu dependency
|
||||
|
||||
* Thu Sep 23 2008 Benedikt Brüggemeier <skidd13@openttd.org>
|
||||
|
||||
- Merged both versions of the spec file
|
||||
|
||||
* Fri Aug 29 2008 Jonathan Coome <maedhros@openttd.org>
|
||||
|
||||
- Rewrite spec file from scratch.
|
||||
|
||||
* Sat Aug 02 2008 Benedikt Brüggemeier <skidd13@openttd.org>
|
||||
|
||||
- Updated spec file
|
||||
|
||||
* Thu Mar 27 2008 Denis Burlaka <burlaka@yandex.ru>
|
||||
|
||||
- Universal spec file
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
!define APPNAME "OpenTTD" ; Define application name
|
||||
!define APPVERSION "0.7.3-RC2" ; Define application version
|
||||
!define APPVERSIONINTERNAL "0.7.3.0" ; Define application version in X.X.X.X
|
||||
!define INSTALLERVERSION 67 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
|
||||
!define APPVERSION "0.7.4" ; Define application version
|
||||
!define APPVERSIONINTERNAL "0.7.4.0" ; Define application version in X.X.X.X
|
||||
!define INSTALLERVERSION 70 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
|
||||
!include ${VERSION_INCLUDE}
|
||||
|
||||
!define APPURLLINK "http://www.openttd.org"
|
||||
|
@@ -32,7 +32,7 @@ Sub UpdateFiles(version)
|
||||
modified = Mid(version, InStrRev(version, Chr(9)) + 1)
|
||||
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
|
||||
Else
|
||||
version = "0.7.3-RC2"
|
||||
version = "0.7.4"
|
||||
revision = 0
|
||||
modified = 1
|
||||
End If
|
||||
|
@@ -60,7 +60,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -273,7 +273,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
|
@@ -60,7 +60,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -273,7 +273,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
|
@@ -61,7 +61,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -271,7 +271,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
|
@@ -61,7 +61,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -271,7 +271,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;WITH_ICU;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
|
14
readme.txt
14
readme.txt
@@ -1,6 +1,6 @@
|
||||
OpenTTD README
|
||||
Last updated: 2009-08-18
|
||||
Release version: 0.7.2
|
||||
Last updated: 2009-12-01
|
||||
Release version: 0.7.4
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -175,6 +175,15 @@ If you want savegames and screenshots in the directory where the OpenTTD binary
|
||||
resides, simply have your config file in that location. But if you remove this
|
||||
config file, savegames will still be in this directory (see notes in section 4.2)
|
||||
|
||||
OpenTTD comes without AIs, so if you want to play with AIs you have to download
|
||||
them. The easiest way is via the "Check Online Content" button in the main menu.
|
||||
You can select some AIs that you think are compatible with your playing style.
|
||||
Another way is manually downloading the AIs from the forum although then you
|
||||
need to make sure that you install all the required AI libraries too; they get
|
||||
automatically selected (and downloaded) if you get the AIs via the "Check
|
||||
Online Content". If you do not have an AI but have configured OpenTTD to start
|
||||
an AI a message will be shown that the 'dummy' AI has been started.
|
||||
|
||||
4.1) (Required) 3rd party files:
|
||||
---- ---------------------------
|
||||
|
||||
@@ -489,6 +498,7 @@ put them in the data/ folder and you're set to go.
|
||||
X.X) Credits:
|
||||
---- --------
|
||||
The OpenTTD team (in alphabetical order):
|
||||
Albert Hofkamp (Alberth) - GUI expert
|
||||
Jean-Francois Claeys (Belugas) - GUI, newindustries and more
|
||||
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles
|
||||
Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework
|
||||
|
@@ -14,6 +14,10 @@
|
||||
* functions may still be available if you return an older API version
|
||||
* in GetAPIVersion() in info.nut.
|
||||
*
|
||||
* \b 0.7.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 0.7.3
|
||||
*
|
||||
* API additions:
|
||||
@@ -29,7 +33,7 @@
|
||||
* \li AIs are now killed when they execute a DoCommand or Sleep at a time
|
||||
* they are not allowed to do so.
|
||||
* \li When the API requests a string as parameter you can give every squirrel
|
||||
* type and it'll be converted to a string
|
||||
* type and it will be converted to a string
|
||||
* \li AIs can create subclasses of API classes and use API constants as part
|
||||
* of their own constants
|
||||
*
|
||||
|
@@ -163,20 +163,12 @@ public:
|
||||
/**
|
||||
* Memory release for a single class instance.
|
||||
* @param ptr the memory to free.
|
||||
* @param size the amount of allocated memory (unused).
|
||||
*
|
||||
* @warning The value of the \a size parameter can only be trusted for
|
||||
* classes that have their own (virtual) destructor method.
|
||||
*/
|
||||
FORCEINLINE void operator delete(void *ptr, size_t size) { free(ptr); }
|
||||
|
||||
/**
|
||||
* Memory release for an array of class instances.
|
||||
* @param ptr the memory to free.
|
||||
* @param size the amount of allocated memory (unused).
|
||||
*
|
||||
* @warning The value of the \a size parameter can only be trusted for
|
||||
* classes that have their own (virtual) destructor method.
|
||||
*/
|
||||
FORCEINLINE void operator delete[](void *ptr, size_t size) { free(ptr); }
|
||||
};
|
||||
|
@@ -27,9 +27,9 @@
|
||||
#endif
|
||||
#else /* NO_DEBUG_MESSAGES */
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define DEBUG(name, level, args...) if ((level == 0) || ( _debug_ ## name ## _level >= level)) debug(#name, args)
|
||||
#define DEBUG(name, level, args...) if (((level) == 0) || ( _debug_ ## name ## _level >= (level))) debug(#name, args)
|
||||
#else
|
||||
#define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__)
|
||||
#define DEBUG(name, level, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug(#name, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
extern int _debug_ai_level;
|
||||
|
@@ -50,6 +50,8 @@ const uint8 _engine_offsets[4] = {
|
||||
lengthof(_orig_rail_vehicle_info) + lengthof(_orig_road_vehicle_info) + lengthof(_orig_ship_vehicle_info),
|
||||
};
|
||||
|
||||
assert_compile(lengthof(_orig_rail_vehicle_info) + lengthof(_orig_road_vehicle_info) + lengthof(_orig_ship_vehicle_info) + lengthof(_orig_aircraft_vehicle_info) == lengthof(_orig_engine_info));
|
||||
|
||||
const uint EngineOverrideManager::NUM_DEFAULT_ENGINES = _engine_counts[VEH_TRAIN] + _engine_counts[VEH_ROAD] + _engine_counts[VEH_SHIP] + _engine_counts[VEH_AIRCRAFT];
|
||||
|
||||
Engine::Engine() :
|
||||
|
@@ -277,18 +277,19 @@ void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y, bool reset_
|
||||
/* Set the date before loading sprites as some newgrfs check it */
|
||||
SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
|
||||
|
||||
InitializeGame(_gw.size_x, _gw.size_y, false, reset_settings);
|
||||
PrepareGenerateWorldProgress();
|
||||
|
||||
/* Load the right landscape stuff */
|
||||
GfxLoadSprites();
|
||||
LoadStringWidthTable();
|
||||
|
||||
InitializeGame(_gw.size_x, _gw.size_y, false, reset_settings);
|
||||
PrepareGenerateWorldProgress();
|
||||
|
||||
/* Re-init the windowing system */
|
||||
ResetWindowSystem();
|
||||
|
||||
/* Create toolbars */
|
||||
SetupColoursAndInitialWindow();
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
|
||||
|
||||
if (_gw.thread != NULL) {
|
||||
_gw.thread->Join();
|
||||
|
65
src/gfx.cpp
65
src/gfx.cpp
@@ -593,12 +593,13 @@ void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, Tex
|
||||
* starting with index 0 is the real string end.
|
||||
*
|
||||
* @param str string to check and correct for length restrictions
|
||||
* @param last the last valid location (for '\0') in the buffer of str
|
||||
* @param maxw the maximum width the string can have on one line
|
||||
* @return return a 32bit wide number consisting of 2 packed values:
|
||||
* 0 - 15 the number of lines ADDED to the string
|
||||
* 16 - 31 the fontsize in which the length calculation was done at
|
||||
*/
|
||||
uint32 FormatStringLinebreaks(char *str, int maxw)
|
||||
uint32 FormatStringLinebreaks(char *str, const char *last, int maxw)
|
||||
{
|
||||
FontSize size = _cur_fontsize;
|
||||
int num = 0;
|
||||
@@ -606,6 +607,7 @@ uint32 FormatStringLinebreaks(char *str, int maxw)
|
||||
assert(maxw > 0);
|
||||
|
||||
for (;;) {
|
||||
/* The character *after* the last space. */
|
||||
char *last_space = NULL;
|
||||
int w = 0;
|
||||
|
||||
@@ -615,18 +617,49 @@ uint32 FormatStringLinebreaks(char *str, int maxw)
|
||||
if (IsWhitespace(c)) last_space = str;
|
||||
|
||||
if (IsPrintable(c)) {
|
||||
w += GetCharacterWidth(size, c);
|
||||
/* string is longer than maximum width so we need to decide what to
|
||||
* do. We can do two things:
|
||||
* 1. If no whitespace was found at all up until now (on this line) then
|
||||
* we will truncate the string and bail out.
|
||||
* 2. In all other cases force a linebreak at the last seen whitespace */
|
||||
int char_w = GetCharacterWidth(size, c);
|
||||
w += char_w;
|
||||
if (w > maxw) {
|
||||
if (last_space == NULL) {
|
||||
*Utf8PrevChar(str) = '\0';
|
||||
/* The string is longer than maximum width so we need to decide
|
||||
* what to do with it. */
|
||||
if (w == char_w) {
|
||||
/* The character is wider than allowed width; don't know
|
||||
* what to do with this case... bail out! */
|
||||
return num + (size << 16);
|
||||
}
|
||||
str = last_space;
|
||||
if (last_space == NULL) {
|
||||
/* No space has been found. Just terminate at our current
|
||||
* location. This usually happens for languages that do not
|
||||
* require spaces in strings, like Chinese, Japanese and
|
||||
* Korean. For other languages terminating mid-word might
|
||||
* not be the best, but terminating the whole string instead
|
||||
* of continuing the word at the next line is worse. */
|
||||
str = Utf8PrevChar(str);
|
||||
size_t len = strlen(str);
|
||||
char *terminator = str + len;
|
||||
|
||||
/* The string location + length of the string + 1 for '\0'
|
||||
* always fits; otherwise there's no trailing '\0' and it
|
||||
* it not a valid string. */
|
||||
assert(terminator <= last);
|
||||
assert(*terminator == '\0');
|
||||
|
||||
/* If the string is too long we have to terminate it earlier. */
|
||||
if (terminator == last) {
|
||||
/* Get the 'begin' of the previous character and make that
|
||||
* the terminator of the string; we truncate it 'early'. */
|
||||
*Utf8PrevChar(terminator) = '\0';
|
||||
len = strlen(str);
|
||||
}
|
||||
/* Also move the terminator! */
|
||||
memmove(str + 1, str, len + 1);
|
||||
*str = '\0';
|
||||
/* str needs to point to the character *after* the last space */
|
||||
str++;
|
||||
} else {
|
||||
/* A space is found; perfect place to terminate */
|
||||
str = last_space;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -695,7 +728,7 @@ int GetStringHeight(StringID str, int maxw)
|
||||
|
||||
GetString(buffer, str, lastof(buffer));
|
||||
|
||||
uint32 tmp = FormatStringLinebreaks(buffer, maxw);
|
||||
uint32 tmp = FormatStringLinebreaks(buffer, lastof(buffer), maxw);
|
||||
|
||||
return GetMultilineStringHeight(buffer, GB(tmp, 0, 16));
|
||||
}
|
||||
@@ -716,7 +749,7 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
|
||||
|
||||
GetString(buffer, str, lastof(buffer));
|
||||
|
||||
tmp = FormatStringLinebreaks(buffer, maxw);
|
||||
tmp = FormatStringLinebreaks(buffer, lastof(buffer), maxw);
|
||||
num = GB(tmp, 0, 16);
|
||||
|
||||
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
||||
@@ -755,18 +788,16 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
|
||||
uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
|
||||
{
|
||||
char buffer[DRAW_STRING_BUFFER];
|
||||
uint32 tmp;
|
||||
int num, mt;
|
||||
uint total_height;
|
||||
const char *src;
|
||||
WChar c;
|
||||
|
||||
GetString(buffer, str, lastof(buffer));
|
||||
|
||||
tmp = FormatStringLinebreaks(buffer, maxw);
|
||||
num = GB(tmp, 0, 16);
|
||||
uint32 tmp = FormatStringLinebreaks(buffer, lastof(buffer), maxw);
|
||||
int num = GB(tmp, 0, 16);
|
||||
|
||||
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
||||
int mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
||||
total_height = (num + 1) * mt;
|
||||
|
||||
if (maxh != -1 && (int)total_height > maxh) {
|
||||
|
@@ -109,7 +109,7 @@ void GfxDrawLine(int left, int top, int right, int bottom, int colour);
|
||||
void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3);
|
||||
|
||||
Dimension GetStringBoundingBox(const char *str);
|
||||
uint32 FormatStringLinebreaks(char *str, int maxw);
|
||||
uint32 FormatStringLinebreaks(char *str, const char *last, int maxw);
|
||||
int GetStringHeight(StringID str, int maxw);
|
||||
void LoadStringWidthTable();
|
||||
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
|
||||
|
@@ -1597,6 +1597,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
|
||||
*/
|
||||
static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 seed, Owner founder)
|
||||
{
|
||||
assert(itspec_index < indspec->num_table);
|
||||
const IndustryTileTable *it = indspec->table[itspec_index];
|
||||
bool custom_shape_check = false;
|
||||
|
||||
@@ -1649,9 +1650,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
const Industry *ind = NULL;
|
||||
|
||||
/* Check if the to-be built/founded industry is available for this climate. */
|
||||
if (!indspec->enabled) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
if (!indspec->enabled || indspec->num_table == 0) return CMD_ERROR;
|
||||
|
||||
/* If the setting for raw-material industries is not on, you cannot build raw-material industries.
|
||||
* Raw material industries are industries that do not accept cargo (at least for now) */
|
||||
@@ -1788,7 +1787,7 @@ void GenerateIndustries()
|
||||
}
|
||||
|
||||
chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
|
||||
if (ind_spc->enabled && chance > 0) {
|
||||
if (ind_spc->enabled && chance > 0 && ind_spc->num_table > 0) {
|
||||
/* once the chance of appearance is determind, it have to be scaled by
|
||||
* the difficulty level. The "chance" in question is more an index into
|
||||
* the _numof_industry_table,in fact */
|
||||
@@ -1811,7 +1810,7 @@ void GenerateIndustries()
|
||||
* @todo : Do we really have to pass chance as un-scaled value, since we've already
|
||||
* processed that scaling above? No, don't think so. Will find a way. */
|
||||
ind_spc = GetIndustrySpec(it);
|
||||
if (ind_spc->enabled) {
|
||||
if (ind_spc->enabled && ind_spc->num_table > 0) {
|
||||
chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
|
||||
if (chance > 0) PlaceInitialIndustry(it, chance);
|
||||
}
|
||||
@@ -1868,7 +1867,7 @@ static void MaybeNewIndustry(void)
|
||||
ind_spc = GetIndustrySpec(j);
|
||||
byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape];
|
||||
|
||||
if (!ind_spc->enabled || chance == 0) continue;
|
||||
if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0) continue;
|
||||
|
||||
/* If there is no Callback CBID_INDUSTRY_AVAILABLE or if this one did anot failed,
|
||||
* and if appearing chance for this landscape is above 0, this industry can be chosen */
|
||||
|
@@ -61,6 +61,7 @@ void HandleOnEditText(const char *str)
|
||||
switch (_rename_what) {
|
||||
#ifdef ENABLE_NETWORK
|
||||
case 3: { // Give money, you can only give money in excess of loan
|
||||
if (!IsValidCompanyID(_local_company)) break;
|
||||
const Company *c = GetCompany(_local_company);
|
||||
Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate));
|
||||
|
||||
|
@@ -59,8 +59,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
|
||||
|
||||
AllocateMap(size_x, size_y);
|
||||
|
||||
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
|
||||
|
||||
_pause_game = 0;
|
||||
_fast_forward = 0;
|
||||
_tick_counter = 0;
|
||||
|
@@ -310,6 +310,7 @@ struct AboutWindow : public Window {
|
||||
"Original graphics by Simon Foster",
|
||||
"",
|
||||
"The OpenTTD team (in alphabetical order):",
|
||||
" Albert Hofkamp (Alberth) - GUI expert",
|
||||
" Jean-Francois Claeys (Belugas) - GUI, newindustries and more",
|
||||
" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles",
|
||||
" Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework",
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
class FMusicDriver_Allegro: public MusicDriverFactory<FMusicDriver_Allegro> {
|
||||
public:
|
||||
static const int priority = 1;
|
||||
static const int priority = 2;
|
||||
/* virtual */ const char *GetName() { return "allegro"; }
|
||||
/* virtual */ const char *GetDescription() { return "Allegro MIDI Driver"; }
|
||||
/* virtual */ Driver *CreateInstance() { return new MusicDriver_Allegro(); }
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
class FMusicDriver_ExtMidi: public MusicDriverFactory<FMusicDriver_ExtMidi> {
|
||||
public:
|
||||
static const int priority = 1;
|
||||
static const int priority = 3;
|
||||
/* virtual */ const char *GetName() { return "extmidi"; }
|
||||
/* virtual */ const char *GetDescription() { return "External MIDI Driver"; }
|
||||
/* virtual */ Driver *CreateInstance() { return new MusicDriver_ExtMidi(); }
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
class FMusicDriver_Null: public MusicDriverFactory<FMusicDriver_Null> {
|
||||
public:
|
||||
static const int priority = 0;
|
||||
static const int priority = 1;
|
||||
/* virtual */ const char *GetName() { return "null"; }
|
||||
/* virtual */ const char *GetDescription() { return "Null Music Driver"; }
|
||||
/* virtual */ Driver *CreateInstance() { return new MusicDriver_Null(); }
|
||||
|
@@ -330,14 +330,20 @@ StringID GetNetworkErrorMsg(NetworkErrorCode err)
|
||||
return network_error_strings[err];
|
||||
}
|
||||
|
||||
/* Count the number of active clients connected */
|
||||
/**
|
||||
* Counts the number of active clients connected.
|
||||
* It has to be in STATUS_ACTIVE and not a spectator
|
||||
* @return number of active clients
|
||||
*/
|
||||
static uint NetworkCountActiveClients()
|
||||
{
|
||||
const NetworkClientInfo *ci;
|
||||
const NetworkClientSocket *cs;
|
||||
uint count = 0;
|
||||
|
||||
FOR_ALL_CLIENT_INFOS(ci) {
|
||||
if (IsValidCompanyID(ci->client_playas)) count++;
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
if (cs->status != STATUS_ACTIVE) continue;
|
||||
if (!IsValidCompanyID(cs->GetInfo()->client_playas)) continue;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@@ -79,7 +79,7 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *
|
||||
Utf8TrimString(buf, DRAW_STRING_BUFFER);
|
||||
|
||||
/* Force linebreaks for strings that are too long */
|
||||
lines = GB(FormatStringLinebreaks(buf, _chatmsg_box.width - 8), 0, 16) + 1;
|
||||
lines = GB(FormatStringLinebreaks(buf, lastof(buf), _chatmsg_box.width - 8), 0, 16) + 1;
|
||||
if (lines >= MAX_CHAT_MESSAGES) return;
|
||||
|
||||
msg_count = GetChatMessageCount();
|
||||
|
130
src/newgrf.cpp
130
src/newgrf.cpp
@@ -41,6 +41,7 @@
|
||||
#include "map_func.h"
|
||||
#include <map>
|
||||
#include "core/alloc_type.hpp"
|
||||
#include "core/mem_func.hpp"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/build_industry.h"
|
||||
@@ -93,6 +94,7 @@ enum {
|
||||
struct GRFTempEngineData {
|
||||
uint16 cargo_allowed;
|
||||
uint16 cargo_disallowed;
|
||||
bool refitmask_valid; ///< Did the newgrf set any refittability property? If not, default refittability will be applied.
|
||||
uint8 rv_max_speed; ///< Temporary storage of RV prop 15, maximum speed in mph/0.8
|
||||
};
|
||||
|
||||
@@ -671,6 +673,7 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
|
||||
|
||||
case 0x1D: // Refit cargo
|
||||
ei->refit_mask = grf_load_dword(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x1E: // Callback
|
||||
@@ -725,10 +728,12 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
|
||||
|
||||
case 0x28: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x29: // Cargo classes disallowed
|
||||
_gted[e->index].cargo_disallowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x2A: // Long format introduction date (days since year 0)
|
||||
@@ -832,6 +837,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
|
||||
|
||||
case 0x16: // Cargos available for refitting
|
||||
ei->refit_mask = grf_load_dword(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x17: // Callback mask
|
||||
@@ -861,10 +867,12 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
|
||||
|
||||
case 0x1D: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x1E: // Cargo classes disallowed
|
||||
_gted[e->index].cargo_disallowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x1F: // Long format introduction date (days since year 0)
|
||||
@@ -946,6 +954,7 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint engine, int numinfo, int prop
|
||||
|
||||
case 0x11: // Cargos available for refitting
|
||||
ei->refit_mask = grf_load_dword(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x12: // Callback mask
|
||||
@@ -974,10 +983,12 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint engine, int numinfo, int prop
|
||||
|
||||
case 0x18: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x19: // Cargo classes disallowed
|
||||
_gted[e->index].cargo_disallowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x1A: // Long format introduction date (days since year 0)
|
||||
@@ -1062,6 +1073,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int
|
||||
|
||||
case 0x13: // Cargos available for refitting
|
||||
ei->refit_mask = grf_load_dword(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x14: // Callback mask
|
||||
@@ -1083,10 +1095,12 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int
|
||||
|
||||
case 0x18: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x19: // Cargo classes disallowed
|
||||
_gted[e->index].cargo_disallowed = grf_load_word(&buf);
|
||||
_gted[e->index].refitmask_valid = true;
|
||||
break;
|
||||
|
||||
case 0x1A: // Long format introduction date (days since year 0)
|
||||
@@ -3022,10 +3036,10 @@ static void NewSpriteGroup(byte *buf, size_t len)
|
||||
group->g.indprod.version = type;
|
||||
if (type == 0) {
|
||||
for (uint i = 0; i < 3; i++) {
|
||||
group->g.indprod.substract_input[i] = grf_load_word(&buf);
|
||||
group->g.indprod.substract_input[i] = (int16)grf_load_word(&buf); // signed
|
||||
}
|
||||
for (uint i = 0; i < 2; i++) {
|
||||
group->g.indprod.add_output[i] = grf_load_word(&buf);
|
||||
group->g.indprod.add_output[i] = grf_load_word(&buf); // unsigned
|
||||
}
|
||||
group->g.indprod.again = grf_load_byte(&buf);
|
||||
} else {
|
||||
@@ -3774,7 +3788,7 @@ bool GetGlobalVariable(byte param, uint32 *value)
|
||||
return true;
|
||||
|
||||
case 0x09: // date fraction
|
||||
*value = _date_fract;
|
||||
*value = _date_fract * 885;
|
||||
return true;
|
||||
|
||||
case 0x0A: // animation counter
|
||||
@@ -5137,7 +5151,7 @@ static void GRFImportBlock(byte *buf, int len)
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadGRFSound(byte *buf, int len)
|
||||
static void LoadGRFSound(byte *buf, uint len)
|
||||
{
|
||||
byte *buf_start = buf;
|
||||
|
||||
@@ -5150,22 +5164,31 @@ static void LoadGRFSound(byte *buf, int len)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Size of file -- we ignore this */
|
||||
grf_load_dword(&buf);
|
||||
uint32 total_size = grf_load_dword(&buf);
|
||||
if (total_size > len + 8) {
|
||||
grfmsg(1, "LoadGRFSound: RIFF was truncated");
|
||||
return;
|
||||
}
|
||||
|
||||
if (grf_load_dword(&buf) != BSWAP32('WAVE')) {
|
||||
grfmsg(1, "LoadGRFSound: Invalid RIFF type");
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
while (total_size >= 8) {
|
||||
uint32 tag = grf_load_dword(&buf);
|
||||
uint32 size = grf_load_dword(&buf);
|
||||
total_size -= 8;
|
||||
if (total_size < size) {
|
||||
grfmsg(1, "LoadGRFSound: Invalid RIFF");
|
||||
return;
|
||||
}
|
||||
total_size -= size;
|
||||
|
||||
switch (tag) {
|
||||
case ' tmf': // 'fmt '
|
||||
/* Audio format, must be 1 (PCM) */
|
||||
if (grf_load_word(&buf) != 1) {
|
||||
if (size < 16 || grf_load_word(&buf) != 1) {
|
||||
grfmsg(1, "LoadGRFSound: Invalid audio format");
|
||||
return;
|
||||
}
|
||||
@@ -5175,13 +5198,13 @@ static void LoadGRFSound(byte *buf, int len)
|
||||
grf_load_word(&buf);
|
||||
se->bits_per_sample = grf_load_word(&buf);
|
||||
|
||||
/* Consume any extra bytes */
|
||||
for (; size > 16; size--) grf_load_byte(&buf);
|
||||
/* The rest will be skipped */
|
||||
size -= 16;
|
||||
break;
|
||||
|
||||
case 'atad': // 'data'
|
||||
se->file_size = size;
|
||||
se->file_offset = FioGetPos() - (len - (buf - buf_start)) + 1;
|
||||
se->file_offset = FioGetPos() - (len - (buf - buf_start));
|
||||
se->file_slot = _file_index;
|
||||
|
||||
/* Set default volume and priority */
|
||||
@@ -5189,13 +5212,21 @@ static void LoadGRFSound(byte *buf, int len)
|
||||
se->priority = 0;
|
||||
|
||||
grfmsg(2, "LoadGRFSound: channels %u, sample rate %u, bits per sample %u, length %u", se->channels, se->rate, se->bits_per_sample, size);
|
||||
return;
|
||||
return; // the fmt chunk has to appear before data, so we are finished
|
||||
|
||||
default:
|
||||
se->file_size = 0;
|
||||
return;
|
||||
/* Skip unknown chunks */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Skip rest of chunk */
|
||||
for (; size > 0; size--) grf_load_byte(&buf);
|
||||
}
|
||||
|
||||
grfmsg(1, "LoadGRFSound: RIFF does not contain any sound data");
|
||||
|
||||
/* Clear everything that was read */
|
||||
MemSetT(se, 0);
|
||||
}
|
||||
|
||||
/* Action 0x12 */
|
||||
@@ -5334,22 +5365,34 @@ static void TranslateGRFStrings(byte *buf, size_t len)
|
||||
/* 'Action 0xFF' */
|
||||
static void GRFDataBlock(byte *buf, int len)
|
||||
{
|
||||
/* <FF> <name_len> <name> '\0' <data> */
|
||||
|
||||
if (_grf_data_blocks == 0) {
|
||||
grfmsg(2, "GRFDataBlock: unexpected data block, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_length(len, 3, "GRFDataBlock")) return;
|
||||
|
||||
buf++;
|
||||
uint8 name_len = grf_load_byte(&buf);
|
||||
const char *name = (const char *)buf;
|
||||
buf += name_len + 1;
|
||||
buf += name_len;
|
||||
|
||||
/* Test string termination */
|
||||
if (grf_load_byte(&buf) != 0) {
|
||||
grfmsg(2, "GRFDataBlock: Name not properly terminated");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_length(len, 3 + name_len, "GRFDataBlock")) return;
|
||||
|
||||
grfmsg(2, "GRFDataBlock: block name '%s'...", name);
|
||||
|
||||
_grf_data_blocks--;
|
||||
|
||||
switch (_grf_data_type) {
|
||||
case GDT_SOUND: LoadGRFSound(buf, len - name_len - 2); break;
|
||||
case GDT_SOUND: LoadGRFSound(buf, len - name_len - 3); break;
|
||||
default: NOT_REACHED(); break;
|
||||
}
|
||||
}
|
||||
@@ -5765,39 +5808,42 @@ static void CalculateRefitMasks()
|
||||
uint32 not_mask = 0;
|
||||
uint32 xor_mask = 0;
|
||||
|
||||
if (ei->refit_mask != 0) {
|
||||
const GRFFile *file = e->grffile;
|
||||
if (file != NULL && file->cargo_max != 0) {
|
||||
/* Apply cargo translation table to the refit mask */
|
||||
uint num_cargo = min(32, file->cargo_max);
|
||||
for (uint i = 0; i < num_cargo; i++) {
|
||||
if (!HasBit(ei->refit_mask, i)) continue;
|
||||
/* Did the newgrf specify any refitting? If not, use defaults. */
|
||||
if (_gted[engine].refitmask_valid) {
|
||||
if (ei->refit_mask != 0) {
|
||||
const GRFFile *file = e->grffile;
|
||||
if (file != NULL && file->cargo_max != 0) {
|
||||
/* Apply cargo translation table to the refit mask */
|
||||
uint num_cargo = min(32, file->cargo_max);
|
||||
for (uint i = 0; i < num_cargo; i++) {
|
||||
if (!HasBit(ei->refit_mask, i)) continue;
|
||||
|
||||
CargoID c = GetCargoIDByLabel(file->cargo_list[i]);
|
||||
if (c == CT_INVALID) continue;
|
||||
CargoID c = GetCargoIDByLabel(file->cargo_list[i]);
|
||||
if (c == CT_INVALID) continue;
|
||||
|
||||
SetBit(xor_mask, c);
|
||||
}
|
||||
} else {
|
||||
/* No cargo table, so use the cargo bitnum values */
|
||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||
const CargoSpec *cs = GetCargo(c);
|
||||
if (!cs->IsValid()) continue;
|
||||
SetBit(xor_mask, c);
|
||||
}
|
||||
} else {
|
||||
/* No cargo table, so use the cargo bitnum values */
|
||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||
const CargoSpec *cs = GetCargo(c);
|
||||
if (!cs->IsValid()) continue;
|
||||
|
||||
if (HasBit(ei->refit_mask, cs->bitnum)) SetBit(xor_mask, c);
|
||||
if (HasBit(ei->refit_mask, cs->bitnum)) SetBit(xor_mask, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_gted[engine].cargo_allowed != 0) {
|
||||
/* Build up the list of cargo types from the set cargo classes. */
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
const CargoSpec *cs = GetCargo(i);
|
||||
if (_gted[engine].cargo_allowed & cs->classes) SetBit(mask, i);
|
||||
if (_gted[engine].cargo_disallowed & cs->classes) SetBit(not_mask, i);
|
||||
if (_gted[engine].cargo_allowed != 0) {
|
||||
/* Build up the list of cargo types from the set cargo classes. */
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
const CargoSpec *cs = GetCargo(i);
|
||||
if (_gted[engine].cargo_allowed & cs->classes) SetBit(mask, i);
|
||||
if (_gted[engine].cargo_disallowed & cs->classes) SetBit(not_mask, i);
|
||||
}
|
||||
}
|
||||
} else if (xor_mask == 0) {
|
||||
/* Don't apply default refit mask to wagons or engines with no capacity */
|
||||
} else {
|
||||
/* Don't apply default refit mask to wagons nor engines with no capacity */
|
||||
if (e->type != VEH_TRAIN || (e->u.rail.capacity != 0 && e->u.rail.railveh_type != RAILVEH_WAGON)) {
|
||||
const CargoLabel *cl = _default_refitmasks[e->type];
|
||||
for (uint i = 0;; i++) {
|
||||
|
@@ -516,6 +516,7 @@ struct NewGRFWindow : public Window {
|
||||
this->preset = -1;
|
||||
this->SetupNewGRFWindow();
|
||||
this->SetDirty();
|
||||
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -558,6 +559,8 @@ struct NewGRFWindow : public Window {
|
||||
uint i = (pt.y - this->widget[SNGRFS_FILE_LIST].top) / 14 + this->vscroll.pos;
|
||||
|
||||
for (c = this->list; c != NULL && i > 0; c = c->next, i--) {}
|
||||
|
||||
if (this->sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->sel = c;
|
||||
|
||||
this->SetDirty();
|
||||
|
@@ -551,7 +551,7 @@ bool CheckIfCallBackAllowsAvailability(IndustryType type, IndustryAvailabilityCa
|
||||
return true;
|
||||
}
|
||||
|
||||
static int32 DerefIndProd(uint field, bool use_register)
|
||||
static int32 DerefIndProd(int field, bool use_register)
|
||||
{
|
||||
return use_register ? (int32)GetRegister(field) : field;
|
||||
}
|
||||
|
@@ -173,14 +173,16 @@ static inline const SpriteGroup *ResolveVariable(const SpriteGroup *group, Resol
|
||||
/* Try to get the variable. We shall assume it is available, unless told otherwise. */
|
||||
bool available = true;
|
||||
if (adjust->variable == 0x7E) {
|
||||
ResolverObject subobject = *object;
|
||||
subobject.procedure_call = true;
|
||||
const SpriteGroup *subgroup = Resolve(adjust->subroutine, &subobject);
|
||||
const SpriteGroup *subgroup = Resolve(adjust->subroutine, object);
|
||||
if (subgroup == NULL || subgroup->type != SGT_CALLBACK) {
|
||||
value = CALLBACK_FAILED;
|
||||
} else {
|
||||
value = subgroup->g.callback.result;
|
||||
}
|
||||
|
||||
/* Reset values to current scope.
|
||||
* Note: 'last_value' and 'reseed' are shared between the main chain and the procedure */
|
||||
object->scope = group->g.determ.var_scope;
|
||||
} else {
|
||||
value = GetVariable(object, adjust->variable, adjust->parameter, &available);
|
||||
}
|
||||
|
@@ -165,8 +165,8 @@ struct TileLayoutSpriteGroup {
|
||||
|
||||
struct IndustryProductionSpriteGroup {
|
||||
uint8 version;
|
||||
uint16 substract_input[3];
|
||||
uint16 add_output[2];
|
||||
int16 substract_input[3]; // signed
|
||||
uint16 add_output[2]; // unsigned
|
||||
uint8 again;
|
||||
};
|
||||
|
||||
@@ -206,7 +206,6 @@ struct ResolverObject {
|
||||
CallbackID callback;
|
||||
uint32 callback_param1;
|
||||
uint32 callback_param2;
|
||||
bool procedure_call; ///< true if we are currently resolving a var 0x7E procedure result.
|
||||
|
||||
byte trigger;
|
||||
byte count;
|
||||
@@ -266,8 +265,6 @@ struct ResolverObject {
|
||||
void (*SetTriggers)(const struct ResolverObject*, int);
|
||||
uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*);
|
||||
const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const SpriteGroup*);
|
||||
|
||||
ResolverObject() : procedure_call(false) { }
|
||||
};
|
||||
|
||||
|
||||
|
@@ -51,36 +51,51 @@ enum GRFExtendedLanguages {
|
||||
* but according to a different lang.
|
||||
*/
|
||||
struct GRFText {
|
||||
public:
|
||||
static GRFText* New(byte langid, const char* text)
|
||||
{
|
||||
return new(strlen(text) + 1) GRFText(langid, text);
|
||||
}
|
||||
public:
|
||||
static GRFText *New(byte langid, const char *text)
|
||||
{
|
||||
return new (strlen(text) + 1) GRFText(langid, text);
|
||||
}
|
||||
|
||||
private:
|
||||
GRFText(byte langid_, const char* text_) : next(NULL), langid(langid_)
|
||||
{
|
||||
strcpy(text, text_);
|
||||
}
|
||||
/**
|
||||
* Helper allocation function to disallow something.
|
||||
* Don't allow simple 'news'; they wouldn't have enough memory.
|
||||
* @param size the amount of space not to allocate
|
||||
*/
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
void *operator new(size_t size, size_t extra)
|
||||
{
|
||||
return ::operator new(size + extra);
|
||||
}
|
||||
/**
|
||||
* Free the memory we allocated
|
||||
* @param p memory to free
|
||||
*/
|
||||
void operator delete(void *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
private:
|
||||
GRFText(byte langid_, const char *text_) : next(NULL), langid(langid_)
|
||||
{
|
||||
strcpy(text, text_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate memory for this class.
|
||||
* @param size the size of the instance
|
||||
* @param extra the extra memory for the text
|
||||
* @return the requested amount of memory for both the instance and the text
|
||||
*/
|
||||
void *operator new(size_t size, size_t extra)
|
||||
{
|
||||
return MallocT<byte>(size + extra);
|
||||
}
|
||||
|
||||
public:
|
||||
/* dummy operator delete to silence VC8:
|
||||
* 'void *GRFText::operator new(size_t,size_t)' : no matching operator delete found;
|
||||
* memory will not be freed if initialization throws an exception */
|
||||
void operator delete(void *p, size_t extra)
|
||||
{
|
||||
return ::operator delete(p);
|
||||
}
|
||||
|
||||
public:
|
||||
GRFText *next;
|
||||
byte langid;
|
||||
char text[VARARRAY_SIZE];
|
||||
GRFText *next;
|
||||
byte langid;
|
||||
char text[VARARRAY_SIZE];
|
||||
};
|
||||
|
||||
|
||||
|
@@ -64,8 +64,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,7,3,17631
|
||||
PRODUCTVERSION 0,7,3,17631
|
||||
FILEVERSION 0,7,4,18355
|
||||
PRODUCTVERSION 0,7,4,18355
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -83,14 +83,14 @@ BEGIN
|
||||
VALUE "Comments", "This program is licensed under the GNU General Public License.\0"
|
||||
VALUE "CompanyName", "OpenTTD Development Team\0"
|
||||
VALUE "FileDescription", "OpenTTD\0"
|
||||
VALUE "FileVersion", "0.7.3-RC2\0"
|
||||
VALUE "FileVersion", "0.7.4\0"
|
||||
VALUE "InternalName", "openttd\0"
|
||||
VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-2009. All Rights Reserved.\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "openttd.exe\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "OpenTTD\0"
|
||||
VALUE "ProductVersion", "0.7.3-RC2\0"
|
||||
VALUE "ProductVersion", "0.7.4\0"
|
||||
VALUE "SpecialBuild", "-\0"
|
||||
END
|
||||
END
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* norev000 is for non-releases that are made on systems without
|
||||
* subversion or sources that are not a checkout of subversion.
|
||||
*/
|
||||
const char _openttd_revision[] = "0.7.3-RC2";
|
||||
const char _openttd_revision[] = "0.7.4";
|
||||
|
||||
/**
|
||||
* Let us know if current build was modified. This detection
|
||||
@@ -45,11 +45,11 @@ const byte _openttd_revision_modified = !!MODIFIED!!;
|
||||
* final release will always have a lower version number than the released
|
||||
* version, thus making comparisions on specific revisions easy.
|
||||
*/
|
||||
const uint32 _openttd_newgrf_version = 0 << 28 | 7 << 24 | 3 << 20 | 0 << 19 | (17631 & ((1 << 19) - 1));
|
||||
const uint32 _openttd_newgrf_version = 0 << 28 | 7 << 24 | 4 << 20 | 1 << 19 | (18355 & ((1 << 19) - 1));
|
||||
|
||||
#ifdef __MORPHOS__
|
||||
/**
|
||||
* Variable used by MorphOS to show the version.
|
||||
*/
|
||||
extern const char morphos_versions_tag[] = "$VER: OpenTTD 0.7.3-RC2 (!!DATE!!) OpenTTD Team [MorphOS, PowerPC]";
|
||||
extern const char morphos_versions_tag[] = "$VER: OpenTTD 0.7.4 (!!DATE!!) OpenTTD Team [MorphOS, PowerPC]";
|
||||
#endif
|
||||
|
@@ -23,6 +23,7 @@ extern TileIndex _cur_tileloop_tile;
|
||||
/* Keep track of current game position */
|
||||
int _saved_scrollpos_x;
|
||||
int _saved_scrollpos_y;
|
||||
ZoomLevelByte _saved_scrollpos_zoom;
|
||||
|
||||
void SaveViewportBeforeSaveGame()
|
||||
{
|
||||
@@ -45,7 +46,7 @@ void ResetViewportAfterLoadGame()
|
||||
w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
|
||||
|
||||
ViewPort *vp = w->viewport;
|
||||
vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
|
||||
vp->zoom = min<ZoomLevel>(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
|
||||
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
|
||||
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
|
||||
|
||||
|
@@ -336,7 +336,7 @@ static bool FixTTOEngines()
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 44, 45, 46, 255, 255, 255, 255, 47, 48, 255, 49, 50,
|
||||
255, 255, 255, 255, 51, 52, 255, 53, 54, 255, 55, 56, 255, 57, 58, 255,
|
||||
59, 60, 255,61, 62, 255, 63, 64, 255, 65, 66, 255, 255, 255, 255, 255,
|
||||
59, 60, 255, 61, 62, 255, 63, 64, 255, 65, 66, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 67, 68, 69, 70,
|
||||
@@ -417,12 +417,12 @@ static bool FixTTOEngines()
|
||||
}
|
||||
}
|
||||
|
||||
e->preview_company_rank = 0;
|
||||
e->preview_wait = 0;
|
||||
e->name = NULL;
|
||||
|
||||
e->info.climates = 1;
|
||||
}
|
||||
|
||||
e->preview_company_rank = 0;
|
||||
e->preview_wait = 0;
|
||||
e->name = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -36,6 +36,7 @@ void CopyTempEngineData();
|
||||
|
||||
extern int32 _saved_scrollpos_x;
|
||||
extern int32 _saved_scrollpos_y;
|
||||
extern ZoomLevelByte _saved_scrollpos_zoom;
|
||||
|
||||
extern SavegameType _savegame_type;
|
||||
extern uint32 _ttdp_version;
|
||||
|
@@ -41,6 +41,7 @@ struct ScreenshotFormat {
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
/** BMP File Header (stored in little endian) */
|
||||
struct BitmapFileHeader {
|
||||
uint16 type;
|
||||
uint32 size;
|
||||
@@ -53,6 +54,7 @@ assert_compile(sizeof(BitmapFileHeader) == 14);
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
/** BMP Info Header (stored in little endian) */
|
||||
struct BitmapInfoHeader {
|
||||
uint32 size;
|
||||
int32 width, height;
|
||||
@@ -61,46 +63,63 @@ struct BitmapInfoHeader {
|
||||
};
|
||||
assert_compile(sizeof(BitmapInfoHeader) == 40);
|
||||
|
||||
/** Format of palette data in BMP header */
|
||||
struct RgbQuad {
|
||||
byte blue, green, red, reserved;
|
||||
};
|
||||
assert_compile(sizeof(RgbQuad) == 4);
|
||||
|
||||
/* generic .BMP writer */
|
||||
/** Pixel data in 24bpp BMP */
|
||||
struct RgbTriplet {
|
||||
byte b, g, r;
|
||||
};
|
||||
assert_compile(sizeof(RgbTriplet) == 3);
|
||||
|
||||
/**
|
||||
* Generic .BMP writer
|
||||
* @param name file name including extension
|
||||
* @param callb callback used for gathering rendered image
|
||||
* @param userdata parameters forwarded to #callb
|
||||
* @param w width in pixels
|
||||
* @param h height in pixels
|
||||
* @param pixelformat bits per pixel
|
||||
* @param paletter colour paletter (for 8bpp mode)
|
||||
* @return was everything ok?
|
||||
*/
|
||||
static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
|
||||
{
|
||||
BitmapFileHeader bfh;
|
||||
BitmapInfoHeader bih;
|
||||
RgbQuad rq[256];
|
||||
FILE *f;
|
||||
uint i, padw;
|
||||
uint n, maxlines;
|
||||
uint pal_size = 0;
|
||||
uint bpp = pixelformat / 8;
|
||||
uint bpp; // bytes per pixel
|
||||
switch (pixelformat) {
|
||||
case 8: bpp = 1; break;
|
||||
/* 32bpp mode is saved as 24bpp BMP */
|
||||
case 32: bpp = 3; break;
|
||||
/* Only implemented for 8bit and 32bit images so far */
|
||||
default: return false;
|
||||
}
|
||||
|
||||
/* only implemented for 8bit and 32bit images so far. */
|
||||
if (pixelformat != 8 && pixelformat != 32) return false;
|
||||
|
||||
f = fopen(name, "wb");
|
||||
FILE *f = fopen(name, "wb");
|
||||
if (f == NULL) return false;
|
||||
|
||||
/* each scanline must be aligned on a 32bit boundary */
|
||||
padw = Align(w, 4);
|
||||
/* Each scanline must be aligned on a 32bit boundary */
|
||||
uint bytewidth = Align(w * bpp, 4); // bytes per line in file
|
||||
|
||||
if (pixelformat == 8) pal_size = sizeof(RgbQuad) * 256;
|
||||
/* Size of palette. Only present for 8bpp mode */
|
||||
uint pal_size = pixelformat == 8 ? sizeof(RgbQuad) * 256 : 0;
|
||||
|
||||
/* setup the file header */
|
||||
/* Setup the file header */
|
||||
BitmapFileHeader bfh;
|
||||
bfh.type = TO_LE16('MB');
|
||||
bfh.size = TO_LE32(sizeof(bfh) + sizeof(bih) + pal_size + padw * h * bpp);
|
||||
bfh.size = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size + bytewidth * h);
|
||||
bfh.reserved = 0;
|
||||
bfh.off_bits = TO_LE32(sizeof(bfh) + sizeof(bih) + pal_size);
|
||||
bfh.off_bits = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size);
|
||||
|
||||
/* setup the info header */
|
||||
/* Setup the info header */
|
||||
BitmapInfoHeader bih;
|
||||
bih.size = TO_LE32(sizeof(BitmapInfoHeader));
|
||||
bih.width = TO_LE32(w);
|
||||
bih.height = TO_LE32(h);
|
||||
bih.planes = TO_LE16(1);
|
||||
bih.bitcount = TO_LE16(pixelformat);
|
||||
bih.bitcount = TO_LE16(bpp * 8);
|
||||
bih.compression = 0;
|
||||
bih.sizeimage = 0;
|
||||
bih.xpels = 0;
|
||||
@@ -108,43 +127,66 @@ static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *user
|
||||
bih.clrused = 0;
|
||||
bih.clrimp = 0;
|
||||
|
||||
/* Write file header and info header */
|
||||
if (fwrite(&bfh, sizeof(bfh), 1, f) != 1 || fwrite(&bih, sizeof(bih), 1, f) != 1) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pixelformat == 8) {
|
||||
/* convert the palette to the windows format */
|
||||
for (i = 0; i != 256; i++) {
|
||||
/* Convert the palette to the windows format */
|
||||
RgbQuad rq[256];
|
||||
for (uint i = 0; i < 256; i++) {
|
||||
rq[i].red = palette[i].r;
|
||||
rq[i].green = palette[i].g;
|
||||
rq[i].blue = palette[i].b;
|
||||
rq[i].reserved = 0;
|
||||
}
|
||||
/* Write the palette */
|
||||
if (fwrite(rq, sizeof(rq), 1, f) != 1) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* write file header and info header and palette */
|
||||
if (fwrite(&bfh, sizeof(bfh), 1, f) != 1) return false;
|
||||
if (fwrite(&bih, sizeof(bih), 1, f) != 1) return false;
|
||||
if (pixelformat == 8) if (fwrite(rq, sizeof(rq), 1, f) != 1) return false;
|
||||
/* Try to use 64k of memory, store between 16 and 128 lines */
|
||||
uint maxlines = Clamp(65536 / (w * pixelformat / 8), 16, 128); // number of lines per iteration
|
||||
|
||||
/* use by default 64k temp memory */
|
||||
maxlines = Clamp(65536 / padw, 16, 128);
|
||||
uint8 *buff = MallocT<uint8>(maxlines * w * pixelformat / 8); // buffer which is rendered to
|
||||
uint8 *line = AllocaM(uint8, bytewidth); // one line, stored to file
|
||||
memset(line, 0, bytewidth);
|
||||
|
||||
/* now generate the bitmap bits */
|
||||
uint8 *buff = CallocT<uint8>(padw * maxlines * bpp); // by default generate 128 lines at a time.
|
||||
|
||||
/* start at the bottom, since bitmaps are stored bottom up. */
|
||||
/* Start at the bottom, since bitmaps are stored bottom up */
|
||||
do {
|
||||
/* determine # lines */
|
||||
n = min(h, maxlines);
|
||||
uint n = min(h, maxlines);
|
||||
h -= n;
|
||||
|
||||
/* render the pixels */
|
||||
callb(userdata, buff, h, padw, n);
|
||||
/* Render the pixels */
|
||||
callb(userdata, buff, h, w, n);
|
||||
|
||||
/* write each line */
|
||||
while (n)
|
||||
if (fwrite(buff + (--n) * padw * bpp, padw * bpp, 1, f) != 1) {
|
||||
/* Write each line */
|
||||
while (n-- != 0) {
|
||||
if (pixelformat == 8) {
|
||||
/* Move to 'line', leave last few pixels in line zeroed */
|
||||
memcpy(line, buff + n * w, w);
|
||||
} else {
|
||||
/* Convert from 'native' 32bpp to BMP-like 24bpp.
|
||||
* Works for both big and little endian machines */
|
||||
Colour *src = ((Colour *)buff) + n * w;
|
||||
RgbTriplet *dst = (RgbTriplet *)line;
|
||||
for (uint i = 0; i < w; i++) {
|
||||
dst[i].r = src[i].r;
|
||||
dst[i].g = src[i].g;
|
||||
dst[i].b = src[i].b;
|
||||
}
|
||||
}
|
||||
/* Write to file */
|
||||
if (fwrite(line, bytewidth, 1, f) != 1) {
|
||||
free(buff);
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} while (h != 0);
|
||||
|
||||
free(buff);
|
||||
@@ -539,7 +581,11 @@ static char *MakeScreenshotName(const char *ext)
|
||||
snprintf(&_screenshot_name[len], lengthof(_screenshot_name) - len, ".%s", ext);
|
||||
|
||||
for (serial = 1;; serial++) {
|
||||
snprintf(filename, lengthof(filename), "%s%s", _personal_dir, _screenshot_name);
|
||||
if (snprintf(filename, lengthof(filename), "%s%s", _personal_dir, _screenshot_name) >= (int)lengthof(filename)) {
|
||||
/* We need more characters than MAX_PATH -> end with error */
|
||||
filename[0] = '\0';
|
||||
break;
|
||||
}
|
||||
if (!FileExists(filename)) break;
|
||||
/* If file exists try another one with same name, but just with a higher index */
|
||||
snprintf(&_screenshot_name[len], lengthof(_screenshot_name) - len, "#%d.%s", serial, ext);
|
||||
|
@@ -222,7 +222,7 @@ bool Squirrel::CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT
|
||||
if (ret != NULL) sq_getstackobj(vm, -1, ret);
|
||||
/* Reset the top, but don't do so for the AI main function, as we need
|
||||
* a correct stack when resuming. */
|
||||
if (suspend == -1) sq_settop(this->vm, top);
|
||||
if (suspend == -1 || !this->IsSuspended()) sq_settop(this->vm, top);
|
||||
/* Restore the return-value location. */
|
||||
this->vm->_suspended_target = last_target;
|
||||
|
||||
|
@@ -1379,7 +1379,7 @@ const SettingDesc _settings[] = {
|
||||
SDT_CONDBOOL(GameSettings, vehicle.disable_elrails, 38, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DISABLE_ELRAILS, SettingsDisableElrail),
|
||||
SDT_CONDVAR(GameSettings, vehicle.freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0,NN, 1, 1, 255, 1, STR_CONFIG_SETTING_FREIGHT_TRAINS, NULL),
|
||||
SDT_CONDBOOL(GameSettings, order.timetabling, 67, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_SETTING_TIMETABLE_ALLOW, NULL),
|
||||
SDT_CONDVAR(GameSettings, vehicle.plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0, 0, 4, 1, 4, 0, STR_CONFIG_SETTING_PLANE_SPEED, NULL),
|
||||
SDT_CONDVAR(GameSettings, vehicle.plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0,NN, 4, 1, 4, 0, STR_CONFIG_SETTING_PLANE_SPEED, NULL),
|
||||
SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DYNAMIC_ENGINES, ChangeDynamicEngines),
|
||||
|
||||
SDT_BOOL(GameSettings, station.join_stations, 0, 0, true, STR_CONFIG_SETTING_JOINSTATIONS, NULL),
|
||||
|
@@ -981,8 +981,6 @@ public:
|
||||
if (widget == SM_WIDGET_MAP) {
|
||||
if (_scrolling_viewport) return;
|
||||
_scrolling_viewport = true;
|
||||
_cursor.delta.x = 0;
|
||||
_cursor.delta.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
class FSoundDriver_Allegro: public SoundDriverFactory<FSoundDriver_Allegro> {
|
||||
public:
|
||||
static const int priority = 5;
|
||||
static const int priority = 4;
|
||||
/* virtual */ const char *GetName() { return "allegro"; }
|
||||
/* virtual */ const char *GetDescription() { return "Allegro Sound Driver"; }
|
||||
/* virtual */ Driver *CreateInstance() { return new SoundDriver_Allegro(); }
|
||||
|
@@ -16,7 +16,7 @@ public:
|
||||
|
||||
class FSoundDriver_Null: public SoundDriverFactory<FSoundDriver_Null> {
|
||||
public:
|
||||
static const int priority = 0;
|
||||
static const int priority = 1;
|
||||
/* virtual */ const char *GetName() { return "null"; }
|
||||
/* virtual */ const char *GetDescription() { return "Null Sound Driver"; }
|
||||
/* virtual */ Driver *CreateInstance() { return new SoundDriver_Null(); }
|
||||
|
@@ -1495,7 +1495,15 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
|
||||
static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *)
|
||||
{
|
||||
if (v->type == VEH_ROAD) v->u.road.state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
|
||||
if (v->type == VEH_ROAD) {
|
||||
/* Okay... we are a road vehicle on a drive through road stop.
|
||||
* But that road stop has just been removed, so we need to make
|
||||
* sure we are in a valid state... however, vehicles can also
|
||||
* turn on road stop tiles, so only clear the 'road stop' state
|
||||
* bits and only when the state was 'in road stop', otherwise
|
||||
* we'll end up clearing the turn around bits. */
|
||||
if (HasBit(v->u.road.state, RVS_IN_DT_ROAD_STOP)) v->u.road.state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -173,6 +173,7 @@
|
||||
#if (_MSC_VER < 1400) // MSVC 2005 safety checks
|
||||
#error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not! Upgrade your compiler."
|
||||
#endif /* (_MSC_VER < 1400) */
|
||||
#pragma warning(disable: 4291) // no matching operator delete found; memory will not be freed if initialization throws an exception (reason: our overloaded functions never throw an exception)
|
||||
#pragma warning(disable: 4996) // 'strdup' was declared deprecated
|
||||
#define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions
|
||||
#pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
|
||||
|
@@ -325,7 +325,7 @@ static const EngineInfo _orig_engine_info[] = {
|
||||
MA( 23832, 20, 20, 99, Y), // 252 Flashbang Wizzer
|
||||
MA( 13575, 20, 20, 40, T|A|S ), // 253 Tricario Helicopter
|
||||
MA( 28215, 20, 20, 30, T|A|S ), // 254 Guru X2 Helicopter
|
||||
MK( 13575, 20, 20, 99, Y), // 255
|
||||
MA( 13575, 20, 20, 99, Y), // 255 Powernaut Helicopter
|
||||
};
|
||||
#undef Y
|
||||
#undef S
|
||||
|
@@ -368,8 +368,8 @@ static void PollEvent()
|
||||
int dy = mouse_y - _cursor.pos.y;
|
||||
if (dx != 0 || dy != 0) {
|
||||
if (_cursor.fix_at) {
|
||||
_cursor.delta.x += dx;
|
||||
_cursor.delta.y += dy;
|
||||
_cursor.delta.x = dx;
|
||||
_cursor.delta.y = dy;
|
||||
position_mouse(_cursor.pos.x, _cursor.pos.y);
|
||||
} else {
|
||||
_cursor.delta.x = dx;
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
class FVideoDriver_Allegro: public VideoDriverFactory<FVideoDriver_Allegro> {
|
||||
public:
|
||||
static const int priority = 5;
|
||||
static const int priority = 4;
|
||||
/* virtual */ const char *GetName() { return "allegro"; }
|
||||
/* virtual */ const char *GetDescription() { return "Allegro Video Driver"; }
|
||||
/* virtual */ Driver *CreateInstance() { return new VideoDriver_Allegro(); }
|
||||
|
@@ -334,8 +334,8 @@ static int PollEvent()
|
||||
int dx = ev.motion.x - _cursor.pos.x;
|
||||
int dy = ev.motion.y - _cursor.pos.y;
|
||||
if (dx != 0 || dy != 0) {
|
||||
_cursor.delta.x += dx;
|
||||
_cursor.delta.y += dy;
|
||||
_cursor.delta.x = dx;
|
||||
_cursor.delta.y = dy;
|
||||
SDL_CALL SDL_WarpMouse(_cursor.pos.x, _cursor.pos.y);
|
||||
}
|
||||
} else {
|
||||
|
@@ -426,8 +426,8 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
int dx = x - _cursor.pos.x;
|
||||
int dy = y - _cursor.pos.y;
|
||||
if (dx != 0 || dy != 0) {
|
||||
_cursor.delta.x += dx;
|
||||
_cursor.delta.y += dy;
|
||||
_cursor.delta.x = dx;
|
||||
_cursor.delta.y = dy;
|
||||
|
||||
pt.x = _cursor.pos.x;
|
||||
pt.y = _cursor.pos.y;
|
||||
@@ -436,8 +436,8 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
SetCursorPos(pt.x, pt.y);
|
||||
}
|
||||
} else {
|
||||
_cursor.delta.x += x - _cursor.pos.x;
|
||||
_cursor.delta.y += y - _cursor.pos.y;
|
||||
_cursor.delta.x = x - _cursor.pos.x;
|
||||
_cursor.delta.y = y - _cursor.pos.y;
|
||||
_cursor.pos.x = x;
|
||||
_cursor.pos.y = y;
|
||||
_cursor.dirty = true;
|
||||
@@ -872,7 +872,6 @@ void VideoDriver_Win32::MainLoop()
|
||||
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
|
||||
|
||||
GameLoop();
|
||||
_cursor.delta.x = _cursor.delta.y = 0;
|
||||
|
||||
if (_force_full_redraw) MarkWholeScreenDirty();
|
||||
|
||||
|
@@ -45,7 +45,6 @@
|
||||
|
||||
PlaceProc *_place_proc;
|
||||
Point _tile_fract_coords;
|
||||
ZoomLevel _saved_scrollpos_zoom;
|
||||
|
||||
struct StringSpriteToDraw {
|
||||
StringID string;
|
||||
|
@@ -509,12 +509,14 @@ void SetWindowDirty(const Window *w)
|
||||
|
||||
/** Find the Window whose parent pointer points to this window
|
||||
* @param w parent Window to find child of
|
||||
* @return a Window pointer that is the child of w, or NULL otherwise */
|
||||
static Window *FindChildWindow(const Window *w)
|
||||
* @param wc Window class of the window to remove; WC_INVALID if class does not matter
|
||||
* @return a Window pointer that is the child of w, or NULL otherwise
|
||||
*/
|
||||
static Window *FindChildWindow(const Window *w, WindowClass wc)
|
||||
{
|
||||
Window *v;
|
||||
FOR_ALL_WINDOWS_FROM_BACK(v) {
|
||||
if (v->parent == w) return v;
|
||||
if ((wc == WC_INVALID || wc == v->window_class) && v->parent == w) return v;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -522,13 +524,14 @@ static Window *FindChildWindow(const Window *w)
|
||||
|
||||
/**
|
||||
* Delete all children a window might have in a head-recursive manner
|
||||
* @param wc Window class of the window to remove; WC_INVALID if class does not matter
|
||||
*/
|
||||
void Window::DeleteChildWindows() const
|
||||
void Window::DeleteChildWindows(WindowClass wc) const
|
||||
{
|
||||
Window *child = FindChildWindow(this);
|
||||
Window *child = FindChildWindow(this, wc);
|
||||
while (child != NULL) {
|
||||
delete child;
|
||||
child = FindChildWindow(this);
|
||||
child = FindChildWindow(this, wc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1897,7 +1900,7 @@ static void HandleKeyScrolling()
|
||||
}
|
||||
}
|
||||
|
||||
void MouseLoop(MouseClick click, int mousewheel)
|
||||
static void MouseLoop(MouseClick click, int mousewheel)
|
||||
{
|
||||
DecreaseWindowCounters();
|
||||
HandlePlacePresize();
|
||||
@@ -2040,6 +2043,11 @@ void HandleMouseEvents()
|
||||
}
|
||||
|
||||
MouseLoop(click, mousewheel);
|
||||
|
||||
/* We have moved the mouse the required distance,
|
||||
* no need to move it at any later time. */
|
||||
_cursor.delta.x = 0;
|
||||
_cursor.delta.y = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -139,11 +139,26 @@ public:
|
||||
Window(const WindowDesc *desc, WindowNumber number = 0);
|
||||
|
||||
virtual ~Window();
|
||||
/* Don't allow arrays; arrays of Windows are pointless as you need
|
||||
* to destruct them all at the same time too, which is kinda hard. */
|
||||
FORCEINLINE void *operator new[](size_t size) { NOT_REACHED(); }
|
||||
/* Don't free the window directly; it corrupts the linked list when iterating */
|
||||
FORCEINLINE void operator delete(void *ptr, size_t size) {}
|
||||
|
||||
/**
|
||||
* Helper allocation function to disallow something.
|
||||
* Don't allow arrays; arrays of Windows are pointless as you need
|
||||
* to destruct them all at the same time too, which is kinda hard.
|
||||
* @param size the amount of space not to allocate
|
||||
*/
|
||||
FORCEINLINE void *operator new[](size_t size)
|
||||
{
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper allocation function to disallow something.
|
||||
* Don't free the window directly; it corrupts the linked list when iterating
|
||||
* @param ptr the pointer not to free
|
||||
*/
|
||||
FORCEINLINE void operator delete(void *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
uint16 flags4; ///< Window flags, @see WindowFlags
|
||||
WindowClass window_class; ///< Window class
|
||||
@@ -380,7 +395,7 @@ public:
|
||||
void DrawViewport() const;
|
||||
void DrawSortButtonState(int widget, SortButtonState state) const;
|
||||
|
||||
void DeleteChildWindows() const;
|
||||
void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
|
||||
|
||||
void SetDirty() const;
|
||||
|
||||
|
@@ -7,8 +7,6 @@
|
||||
|
||||
#include "zoom_type.h"
|
||||
|
||||
extern ZoomLevel _saved_scrollpos_zoom;
|
||||
|
||||
/**
|
||||
* Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)
|
||||
* When shifting right, value is rounded up
|
||||
|
@@ -37,4 +37,6 @@ enum ZoomLevel {
|
||||
};
|
||||
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
|
||||
|
||||
typedef SimpleTinyEnumT<ZoomLevel, byte> ZoomLevelByte;
|
||||
|
||||
#endif /* ZOOM_TYPE_H */
|
||||
|
Reference in New Issue
Block a user