Merge 1.10.0-beta1

This commit is contained in:
dP
2019-11-01 16:08:44 +03:00
parent 4bf7002873
commit ceea4c88be
920 changed files with 26309 additions and 16944 deletions

4
.gitignore vendored
View File

@@ -50,3 +50,7 @@ src/os/windows/ottdres.rc
!/config.lib
!*.in
*.tmp
/bin/data/*
/game
/openttd

141
COMPILING.md Normal file
View File

@@ -0,0 +1,141 @@
# Compiling OpenTTD
## Required/optional libraries
The following libraries are used by OpenTTD for:
- zlib: (de)compressing of old (0.3.0-1.0.5) savegames, content downloads,
heightmaps
- liblzo2: (de)compressing of old (pre 0.3.0) savegames
- liblzma: (de)compressing of savegames (1.1.0 and later)
- libpng: making screenshots and loading heightmaps
- libfreetype: loading generic fonts and rendering them
- libfontconfig: searching for fonts, resolving font names to actual fonts
- libicu: handling of right-to-left scripts (e.g. Arabic and Persian) and
natural sorting of strings (Linux only)
- libSDL2: hardware access (video, sound, mouse) (not required for Windows or macOS)
OpenTTD does not require any of the libraries to be present, but without
liblzma you cannot open most recent savegames and without zlib you cannot
open most older savegames or use the content downloading system.
Without libSDL/liballegro on non-Windows and non-macOS machines you have
no graphical user interface; you would be building a dedicated server.
## Windows:
You need Microsoft Visual Studio 2015 Update 3 or newer.
You can download the free Visual Studio Community Edition from Microsoft at
https://visualstudio.microsoft.com/vs/community/.
OpenTTD needs the Platform SDK, if it isn't installed already. This can be
done during installing Visual Studio, by selecting
`Visual C++ MFC for x86 and x64` (and possibly
`Visual C++ ATL for x86 and x64` depending on your version). If not, you
can get download it as [MS Windows Platform SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk).
Install the SDK by following the instructions as given.
Dependencies for OpenTTD on Windows are handled via
[vcpkg](https://github.com/Microsoft/vcpkg/). First you need to install vcpkg
by following the `Quick Start` instructions of their
[README](https://github.com/Microsoft/vcpkg/blob/master/README.md).
After this, you can install the dependencies OpenTTD needs. We advise to use
the `static` versions, and OpenTTD currently needs the following dependencies:
- liblzma
- libpng
- lzo
- zlib
To install both the x64 (64bit) and x86 (32bit) variants (though only one is necessary), you can use:
```ps
.\vcpkg install liblzma:x64-windows-static libpng:x64-windows-static lzo:x64-windows-static zlib:x64-windows-static
.\vcpkg install liblzma:x86-windows-static libpng:x86-windows-static lzo:x86-windows-static zlib:x86-windows-static
```
Open the relevant project file and it should build automatically.
- VS 2015: projects/openttd_vs140.sln
- VS 2017: projects/openttd_vs141.sln
- VS 2019: projects/openttd_vs142.sln
Set the build mode to `Release` in
`Build > Configuration manager > Active solution configuration`.
You can now compile.
If everything works well the binary should be in `objs\Win[32|64]\Release\openttd.exe`
and in `bin\openttd.exe`
The OpenTTD wiki may provide additional help with [compiling for Windows](https://wiki.openttd.org/Compiling_on_Windows_using_Microsoft_Visual_C%2B%2B_2015).
You can also build OpenTTD with MSYS2/MinGW-w64 or Cygwin/MinGW using the Makefile. The OpenTTD wiki may provide additional help with [MSYS2](https://wiki.openttd.org/Compiling_on_Windows_using_MSYS2)
## Linux, Unix, Solaris:
OpenTTD can be built with GNU '`make`'. On non-GNU systems it is called '`gmake`'.
However, for the first build one has to do a '`./configure`' first.
The OpenTTD wiki may provide additional help with:
- [compiling for Linux and *BSD](https://wiki.openttd.org/Compiling_on_%28GNU/%29Linux_and_*BSD)
- [compiling for Solaris](https://wiki.openttd.org/Compiling_on_Solaris)
## macOS:
Use '`make`' or Xcode (which will then call make for you)
This will give you a binary for your CPU type (PPC/Intel)
However, for the first build one has to do a '`./configure`' first.
To make a universal binary type '`./configure --enable-universal`'
instead of '`./configure`'.
The OpenTTD wiki may provide additional help with [compiling for macOS](https://wiki.openttd.org/Compiling_on_Mac_OS_X).
## Haiku:
Use '`make`', but do a '`./configure`' before the first build.
The OpenTTD wiki may provide additional help with [compiling for Haiku](https://wiki.openttd.org/Compiling_on_Haiku).
## OS/2:
A comprehensive GNU build environment is required to build the OS/2 version.
The OpenTTD wiki may provide additional help with [compiling for OS/2](https://wiki.openttd.org/Compiling_on_OS/2).
## Supported compilers
The following compilers are tested with and known to compile OpenTTD:
- Microsoft Visual C++ (MSVC) 2015, 2017 and 2019.
- GNU Compiler Collection (GCC) 4.8 - 9.
- Clang/LLVM 3.9 - 8
The following compilers are known not to compile OpenTTD:
In general, this is because these old versions do not (fully) support modern
C++11 language features.
- Microsoft Visual C++ (MSVC) 2013 and earlier.
- GNU Compiler Collection (GCC) 4.7 and earlier.
- Clang/LLVM 3.8 and earlier.
If any of these, or any other, compilers can compile OpenTTD, let us know.
Pull requests to support more compilers are welcome.
## Compilation of base sets
To recompile the extra graphics needed to play with the original Transport
Tycoon Deluxe graphics you need GRFCodec (which includes NFORenum) as well.
GRFCodec can be found at https://www.openttd.org/download-grfcodec.
The compilation of these extra graphics does generally not happen, unless
you remove the graphics file using '`make maintainer-clean`'.
Re-compilation of the base sets, thus also use of '`--maintainer-clean`' can
leave the repository in a modified state as different grfcodec versions can
cause binary differences in the resulting grf. Also translations might have
been added for the base sets which are not yet included in the base set
information files. Use the configure option '`--without-grfcodec`' to avoid
modification of the base set files by the build process.

View File

@@ -5,21 +5,26 @@ Looking to contribute something to OpenTTD? **Here's how you can help.**
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project.
In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
## Using the issue tracker
The [issue tracker](https://github.com/OpenTTD/OpenTTD/issues) is the preferred channel for [bug reports](#bug-reports), but please respect the following restrictions:
* Please **do not** use the issue tracker for help playing or using OpenTTD. Please try [irc](https://wiki.openttd.org/IRC_channel), or the [forums](https://www.tt-forums.net/)
* Please **do not** use the issue tracker for help playing or using OpenTTD.
Please try [irc](https://wiki.openttd.org/IRC_channel), or the [forums](https://www.tt-forums.net/)
* Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
* Please **do not** post comments consisting solely of "+1" or ":thumbsup:".
Use [GitHub's "reactions" feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) instead. We reserve the right to delete comments which violate this rule.
Use [GitHub's "reactions" feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) instead.
We reserve the right to delete comments which violate this rule.
* Please **do not** open issues or pull requests regarding add-on content in NewGRF, GameScripts, AIs, etc.
These are created by third-parties. Please try [irc](https://wiki.openttd.org/IRC_channel) or the [forums](https://www.tt-forums.net/) to discuss these.
* Please **do not** open issues or pull requests regarding add-on content in NewGRF, GameScripts, AIs, etc. These are created by third-parties. Please try [irc](https://wiki.openttd.org/IRC_channel) or the [forums](https://www.tt-forums.net/) to discuss these.
## Bug reports
@@ -69,13 +74,15 @@ Example:
> causing the bug, and potential solutions (and your opinions on their
> merits).
## Feature requests
Before opening a feature request, please take a moment to find out whether your idea fits with the scope and aims of the project.
Before opening a feature request, please take a moment to find out whether your idea fits with the [scope and goals](./CONTRIBUTING.md#project-goals) of the project.
It's up to *you* to make a strong case to convince the project's developers of the merits of this feature.
Please provide as much detail and context as possible. This means don't request for a solution, but describe the problem you see and how/why you think it should be fixed.
Please provide as much detail and context as possible.
This means don't request for a solution, but describe the problem you see and how/why you think it should be fixed.
For feature request we have a strict policy.
@@ -88,14 +95,18 @@ Many of those ideas etc do have a place on the [forums](https://www.tt-forums.ne
It's usually best discuss in [irc](https://wiki.openttd.org/IRC_channel) before opening a feature request or working on a large feature in a fork.
Discussion in irc can take time, but it can be productive and avoid disappointment :)
## Pull requests
Good pull requests—patches, improvements, new features—are a fantastic help.
They should remain focused in scope and avoid containing unrelated commits.
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
Pull requests should fit with the [goals of the project](./CONTRIBUTING.md#project-goals).
Please adhere to the [coding guidelines](#code-guidelines) used throughout the project (indentation, accurate comments, etc.) and any other requirements (such as test coverage).
**Please do ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
Every pull request should have a clear scope, with no unrelated commits.
[Code style](https://wiki.openttd.org/Coding_style) must be complied with for pull requests to be accepted; this also includes [commit message format](https://wiki.openttd.org/Coding_style#Commit_message).
Adhering to the following process is the best way to get your work included in the project:
@@ -147,17 +158,8 @@ git push
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description against the `master` branch.
**IMPORTANT**: By submitting a patch, you agree to the [License](#license).
**IMPORTANT**: By submitting a pull request or patch, you agree to the [License](#license) and the [Privacy Notice](CONTRIBUTING.md#privacy-notice).
### Privacy Notice
We would like to make you aware that contributing to OpenTTD via git will permanently store the name and email address you provide as well as the actual changes and the time and date you made it inside git's version history.
This is inevitable, because it is a main feature of git. If you are concerned about your privacy, we strongly recommend to use "Anonymous <anonymous@openttd.org>" as the git commit author. We might refuse anonymous contributions if malicious intent is suspected.
Please note that the contributor identity, once given, is used for copyright verification and to provide proof should a malicious commit be made. As such, the [EU GDPR](https://www.eugdpr.org/key-changes.html) "right to be forgotten" does not apply, as this is an overriding legitimate interest.
Please also note that your commit is public and as such will potentially be processed by many third-parties. Git's distributed nature makes it impossible to track where exactly your commit, and thus your personal data, will be stored and be processed. If you would not like to accept this risk, please do either commit anonymously or refrain from contributing to the OpenTTD project.
### Pull request validation
@@ -165,15 +167,99 @@ Continuous integration (CI) tools monitor pull requests, and help us identify bu
The results of the CI tests will show on your pull request.
By clicking on Details you can further zoom in; in case of a failure it will show you why it failed. In case of success it will report how awesome you were.
By clicking on Details you can further zoom in; in case of a failure it will show you why it failed.
In case of success it will report how awesome you were.
## Code guidelines
Tip: [commit message format](https://wiki.openttd.org/Coding_style#Commit_message) is a common reason for pull requests to fail validation.
[Code style](https://wiki.openttd.org/Coding_style) must be adhered to for pull requests to be accepted
## License
### Are there any development docs?
There is no single source for OpenTTD development docs. It's a complex project with a long history, and multiple APIs.
A good entry point is [Development](https://wiki.openttd.org/Development) on the OpenTTD wiki; this provides links to wiki documentation and other sources.
The GitHub repo also includes some non-comprehensive documentation in [/docs](./docs).
You may also want the guide to [compiling OpenTTD](./COMPILING.md).
## Project goals
### What are the goals of the official branch?
The main goals of the official branch are:
- Stay faithful to the original gameplay from Transport Tycoon Deluxe
- Improve the user interface
- Allow extending the gameplay with add-ons / mods via supported content APIs
- Provide a (relatively) stable core for both players of the official branch, and for authors of add-ons and maintainers of patchpacks
In contrast, extending or altering the gameplay of the base game is not encouraged.
The rationale behind these goals is that people have different opinions about what OpenTTD is and what it should be.
When it comes to gameplay, there are at least these groups of people:
- *Model railway (mostly singleplayer)*: build "realistic" landscapes, roleplay a world, or even replicate historical scenarios
- *Economical challenge (mostly singleplayer)*: run a business with economical challenges
- *Transport challenge (singleplayer or cooperative multiplayer)*: build efficient track layouts with high cargo throughput and tons of vehicles
- *Competitive speed run (competitive multiplayer)*: maximize some goal in some limited amount of time
When it comes to gameplay features there are at least these groups of interests:
- *Control freak:* micromanagement like conditional orders, refitting and loading etc.
- *Casual:* automatisation like cargodist, path based signalling etc.
To please everyone, the official branch tries to stay close to the original gameplay; after all, that is what everyone brought here.
The preferred method to alter and extent the gameplay is via add-ons like NewGRF and GameScripts.
For a long time, the official branch was also open to features which could be enabled/disabled, but the corner-cases that came with some configurations have rendered some parts of the code very complicated.
Today, new features have to work with all the already existing features, which is not only challenging in corner cases, but also requires spending considerable more work than just "making it work in the game mode that I play".
The preferred method to introduce new gameplay features is to extend the content APIs, supporting ever more add-on content / mods.
This moves conflict-solving away from the codebase to content authors / players.
It is more accepted for add-ons not working together than the base game not working with certain setting combinations.
In general the game should allow anything that doesn't violate basic rules, but it should warn players if they take potentially dangerous or "stupid" actions.
For example, players are not prevented from starting vehicles without orders, but will receive a warning about vehicles having too few orders.
This lack of limitation has led to players challenging themselves to create networks where all vehicles have no orders, increasing gameplay possibilities.
### I do not agree with the goals of the official branch, what can I do instead?
Fork! There is a rich history of experimental patches for OpenTTD.
Many of these will never be accepted for core, but are creative and interesting ways to modify OpenTTD.
Sometimes patches are combined into long-running patchpacks, modified OpenTTD versions which can be downloaded by anyone, or modified OpenTTD clients for dedicated multiplayer servers.
One of the reasons to keep core relatively stable is to make life easier for patch authors and patchpack maintainers where possible.
Patchpack discussions and related topics may be found in community sites such as [TT-Forums development section](https://www.tt-forums.net/viewforum.php?f=33).
## Legal stuff
### License
By contributing your code, you agree to license your contribution under the [GPL v2](https://github.com/OpenTTD/OpenTTD/blob/master/COPYING.md).
### Privacy Notice
We would like to make you aware that contributing to OpenTTD via git will permanently store the name and email address you provide as well as the actual changes and the time and date you made it inside git's version history.
This is inevitable, because it is a main feature of git.
If you are concerned about your privacy, we strongly recommend to use "Anonymous <anonymous@openttd.org>" as the git commit author. We might refuse anonymous contributions if malicious intent is suspected.
Please note that the contributor identity, once given, is used for copyright verification and to provide proof should a malicious commit be made.
As such, the [EU GDPR](https://www.eugdpr.org/key-changes.html) "right to be forgotten" does not apply, as this is an overriding legitimate interest.
Please also note that your commit is public and as such will potentially be processed by many third-parties.
Git's distributed nature makes it impossible to track where exactly your commit, and thus your personal data, will be stored and be processed.
If you would not like to accept this risk, please do either commit anonymously or refrain from contributing to the OpenTTD project.
By contributing your code, you agree to license your contribution under the [GPL v2](https://github.com/OpenTTD/OpenTTD/blob/master/COPYING).
### Attribution of this Contributing Guide

339
COPYING.md Normal file
View File

@@ -0,0 +1,339 @@
This is the license which applies to OpenTTD with the exception of some
3rd party modules. See [./README.md](./README.md) for details
GNU General Public License
==========================
_Version 2, June 1991_
_Copyright © 1989, 1991 Free Software Foundation, Inc.,_
_51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA_
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
### Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: **(1)** copyright the software, and
**(2)** offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
**0.** This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
**1.** You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
**2.** You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
* **a)** You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
* **b)** You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
* **c)** If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
**3.** You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
* **a)** Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
* **b)** Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
* **c)** Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
**4.** You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
**5.** You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
**6.** Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
**7.** If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
**8.** If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
**9.** The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
**10.** If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
### NO WARRANTY
**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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; either version 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w` and `show c` should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w` and `show c`; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -289,16 +289,15 @@ EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = ENABLE_NETWORK \
WITH_ZLIB \
PREDEFINED = WITH_ZLIB \
WITH_LZO \
WITH_LZMA \
WITH_LIBLZMA \
WITH_SDL \
WITH_PNG \
WITH_FONTCONFIG \
WITH_FREETYPE \
WITH_ICU_SORT \
WITH_ICU_LAYOUT \
WITH_ICU_I18N \
WITH_ICU_LX \
UNICODE \
_UNICODE \
_GNU_SOURCE \

View File

@@ -70,9 +70,9 @@ endif
$(Q)cp "$(BIN_DIR)/baseset/"*.obm "$(BASESET_DIR)/"
$(Q)cp "$(BIN_DIR)/lang/"*.lng "$(LANG_DIR)/"
$(Q)cp "$(ROOT_DIR)/README.md" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/COPYING" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/COPYING.md" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/"
$(Q)cp "$(ROOT_DIR)/docs/multiplayer.md" "$(BUNDLE_DIR)/docs/"
$(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/"
ifdef MAN_DIR
$(Q)mkdir -p "$(BUNDLE_DIR)/man/"
@@ -88,13 +88,7 @@ ifdef MENU_DIR
$(Q)sed s/=openttd/=$(BINARY_NAME)/g "$(BUNDLE_DIR)/media/openttd.desktop" > "$(ROOT_DIR)/media/openttd.desktop.install"
endif
ifeq ($(TTD), openttd.exe)
$(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/README.md" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt"
ifeq ($(OS), DOS)
$(Q)cp "$(ROOT_DIR)/os/dos/cwsdpmi/cwsdpmi.txt" "$(BUNDLE_DIR)/docs/"
ifndef STRIP
$(Q)cp "$(ROOT_DIR)/os/dos/cwsdpmi/cwsdpmi.exe" "$(TTD_DIR)/"
endif
endif
$(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/README.md" "$(BUNDLE_DIR)/COPYING.md" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt"
endif
### Packing the current bundle into several compressed file formats ###
@@ -159,7 +153,7 @@ bundle_dmg: bundle
bundle_exe: all
@echo '[BUNDLE] Creating $(BUNDLE_NAME).exe'
$(Q)mkdir -p "$(BUNDLES_DIR)"
$(Q)unix2dos "$(ROOT_DIR)/docs/"*.txt "$(ROOT_DIR)/README.md" "$(ROOT_DIR)/COPYING" "$(ROOT_DIR)/changelog.txt" "$(ROOT_DIR)/known-bugs.txt"
$(Q)unix2dos "$(ROOT_DIR)/docs/"* "$(ROOT_DIR)/README.md" "$(ROOT_DIR)/COPYING.md" "$(ROOT_DIR)/changelog.txt" "$(ROOT_DIR)/known-bugs.txt"
$(Q)cd $(ROOT_DIR)/os/windows/installer && makensis.exe //DVERSION_INCLUDE=version_$(PLATFORM).txt install.nsi
$(Q)mv $(ROOT_DIR)/os/windows/installer/*$(PLATFORM).exe "$(BUNDLES_DIR)/$(BUNDLE_NAME).exe"
@@ -196,7 +190,7 @@ ifndef DO_NOT_INSTALL_CHANGELOG
endif
ifndef DO_NOT_INSTALL_LICENSE
$(Q)install -d "$(INSTALL_DOC_DIR)"
$(Q)install -m 644 "$(BUNDLE_DIR)/COPYING" "$(INSTALL_DOC_DIR)"
$(Q)install -m 644 "$(BUNDLE_DIR)/COPYING.md" "$(INSTALL_DOC_DIR)"
endif
$(Q)install -m 644 "$(BUNDLE_DIR)/media/openttd.32.xpm" "$(INSTALL_ICON_DIR)/${BINARY_NAME}.32.xpm"
ifdef ICON_THEME_DIR

View File

@@ -50,7 +50,7 @@ RES := $(shell if [ ! -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CA
all: config.pwd config.cache
ifdef DISTCC
@if [ -z "`echo '$(MFLAGS)' | grep '\-j'`" ]; then echo; echo "WARNING: you enabled distcc support, but you don't seem to be using the -jN paramter"; echo; fi
@if [ -z "`echo '$(MFLAGS)' | grep '\-j'`" ]; then echo; echo "WARNING: you enabled distcc support, but you don't seem to be using the -jN parameter"; echo; fi
endif
@for dir in $(DIRS); do \
$(MAKE) -C $$dir all || exit 1; \

View File

@@ -139,7 +139,7 @@ $(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP)
$(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_RC:%.o=%.d): %.d: $(SRC_DIR)/%.rc $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.rc=%.rc)'
@@ -249,7 +249,7 @@ $(filter %sse4.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
$(OBJS_RC): %.o: $(SRC_DIR)/%.rc $(FILE_DEP)
$(E) '$(STAGE) Compiling resource $(<:$(SRC_DIR)/%.rc=%.rc)'
@@ -270,10 +270,6 @@ $(TTD): $(OBJS) $(CONFIG_CACHE_LINKER)
ifdef STRIP
$(Q)$(STRIP) $@
endif
ifeq ($(OS), DOS)
$(E) '$(STAGE) Adding CWSDPMI stub to $@'
$(Q)$(ROOT_DIR)/os/dos/make_dos_binary_selfcontained.sh $(SRC_OBJS_DIR)/$@
endif
# Revision files

180
README.md
View File

@@ -3,6 +3,8 @@
## Table of contents
- 1.0) [About](#10-about)
- 1.1) [Compiling OpenTTD](#11-compiling-openttd)
- 1.2) [Contributing to OpenTTD](#12-contributing-to-openttd)
- 2.0) [Contacting](#20-contacting)
- 2.1) [Reporting bugs](#21-reporting-bugs)
- 2.2) [Reporting desyncs](#22-reporting-desyncs)
@@ -16,15 +18,11 @@
- 5.1) [Logging of potentially dangerous actions](#51-logging-of-potentially-dangerous-actions)
- 5.2) [Frame rate and performance metrics](#52-frame-rate-and-performance-metrics)
- 6.0) [Configuration file](#60-configuration-file)
- 7.0) [Compiling](#70-compiling)
- 7.1) [Required/optional libraries](#71-requiredoptional-libraries)
- 7.2) [Supported compilers](#72-supported-compilers)
- 7.3) [Compilation of base sets](#73-compilation-of-base-sets)
- 8.0) [Translating](#80-translating)
- 8.1) [Translation](#81-translation)
- 8.2) [Previewing](#82-previewing)
- 9.0) [Troubleshooting](#90-troubleshooting)
- 10.0) [Licensing](#100-licensing)
- 7.0) [Translating](#70-translating)
- 7.1) [Translation](#71-translation)
- 7.2) [Previewing](#72-previewing)
- 8.0) [Troubleshooting](#80-troubleshooting)
- 9.0) [Licensing](#90-licensing)
- X.X) [Credits](#xx-credits)
## 1.0) About
@@ -37,6 +35,14 @@ OpenTTD is licensed under the GNU General Public License version 2.0,
but includes some 3rd party software under different licenses. See the
section "Licensing" below for details.
## 1.1) Compiling OpenTTD
Instructions for compiling OpenTTD can be found in [./COMPILING.md](COMPILING.md)
## 1.2) Contributing to OpenTTD
We welcome contributors to OpenTTD. More information for contributors can be found in [./CONTRIBUTING.md](CONTRIBUTING.md)
## 2.0) Contacting
The easiest way to contact the OpenTTD team is by submitting bug reports or
@@ -152,12 +158,10 @@ OpenTTD has been ported to several platforms and operating systems. It should
not be very difficult to port it to a new platform. The currently working
platforms are:
- BeOS (SDL or Allegro)
- DOS (Allegro)
- FreeBSD (SDL)
- Haiku (SDL)
- Linux (SDL or Allegro)
- macOS (universal) (Cocoa video and sound drivers)
- MorphOS (SDL)
- OpenBSD (SDL)
- OS/2 (SDL)
- Windows (Win32 GDI (faster) or SDL or Allegro)
@@ -513,136 +517,7 @@ When you cannot find openttd.cfg you should look in the directories as
described in section 4.2. If you do not have an openttd.cfg OpenTTD will
create one after closing.
## 7.0) Compiling
### Windows:
You need Microsoft Visual Studio 2015 Update 3 or more recent. Open the project file
and it should build automatically. In case you want to build with SDL support
you need to add WITH_SDL to the project settings.
PNG (WITH_PNG), ZLIB (WITH_ZLIB), LZO (WITH_LZO), Freetype (WITH_FREETYPE) and
LZMA (WITH_LZMA) support is enabled by default. For these to work you need their
development files. To get them just use vcpkg from https://github.com/Microsoft/vcpkg
using x86-windows-static and x64-windows-static triplets.
For more help with VS see docs/Readme_Windows_MSVC.md.
You can also build it using the Makefile with MSYS/MinGW or Cygwin/MinGW.
Please read the Makefile for more information.
### Solaris, FreeBSD, OpenBSD:
Use '`gmake`', but do a '`./configure`' before the first build.
### Linux/Unix:
OpenTTD can be built with GNU '`make`'. On non-GNU systems it is called '`gmake`'.
However, for the first build one has to do a '`./configure`' first.
### macOS:
Use '`make`' or Xcode (which will then call make for you)
This will give you a binary for your CPU type (PPC/Intel)
However, for the first build one has to do a '`./configure`' first.
To make a universal binary type '`./configure --enabled-universal`'
instead of '`./configure`'.
### BeOS:
Use '`make`', but do a '`./configure`' before the first build.
### MorphOS:
Use '`make`'. However, for the first build one has to do a '`./configure`'
first. Note that you need the MorphOS SDK, latest libnix updates (else C++
parts of OpenTTD will not build) and the powersdl.library SDK. Optionally libz,
libpng and freetype2 developer files.
### OS/2:
A comprehensive GNU build environment is required to build the OS/2 version.
See the docs/Readme_OS2.txt file for more information.
### DOS:
A build environment with DJGPP is needed as well as libraries such as
Allegro, zlib and libpng, which all can be downloaded from the DJGPP
website. Compilation is straight forward: use '`make`', but do a '`./configure`'
before the first build. The build binary will need cwsdpmi.exe to be in
the same directory as the openttd executable. cwsdpmi.exe can be found in
the os/dos/cwsdpmi subdirectory. If you compile with stripping turned on a
binary will be generated that does not need cwsdpmi.exe by adding the
cswdstub.exe to the created OpenTTD binary.
### 7.1) Required/optional libraries
The following libraries are used by OpenTTD for:
- libSDL/liballegro: hardware access (video, sound, mouse)
- zlib: (de)compressing of old (0.3.0-1.0.5) savegames, content downloads,
heightmaps
- liblzo2: (de)compressing of old (pre 0.3.0) savegames
- liblzma: (de)compressing of savegames (1.1.0 and later)
- libpng: making screenshots and loading heightmaps
- libfreetype: loading generic fonts and rendering them
- libfontconfig: searching for fonts, resolving font names to actual fonts
- libicu: handling of right-to-left scripts (e.g. Arabic and Persian) and
natural sorting of strings.
OpenTTD does not require any of the libraries to be present, but without
liblzma you cannot open most recent savegames and without zlib you cannot
open most older savegames or use the content downloading system.
Without libSDL/liballegro on non-Windows and non-macOS machines you have
no graphical user interface; you would be building a dedicated server.
### 7.2) Supported compilers
The following compilers are known to compile OpenTTD:
- Microsoft Visual C++ (MSVC) 2015, 2017 and 2019.
- GNU Compiler Collection (GCC) 3.3 - 4.4, 4.6 - 4.8.
- Versions 4.1 and earlier give bogus warnings about uninitialised variables.
- Versions 4.4, 4.6 give bogus warnings about freeing non-heap objects.
- Versions 4.6 and later give invalid warnings when lto is enabled.
- Intel C++ Compiler (ICC) 12.0.
- Clang/LLVM 2.9 - 3.0
Version 2.9 gives bogus warnings about code nonconformity.
The following compilers are known not to compile OpenTTD:
- Microsoft Visual C++ (MSVC) 2013 and earlier.
These old versions do not support modern C++ language features.
- GNU Compiler Collection (GCC) 3.2 and earlier.
These old versions fail due to OpenTTD's template usage.
- GNU Compiler Collection (GCC) 4.5. It optimizes enums too aggressively.
See https://github.com/OpenTTD/OpenTTD/issues/5513 and references therein.
- Intel C++ Compiler (ICC) 11.1 and earlier.
- Version 10.0 and earlier fail a configure check and fail with recent
system headers.
- Version 10.1 fails to compile station_gui.cpp.
- Version 11.1 fails with an internal error when compiling network.cpp.
- Clang/LLVM 2.8 and earlier.
- (Open) Watcom.
If any of these compilers can compile OpenTTD again, please let us know.
Patches to support more compilers are welcome.
### 7.3) Compilation of base sets
To recompile the extra graphics needed to play with the original Transport
Tycoon Deluxe graphics you need GRFCodec (which includes NFORenum) as well.
GRFCodec can be found at https://www.openttd.org/download-grfcodec.
The compilation of these extra graphics does generally not happen, unless
you remove the graphics file using '`make maintainer-clean`'.
Re-compilation of the base sets, thus also use of '`--maintainer-clean`' can
leave the repository in a modified state as different grfcodec versions can
cause binary differences in the resulting grf. Also translations might have
been added for the base sets which are not yet included in the base set
information files. Use the configure option '`--without-grfcodec`' to avoid
modification of the base set files by the build process.
## 8.0) Translating
## 7.0) Translating
See https://www.openttd.org/development for up-to-date information.
@@ -657,7 +532,7 @@ Please contact the translations manager (https://www.openttd.org/contact)
before beginning the translation process! This avoids double work, as
someone else may have already started translating to the same language.
### 8.1) Translation
### 7.1) Translation
So, now that you have notified the development team about your intention to
translate (You did, right? Of course you did.) you can pick up english.txt
@@ -675,7 +550,7 @@ Note: Do not alter the following parts of the file:
- Lines beginning with ## (such as ##id), other than the first two lines
of the file
### 8.2) Previewing
### 7.2) Previewing
In order to view the translation in the game, you need to compile your language
file with the strgen utility. As this utility is tailored to a specific OpenTTD
@@ -695,7 +570,7 @@ should also be.
That is all! You should now be able to select the language in the game options.
## 9.0) Troubleshooting
## 8.0) Troubleshooting
To see all startup options available to you, start OpenTTD with the
'`./openttd -h`' option. This might help you tweak some of the settings.
@@ -740,10 +615,10 @@ or [GRFCrawler](https://grfcrawler.tt-forums.net). Put the NewGRF files in
OpenTTD's newgrf folder (see section 4.2 'OpenTTD directories') and rescan the
list of available NewGRFs. Once you have all missing files, you are set to go.
## 10.0) Licensing
## 9.0) Licensing
OpenTTD is licensed under the GNU General Public License version 2.0. For
the complete license text, see the file 'COPYING'. This license applies
the complete license text, see the file 'COPYING.md'. This license applies
to all files in this distribution, except as noted below.
The squirrel implementation in src/3rdparty/squirrel is licensed under
@@ -760,16 +635,6 @@ License 2.1, and partly under the (3-clause) BSD license. The exact licensing
terms can be found in src/3rdparty/os2/getaddrinfo.c resp.
src/3rdparty/os2/getnameinfo.c.
The exe2coff implementation in os/dos/exe2coff is available under the
GPL, with a number of additional terms. See os/dos/exe2coff/copying and
os/dos/exe2coff/copying.dj for the exact licensing terms.
The CWSDPMI implementation in os/dos/cwsdpmi is distributed under a
custom binary-only license that prohibits modification. The exact
licensing terms can be found in os/dos/cwsdpmi/cwsdpmi.txt. The sources
for these files can be downloaded at its author site, at
http://homer.rice.edu/~sandmann/cwsdpmi/csdpmi5s.zip.
CONTRIBUTING.md is adapted from
[Bootstrap](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md)
under the [Creative Commons Attribution 3.0 Unported
@@ -786,6 +651,7 @@ terms for Bootstrap documentation.
- Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)
- Christoph Elsenhans (frosch) - General coding (since 0.6)
- Loïc Guilloux (glx) - Windows Expert (since 0.4.5)
- Charles Pigott (LordAro) - General / Correctness police (since 1.9)
- Michael Lutz (michi_cc) - Path based signals (since 0.7)
- Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)
- Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)

View File

@@ -25,6 +25,7 @@ jobs:
- template: azure-pipelines/templates/windows-build.yml
parameters:
BuildPlatform: $(BuildPlatform)
BuildConfiguration: Debug
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
cd projects
@@ -40,8 +41,8 @@ jobs:
matrix:
commit-checker:
Tag: 'commit-checker'
linux-amd64-clang-3.8:
Tag: 'linux-amd64-clang-3.8'
linux-amd64-clang-3.9:
Tag: 'linux-amd64-clang-3.9'
linux-amd64-gcc-6:
Tag: 'linux-amd64-gcc-6'
linux-i386-gcc-6:

View File

@@ -88,6 +88,7 @@ jobs:
- template: windows-build.yml
parameters:
BuildPlatform: $(BuildPlatform)
BuildConfiguration: Release
- bash: |
set -ex
make -f Makefile.msvc bundle_pdb bundle_zip PLATFORM=$(BundlePlatform) BUNDLE_NAME=openttd-$(Build.BuildNumber)-windows-$(BundlePlatform)
@@ -118,14 +119,14 @@ jobs:
Tag: 'linux-ubuntu-bionic-i386-gcc'
linux-ubuntu-bionic-amd64-gcc:
Tag: 'linux-ubuntu-bionic-amd64-gcc'
linux-debian-jessie-i386-gcc:
Tag: 'linux-debian-jessie-i386-gcc'
linux-debian-jessie-amd64-gcc:
Tag: 'linux-debian-jessie-amd64-gcc'
linux-debian-stretch-i386-gcc:
Tag: 'linux-debian-stretch-i386-gcc'
linux-debian-stretch-amd64-gcc:
Tag: 'linux-debian-stretch-amd64-gcc'
linux-debian-buster-i386-gcc:
Tag: 'linux-debian-buster-i386-gcc'
linux-debian-buster-amd64-gcc:
Tag: 'linux-debian-buster-amd64-gcc'
steps:
- template: release-fetch-source.yml

View File

@@ -7,5 +7,5 @@ steps:
inputs:
solution: 'projects/openttd_vs141.sln'
platform: ${{ parameters.BuildPlatform }}
configuration: Release
configuration: ${{ parameters.BuildConfiguration }}
maximumCpuCount: true

8
bin/ai/compat_1.10.nut Normal file
View File

@@ -0,0 +1,8 @@
/* $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/>.
*/

View File

@@ -6,3 +6,5 @@
* 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/>.
*/
AILog.Info("1.9 API compatibility in effect.");

View File

@@ -46,9 +46,9 @@ cat ai/regression/tst_*/main.nut | tr ';' '\n' | awk '
}
}
}
# We want to remove everything before the FIRST occurence of AI.
# If we do not remove any other occurences of AI from the string
# we will remove everything before the LAST occurence of AI, so
# We want to remove everything before the FIRST occurrence of AI.
# If we do not remove any other occurrences of AI from the string
# we will remove everything before the LAST occurrence of AI, so
# do some little magic to make it work the way we want.
sub("AI", "AXXXXY")
gsub("AI", "AXXXXX")

View File

@@ -6,7 +6,7 @@ class Regression extends AIInfo {
function GetShortName() { return "REGR"; }
function GetDescription() { return "This runs regression-tests on some commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
function GetAPIVersion() { return "1.9"; }
function GetAPIVersion() { return "1.10"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "Regression"; }
}

View File

@@ -1704,6 +1704,19 @@ function Regression::Vehicle()
print(" GetWagonEngineType(): " + AIVehicle.GetWagonEngineType(17 3));
print(" GetWagonAge(): " + AIVehicle.GetWagonAge(17, 3));
print(" --Refit--");
print(" GetBuildWithRefitCapacity(): " + AIVehicle.GetBuildWithRefitCapacity(28479, 211, 255));
print(" GetBuildWithRefitCapacity(): " + AIVehicle.GetBuildWithRefitCapacity(28479, 211, 0));
print(" GetBuildWithRefitCapacity(): " + AIVehicle.GetBuildWithRefitCapacity(28479, 211, 9));
print(" BuildVehicleWithRefit(): " + AIVehicle.BuildVehicleWithRefit(28479, 211, 9));
print(" GetCapacity(): " + AIVehicle.GetCapacity(20, 9));
print(" GetCapacity(): " + AIVehicle.GetCapacity(20, 5));
print(" GetRefitCapacity(): " + AIVehicle.GetRefitCapacity(20, 5));
print(" RefitVehicle(): " + AIVehicle.RefitVehicle(20, 5));
print(" GetCapacity(): " + AIVehicle.GetCapacity(20, 9));
print(" GetCapacity(): " + AIVehicle.GetCapacity(20, 5));
print(" SellVehicle(): " + AIVehicle.SellVehicle(20));
print(" --Errors--");
print(" RefitVehicle(): " + AIVehicle.RefitVehicle(12, 0));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());

View File

@@ -8534,9 +8534,8 @@ ERROR: IsEnd() is invalid as Begin() is never called
19693 => 8
--TileList_IndustryProducing--
Count(): 92
Count(): 90
Location ListDump:
46920 => 1
46919 => 1
46918 => 1
46917 => 1
@@ -8545,7 +8544,6 @@ ERROR: IsEnd() is invalid as Begin() is never called
46914 => 1
46913 => 1
46912 => 1
46911 => 1
46664 => 1
46663 => 1
46662 => 1
@@ -9128,6 +9126,18 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetWagonAge(): 0
GetWagonEngineType(): 65535
GetWagonAge(): -1
--Refit--
GetBuildWithRefitCapacity(): -1
GetBuildWithRefitCapacity(): 0
GetBuildWithRefitCapacity(): 160
BuildVehicleWithRefit(): 20
GetCapacity(): 160
GetCapacity(): 0
GetRefitCapacity(): 160
RefitVehicle(): true
GetCapacity(): 0
GetCapacity(): 160
SellVehicle(): true
--Errors--
RefitVehicle(): false
GetLastErrorString(): ERR_VEHICLE_NOT_IN_DEPOT
@@ -9175,7 +9185,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
13 => 5489
12 => 5489
CurrentSpeed ListDump:
12 => 21
12 => 27
17 => 0
16 => 0
14 => 0

Binary file not shown.

Binary file not shown.

View File

@@ -6,3 +6,5 @@
* 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/>.
*/
GSLog.Info("1.9 API compatibility in effect.");

View File

@@ -1,3 +1,51 @@
1.10.0-beta1 (2019-10-29)
------------------------------------------------------------------------
- Feature: Configurable minimum age for companies before allowing share trading (#7780)
- Feature: Filter on town list window (#7621)
- Feature: Ability to show Newspaper and Ticker messages in parallel (#7612)
- Feature: Show coverage area for stations and towns (#7446)
- Feature: Collapsible vehicle groups (#7417)
- Feature: More flexible docks - can now have multiple per station, ships can use any part of dock (#7380)
- Feature: [NewGRF] Railtype flags to allow/disallow 90 degree curves (#7352)
- Feature/Change: Non-rectangular catchment area for sparse stations (#7235)
- Feature: Improved performance for road vehicle pathfinding (#7261)
- Feature: Option to show local authority boundary of towns (#7025)
- Feature: Experimental method of town cargo generation that scales linearly with population (#6965)
- Feature: [NewGRF] Houses and industries can accept/produce up to 16 different cargo types (#6867, #6872)
- Feature: [NewGRF] RoadTypes (NRT) (#6811)
- Add: [Win32] Select MIDI device by port name (#7666)
- Add: 'getsysdate' console command (#7658)
- Add: Currencies NTD, CNY, HKD (#7596)
- Add: Icons to vehicle construction drop down lists (#7358, #7485)
- Add: Security warning to players that company passwords are not truly secure (#7351)
- Add: [Script] Various API functions for managing vehicle groups (#7225, #7336, #7716)
- Add: SDL2 video driver (#7086)
- Change: Inactive industries do not make sound effects (#7752)
- Change: [Win32] Use native GDI engine for rendering fonts (#7572)
- Change: Scale oil refinery edge distance limit by map size (#7514)
- Change: Do not display a news message about old vehicles when a replacement for it is activated (#7401)
- Change: When filtering purchase list by cargo type, buy button now performs a refit if required (#7301)
- Change: Don't apply forbid 90 deg turn settings to ships, and make penalties for turns configurable (#7289, #7372)
- Change: Make the chance of an aeroplane crashing at an airport with a short runway independent of plane crash setting (#7302)
- Change: Keep town growth rate in sync with house count (#6777)
- Fix #6219: Improve helicopter's ability to takeoff from commuter and international airports (#7710)
- Fix #6407: Show snowy ground sprites for train depots (#7671)
- Fix: Power/running cost sorting algorithm was not correct when power was higher than running cost (#7561)
- Fix: Tweaks to small-map colours to make dark blue company more visible (#7436, #7450)
- Fix: [SDL] Do not offer video smaller than 640x480 (#7442)
- Fix: Incorrect display of industry production around tiles (#7426)
- Fix: Show industry name in Land Area Information window for industries with neutral stations instead of just 'Oil Rig' (#7349)
- Fix: Remove redundant and broken file lookups when loading base sets (#7348)
- Fix: Always report error when ordering a road vehicle to wrong type of road stop (#7316)
- Fix #7043, #7274: Improve performance when creating towns during world creation (#7284)
- Fix #7062: Remove ship max order distance (#7279)
- Fix #7189: Fluidsynth volume gain too high (#7253)
- Fix: Add setting for whether industries with neutral stations (e.g. Oil rigs) accept and supply cargo to/from surrounding stations to fix exploit as old as TTO (#7234)
- Fix: Properly reset dropdown menu windows after changing AI/GS settings (#7092)
- Remove: DOS, MorphOS, AmigaOS & BeOS support (#7326, #7388)
- Remove: Original Path Finder (#7245)
1.9.3 (2019-09-16)
------------------------------------------------------------------------
- Change: Use natural sort when sorting the file list (#7727)
@@ -245,7 +293,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: [Win32] Right mouse scrolling didn't work properly with the Windows 10 Fall Creators Update [FS#6629] (r27935)
- Fix: Forest, candyfloss forest and battery farm skipped the first animation frame [FS#6639] (r27932)
- Fix: Glyphs in range U+0020 to U+00FF may only be defined in orig_extra.grf, not in openttd.grf [FS#6620] (r27915)
- Fix: 'unban' console command was not handling IPv6 adresses properly (r27914, r27913)
- Fix: 'unban' console command was not handling IPv6 addresses properly (r27914, r27913)
- Fix: Keep the 'link' between industry chain and smallmap windows whenever possible [FS#6585] (r27905)
- Fix: When the last vehicle is removed from a shared orders group, hide the 'Stop sharing' button in the vehicle orders window [FS#6593] (r27904)
- Fix: Tooltip of 'increase service interval' said 'decrease' [FS#6606] (r27895)
@@ -351,7 +399,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: [Build] Force sorting to be locale independent, so files are always ordered the same and by that token better diff-able (r27562, r27558)
- Fix: Typos in comments and string (r27561, r27560)
- Fix: [Build] bashism that caused different CFLAGS with bash vs dash (r27557)
- Fix: Use a more appropiate sound effect for convert-rail (r27547)
- Fix: Use a more appropriate sound effect for convert-rail (r27547)
- Fix: Remove SetFill from vehicle GUI buttons, so that the viewport is resized instead of them in case of long window titles (r27546)
- Fix: [Script] Generation of API wrappers (r27545, r27544, r27543)
- Fix: [Windows] ICU got disabled for Windows builds, breaking RTL support [FS#6427] (r27542)
@@ -3242,7 +3290,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: Improve corner case order handling: mark order as done only when actually done, obey non-stop orders, do only stop/refit at the depot in the order (r16240, r16228, r16199, r16198, r16187)
- Fix: [NoAI] Use the stop/non-stop intermediate orderflags AIs can give for goto-depot orders (r16239)
- Fix: [NewGRF] ActionB should use the online parameters from GRFFile instead of the initial user-specified values from GRFConfig. Also use the values as they were set when the ActionB was executed, not as they are set when the message is shown (r16223)
- Fix: Possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation [FS#2862] (r16220)
- Fix: Possible crashes when quitting OpenTTD or forcing resizes/redraws of the screen during map generation [FS#2862] (r16220)
- Fix: Shared orders without orders were not properly converted causing corrupt/invalid orders when loading pre 0.7 savegames [FS#2878] (r16214)
- Fix: Hardcoded (old sized) MAX_COMPANIES constant (r16182)
- Fix: [Squirrel] The traps variable was not restored, causing try/catch blocks to be 'forgotten' during a suspend (r16181)
@@ -3250,7 +3298,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: Forbid joining AI companies via the 'move' and 'join' console commands/multiplayer lobby (r16176, r16175)
- Fix: [NoAI] AIOrder::GetOrderDestination and AIOrder::GetOrderFlags did not work on ORDER_CURRENT when the vehicle was loading/leaving in a station (r16165)
- Fix: [NoAI] Change WAYPOINT_INVALID to 0xFFFF from -1 as that is the value the AIs got (due to casting) (r16150)
- Fix: The overflowsafe type did not like dividing by int64 larger than MAX_INT32 causing division by negative numbers and small anomolies when drawing graphs [FS#2855] (r16130)
- Fix: The overflowsafe type did not like dividing by int64 larger than MAX_INT32 causing division by negative numbers and small anomalies when drawing graphs [FS#2855] (r16130)
- Fix: Road was removed when both the Remove button was active and Ctrl was pressed [FS#2582] (r16119)
- Fix: [NoAI] Make sure AIOrder::GetDestination always returns a tile belonging to the station (16109)
- Fix: [NoAI] When giving an aircraft a goto-hangar order do not let it be a normal goto-station order (r16108)
@@ -3706,7 +3754,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: Inconsistent use of 8/15-bitness of NewGRF callback results with respect to TTDP's implementation of the specification (r12819, r12818, r12759)
- Fix: Possible out of bounds array access (r12809)
- Fix: Enforce autorenew values range in command (r12808)
- Fix: Vehicles could break down during loading and keep loading. The intention of the break down code is not to break down when having zero speed, therefor break downs now do not happen when loading [FS#1938] (r12795)
- Fix: Vehicles could break down during loading and keep loading. The intention of the break down code is not to break down when having zero speed, therefore break downs now do not happen when loading [FS#1938] (r12795)
- Fix: [OSX] In some rare cases when using an uncalibrated monitor the system colour space could not be retrieved. Show an error when this happens instead of just trying an assertion (r12776)
- Fix: Slope checking for NewGRFs failed (r12759)
- Fix: Check the TILE_NOT_SLOPED flag of the _north_ tile of multi-tile houses to decide if autoslope is allowed (r12717)
@@ -3814,7 +3862,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Feature: Separate catenary transparency settings from building transparency settings (r12103)
- Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x' (r12102)
- Feature: Add some missing VarAction2 variables (r12124)
- Feature: Make snow appear on rail tiles dependant on track height, not on height of the lowest part of the tile (r12098)
- Feature: Make snow appear on rail tiles dependent on track height, not on height of the lowest part of the tile (r12098)
- Feature: [NewGRF] Specify the purchase, rail and road description of a bridge (r12069)
- Feature: [NewGRF] Add support for var 12, Variational Action 2 (r12045)
- Feature: Allow trees on shore (r12029)
@@ -4095,7 +4143,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Feature: Add support for variable snow lines in the arctic climate, supplied by NewGRF files (r9371)
- Feature: [NewGRF] Add support for newhouses (r9315)
- Feature: [NewGRF] Add support for Action 13, which allows you to translate GRF-specific texts. The translations will only be shown if you are using a language with a GRF language id and if a string has not already been set specifically for the language you are using (r9037)
- Feature: Translation dependant formatting of dates (r8906)
- Feature: Translation dependent formatting of dates (r8906)
- Feature: If an action 7/9 leads to skipping the rest of the file, disable the NewGRF if an action 8 has not been encountered yet (r8831)
- Feature: Stop loading and disable the current NewGRF if a fatal error message in Action B is encountered. Also be more strict on the values accepted (r8830)
- Feature: Build aircraft windows will no longer show aircraft that cannot use the airport in question (r8771)
@@ -4216,7 +4264,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: Do not display income/expenses when they do not belong to a 'valid' tile, like the money cheat and giving money [FS#1175] (r11021)
- Fix: One could not give money when (s)he had too much money [FS#1174] (r11020)
- Fix: Disallow buying/selling shares in your own company or a bankrupt company [FS#1169] (r11018)
- Fix: Crash when quiting the game in one of the end score windows [FS#1218] (r11071)
- Fix: Crash when quitting the game in one of the end score windows [FS#1218] (r11071)
0.5.3-RC3 (2007-08-30)
@@ -4348,7 +4396,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
0.5.1-RC1 (2007-03-20)
------------------------------------------------------------------------
- Feature: Translation dependant formatting of dates (r8906)
- Feature: Translation dependent formatting of dates (r8906)
- Feature: Kick inactive initial network connections after some time [FS#115] (r9038, r9061)
- Feature: Add an extra news group for opening and closing of industries (r9097)
- Codechange: Disable shares by default and increase the default maximum distance from edge for oil refineries (r9339)
@@ -5311,7 +5359,7 @@ Note: OpenTTD was migrated to GitHub for 1.9, so SVN revision and FlySpray numbe
- Fix: Wrong pathfinding when northern station tile is missing
- Fix: You cannot take ownership of an oilrig by building right next to it
- Fix: [Makefile] Fixed issue where sdl-config was needed even on systems without SDL
- Fix: [SDL] Performance fix fo palette animation and mouse jumping
- Fix: [SDL] Performance fix for palette animation and mouse jumping
- Fix: [SDL] Same resolution was displayed more than once in game options
- Fix: [SDL] Smoother mouse and performance fix, like in the Windows video driver
- Fix: Wrong trains you can buy with scenarios [SF#963056]

View File

@@ -52,13 +52,12 @@ set_default() {
enable_profiling="0"
enable_lto="0"
enable_dedicated="0"
enable_network="1"
enable_static="1"
enable_translator="0"
enable_unicode="1"
enable_console="1";
enable_assert="0"
enable_strip="1"
enable_assert="1"
enable_strip="0"
enable_universal="0"
enable_osx_g5="0"
enable_cocoa_quartz="1"
@@ -82,7 +81,6 @@ set_default() {
with_iconv="1"
with_midi=""
with_midi_arg=""
with_libtimidity="1"
with_fluidsynth="1"
with_freetype="1"
with_fontconfig="1"
@@ -131,7 +129,6 @@ set_default() {
enable_profiling
enable_lto
enable_dedicated
enable_network
enable_static
enable_translator
enable_unicode
@@ -160,7 +157,6 @@ set_default() {
with_iconv
with_midi
with_midi_arg
with_libtimidity
with_fluidsynth
with_freetype
with_fontconfig
@@ -291,9 +287,6 @@ detect_params() {
--enable-ipo=*) enable_lto="$optarg";;
--enable-dedicated) enable_dedicated="1";;
--enable-dedicated=*) enable_dedicated="$optarg";;
--enable-network) enable_network="2";;
--enable-network=*) enable_network="$optarg";;
--disable-network) enable_network="0";;
--disable-static) enable_static="0";;
--enable-static) enable_static="2";;
--enable-static=*) enable_static="$optarg";;
@@ -370,10 +363,6 @@ detect_params() {
--without-libpng) with_png="0";;
--with-libpng=*) with_png="$optarg";;
--with-libtimidity) with_libtimidity="2";;
--without-libtimidity) with_libtimidity="0";;
--with-libtimidity=*) with_libtimidity="$optarg";;
--with-fluidsynth) with_fluidsynth="2";;
--without-fluidsynth) with_fluidsynth="0";;
--with-fluidsynth=*) with_fluidsynth="$optarg";;
@@ -549,8 +538,8 @@ check_params() {
# Export some variables to be used by pkg-config
#
# PKG_CONFIG_LIBDIR variable musn't be set if we are not willing to
# override the default pkg-config search path, it musn't be an empty
# PKG_CONFIG_LIBDIR variable mustn't be set if we are not willing to
# override the default pkg-config search path, it mustn't be an empty
# string. If the variable is empty (e.g. when an empty string comes
# from config.cache) then unset it. This way the "don't override" state
# will be properly preserved when (re)configuring.
@@ -559,10 +548,10 @@ check_params() {
# Check if all params have valid values
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS)$'`" ]; then
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HAIKU, SUNOS, CYGWIN, MINGW, and OS2
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|HAIKU|SUNOS|CYGWIN|MINGW|OS2)$'`" ]; then
log 1 "configure: error: invalid option --os=$os"
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS]"
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|HAIKU|SUNOS|CYGWIN|MINGW|OS2]"
exit 1
fi
# cpu_type can be either 32 or 64
@@ -629,7 +618,7 @@ check_params() {
detect_sse_capable_architecture
if [ "$enable_static" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
enable_static="2"
else
enable_static="0"
@@ -639,8 +628,8 @@ check_params() {
if [ "$enable_static" != "0" ]; then
log 1 "checking static... yes"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ]; then
log 1 "WARNING: static is only known to work on Windows, and MacOSX"
log 1 "WARNING: use static at your own risk on this platform"
sleep 5
@@ -650,7 +639,7 @@ check_params() {
fi
if [ "$enable_unicode" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
enable_unicode="2"
else
enable_unicode="0"
@@ -755,11 +744,6 @@ check_params() {
if [ "$enable_dedicated" != "0" ]; then
log 1 "checking GDI video driver... dedicated server, skipping"
log 1 "checking dedicated... found"
if [ "$enable_network" = "0" ]; then
log 1 "configure: error: building a dedicated server without network support is pointless"
exit 1
fi
else
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
log 1 "checking GDI video driver... found"
@@ -767,7 +751,7 @@ check_params() {
log 1 "checking GDI video driver... not Windows, skipping"
fi
if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
if [ -z "$allegro_config" ] && [ -z "$sdl2_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
log 1 "configure: error: no video driver development files found"
log 1 " If you want a dedicated server use --enable-dedicated as parameter"
exit 1
@@ -790,15 +774,6 @@ check_params() {
log 1 "checking console application... enabled"
fi
if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
log 1 "checking network... DOS, skipping"
enable_network=0
elif [ "$enable_network" != "0" ]; then
log 1 "checking network... found"
else
log 1 "checking network... disabled"
fi
log 1 "checking squirrel... found"
SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
@@ -895,7 +870,6 @@ check_params() {
detect_fontconfig
detect_icu_layout
detect_icu_sort
detect_libtimidity
detect_fluidsynth
if [ "$with_direct_music" != "0" ]; then
@@ -939,9 +913,7 @@ check_params() {
fi
if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
if [ "$os" = "MORPHOS" ]; then
strip_arg="--strip-all --strip-unneeded --remove-section .comment"
elif [ "$os" = "OSX" ]; then
if [ "$os" = "OSX" ]; then
strip_arg=""
elif [ "$os" = "OS2" ]; then
strip_arg=""
@@ -1032,10 +1004,6 @@ check_params() {
grfcodec=""
fi
if [ "$os" = "DOS" ]; then
with_threads="0"
fi
if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
if [ "$with_application_bundle" = "1" ]; then
with_application_bundle="0"
@@ -1091,18 +1059,8 @@ check_params() {
fi
fi
if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
log 1 "checking revision... svn detection"
elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && [ -n "`LC_ALL=C svn info $ROOT_DIR/.. | grep '^URL:.*tags$'`" ]; then
# subversion changed its behaviour; now not all folders have a .svn folder,
# but only the root folder. Since making tags requires a (sparse) checkout
# of the tags folder, the folder of the tag does not have a .svn folder
# anymore and this fails to detect the subversion repository checkout.
log 1 "checking revision... svn detection (tag)"
elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
if { [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; } && [ -n "`git help 2>/dev/null`" ]; then
log 1 "checking revision... git detection"
elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`HGPLAIN= hg help 2>/dev/null`" ]; then
log 1 "checking revision... hg detection"
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
log 1 "checking revision... source tarball"
else
@@ -1138,7 +1096,7 @@ check_params() {
fi
if [ "$personal_dir" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "HAIKU" ]; then
personal_dir="OpenTTD"
elif [ "$os" = "OSX" ]; then
personal_dir="Documents/OpenTTD"
@@ -1353,6 +1311,9 @@ make_compiler_cflags() {
# it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
flags="$flags -Wno-self-assign"
# warning: <something> is a C++11 extension
flags="$flags -Wno-c++11-extensions"
if [ "$cc_version" -lt "30" ]; then
# warning: equality comparison with extraneous parentheses
flags="$flags -Wno-parentheses"
@@ -1428,7 +1389,7 @@ make_compiler_cflags() {
if [ $cc_version -ge 402 ]; then
# GCC 4.2+ automatically assumes that signed overflows do
# not occur in signed arithmetics, whereas we are not
# not occur in signed arithmetic, whereas we are not
# sure that they will not happen. It furthermore complains
# about its own optimized code in some places.
flags="$flags -fno-strict-overflow"
@@ -1527,10 +1488,6 @@ make_cflags_and_ldflags() {
if [ "$enable_debug" = "0" ]; then
# No debug, add default stuff
OBJS_SUBDIR="release"
if [ "$os" = "MORPHOS" ]; then
CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS"
LDFLAGS="$LDFLAGS -noixemul"
fi
if [ "$enable_profiling" = "0" ]; then
# -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
@@ -1605,7 +1562,7 @@ make_cflags_and_ldflags() {
LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
fi
LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -limm32"
LIBS="$LIBS -lws2_32 -lwinmm -lusp10 -lgdi32 -ldxguid -lole32 -limm32"
if [ $cc_version -ge 404 ]; then
LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
@@ -1616,19 +1573,14 @@ make_cflags_and_ldflags() {
fi
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "OS2" ]; then
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "OSX" ] && [ "$os" != "OS2" ]; then
LIBS="$LIBS -lpthread"
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ]; then
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ]; then
LIBS="$LIBS -lc"
fi
if [ "$os" = "MORPHOS" ]; then
# -Wstrict-prototypes generates much noise because of system headers
CFLAGS="$CFLAGS -Wno-strict-prototypes"
fi
if [ "$os" = "OPENBSD" ]; then
LIBS="$LIBS -pthread"
fi
@@ -1652,12 +1604,12 @@ make_cflags_and_ldflags() {
fi
fi
if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
if [ "$os" = "HAIKU" ]; then
LIBS="$LIBS -lmidi -lbe"
fi
# Most targets act like UNIX, just with some additions
if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
if [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
CFLAGS="$CFLAGS -DUNIX"
fi
# And others like Windows
@@ -1677,7 +1629,16 @@ make_cflags_and_ldflags() {
fi
fi
if [ -n "$sdl_config" ]; then
if [ -n "$sdl2_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL2"
# SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl2_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$sdl2_config --static --libs`"
else
LIBS="$LIBS `$sdl2_config --libs`"
fi
elif [ -n "$sdl_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL"
# SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
@@ -1712,7 +1673,7 @@ make_cflags_and_ldflags() {
fi
if [ -n "$lzma_config" ]; then
CFLAGS="$CFLAGS -DWITH_LZMA"
CFLAGS="$CFLAGS -DWITH_LIBLZMA"
CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
if [ "$enable_static" != "0" ]; then
@@ -1783,7 +1744,7 @@ make_cflags_and_ldflags() {
fi
if [ -n "$icu_layout_config" ]; then
CFLAGS="$CFLAGS -DWITH_ICU_LAYOUT"
CFLAGS="$CFLAGS -DWITH_ICU_LX"
CFLAGS="$CFLAGS `$icu_layout_config --cflags | tr '\n\r' ' '`"
if [ "$static_icu" != "0" ]; then
@@ -1794,7 +1755,7 @@ make_cflags_and_ldflags() {
fi
if [ -n "$icu_sort_config" ]; then
CFLAGS="$CFLAGS -DWITH_ICU_SORT"
CFLAGS="$CFLAGS -DWITH_ICU_I18N"
CFLAGS="$CFLAGS `$icu_sort_config --cflags | tr '\n\r' ' '`"
if [ "$static_icu" != "0" ]; then
@@ -1823,17 +1784,6 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWITH_XAUDIO2"
fi
if [ -n "$libtimidity_config" ]; then
CFLAGS="$CFLAGS -DLIBTIMIDITY"
CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`"
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$libtimidity_config --libs --static | tr '\n\r' ' '`"
else
LIBS="$LIBS `$libtimidity_config --libs | tr '\n\r' ' '`"
fi
fi
if [ -n "$fluidsynth" ]; then
LIBS="$LIBS -lfluidsynth"
CFLAGS="$CFLAGS -DFLUIDSYNTH"
@@ -1869,13 +1819,6 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
fi
if [ "$enable_network" != "0" ]; then
CFLAGS="$CFLAGS -DENABLE_NETWORK"
if [ "$os" = "BEOS" ]; then
LDFLAGS="$LDFLAGS -lbind -lsocket"
fi
if [ "$os" = "HAIKU" ]; then
LDFLAGS="$LDFLAGS -lnetwork"
fi
@@ -1883,7 +1826,6 @@ make_cflags_and_ldflags() {
if [ "$os" = "SUNOS" ]; then
LDFLAGS="$LDFLAGS -lnsl -lsocket"
fi
fi
if [ "$enable_static" != "0" ]; then
# OSX can't handle -static in LDFLAGS
@@ -2361,7 +2303,7 @@ detect_awk() {
detect_os() {
if [ "$os" = "DETECT" ]; then
# Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, and DOS
# Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, SUNOS, CYGWIN, MINGW, and OS2
# Try first via dumpmachine, then via uname
os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
@@ -2372,15 +2314,12 @@ detect_os() {
/openbsd/ { print "OPENBSD"; exit}
/netbsd/ { print "NETBSD"; exit}
/hp-ux/ { print "HPUX"; exit}
/morphos/ { print "MORPHOS"; exit}
/beos/ { print "BEOS"; exit}
/haiku/ { print "HAIKU"; exit}
/sunos/ { print "SUNOS"; exit}
/solaris/ { print "SUNOS"; exit}
/cygwin/ { print "CYGWIN"; exit}
/mingw/ { print "MINGW"; exit}
/os2/ { print "OS2"; exit}
/dos/ { print "DOS"; exit}
'`
if [ -z "$os" ]; then
@@ -2392,8 +2331,6 @@ detect_os() {
/openbsd/ { print "OPENBSD"; exit}
/netbsd/ { print "NETBSD"; exit}
/hp-ux/ { print "HPUX"; exit}
/morphos/ { print "MORPHOS"; exit}
/beos/ { print "BEOS"; exit}
/haiku/ { print "HAIKU"; exit}
/sunos/ { print "SUNOS"; exit}
/cygwin/ { print "CYGWIN"; exit}
@@ -2406,7 +2343,7 @@ detect_os() {
if [ -z "$os" ]; then
log 1 "detecting OS... none detected"
log 1 "I couldn't detect your OS. Please use --os=OS to force one"
log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS"
log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, HAIKU, SUNOS, CYGWIN, MINGW, and OS2"
exit 1
fi
@@ -2498,7 +2435,13 @@ detect_sdl() {
sleep 5
fi
if [ $with_sdl = "sdl1" ]; then
detect_pkg_config "2" "sdl" "sdl_config" "1.2"
elif [ $with_sdl = "sdl2" ] || [ -x `which sdl2-config` ]; then
detect_pkg_config "2" "sdl2" "sdl2_config" "2.0"
else
detect_pkg_config "$with_sdl" "sdl" "sdl_config" "1.2"
fi
}
detect_osx_sdk() {
@@ -2771,10 +2714,6 @@ detect_lzo2() {
detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
}
detect_libtimidity() {
detect_pkg_config "$with_libtimidity" "libtimidity" "libtimidity_config" "0.1" "1"
}
detect_fluidsynth() {
detect_library "$with_fluidsynth" "fluidsynth" "" "" "fluidsynth.h"
}
@@ -2852,6 +2791,12 @@ detect_png() {
}
detect_freetype() {
if [ "$with_freetype" = "1" ] && ([ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]); then
log 1 "checking freetype2... WIN32, skipping"
freetype_config=""
return 0
fi
detect_pkg_config "$with_freetype" "freetype2" "freetype_config" "2.2" "1"
}
@@ -3191,7 +3136,7 @@ detect_sse_capable_architecture() {
else
# It was forced, so it should be found.
if [ "$with_sse" != "1" ]; then
log 1 "configure: error: SSE couln't be found"
log 1 "configure: error: SSE couldn't be found"
log 1 "configure: error: you force enabled SSE, but it seems unavailable"
exit 1
fi
@@ -3493,8 +3438,8 @@ showhelp() {
echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
echo " --os=OS the OS we are compiling for [DETECT]"
echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
echo " MINGW/OS2/DOS/HAIKU"
echo " NETBSD/HPUX/SUNOS/CYGWIN/"
echo " MINGW/OS2/HAIKU"
echo ""
echo "Paths:"
echo " --prefix-dir=dir specifies the prefix for all installed"
@@ -3548,7 +3493,6 @@ showhelp() {
echo " --enable-console compile as a console application instead of as a GUI application."
echo " If this setting is active, debug output will appear in the same"
echo " console instead of opening a new window. (Win32 ONLY)"
echo " --disable-network disable network support"
echo " --disable-assert disable asserts (continue on errors)"
echo " --enable-strip enable any possible stripping"
echo " --without-osx-sysroot disable the automatic adding of sysroot "
@@ -3563,13 +3507,11 @@ showhelp() {
echo " --with-midi=midi define which midi-player to use"
echo " --with-midi-arg=arg define which args to use for the"
echo " midi-player"
echo " --with-libtimidity[=\"pkg-config libtimidity\"]"
echo " enables libtimidity support"
echo " --with-fluidsynth enables fluidsynth support"
echo " --with-allegro[=\"pkg-config allegro\"]"
echo " enables Allegro video driver support"
echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
echo " --with-sdl[=\"pkg-config sdl\"] enables SDL video driver support"
echo " --with-sdl[=\"sdl1|sdl2\"] enables SDL video driver support"
echo " --with-zlib[=\"pkg-config zlib\"]"
echo " enables zlib support"
echo " --with-liblzma[=\"pkg-config liblzma\"]"

14
configure vendored
View File

@@ -75,7 +75,7 @@ save_params
make_cflags_and_ldflags
EXE=""
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "OS2" ] || [ "$os" = "DOS" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "OS2" ]; then
EXE=".exe"
fi
@@ -110,24 +110,22 @@ AWKCOMMAND='
if ($0 == "ALLEGRO" && "'$allegro_config'" == "") { next; }
if ($0 == "SDL" && "'$sdl_config'" == "") { next; }
if ($0 == "SDL2" && "'$sdl2_config'" == "") { next; }
if ($0 == "PNG" && "'$png_config'" == "") { next; }
if ($0 == "OSX" && "'$os'" != "OSX") { next; }
if ($0 == "OS2" && "'$os'" != "OS2") { next; }
if ($0 == "DEDICATED" && "'$enable_dedicated'" != "1") { next; }
if ($0 == "AI" && "'$enable_ai'" == "0") { next; }
if ($0 == "COCOA" && "'$with_cocoa'" == "0") { next; }
if ($0 == "DOS" && "'$os'" != "DOS") { next; }
if ($0 == "BEOS" && "'$os'" != "BEOS" &&
"'$os'" != "HAIKU") { next; }
if ($0 == "HAIKU" && "'$os'" != "HAIKU") { next; }
if ($0 == "WIN32" && "'$os'" != "MINGW" &&
"'$os'" != "CYGWIN" && "'$os'" != "MSVC") { next; }
if ($0 == "MORPHOS" && "'$os'" != "MORPHOS") { next; }
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
if ($0 == "FLUIDSYNTH" && "'$fluidsynth'" == "" ) { next; }
if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; }
if ($0 == "SSE" && "'$with_sse'" != "1") { next; }
if ($0 == "USE_XAUDIO2" && "'$with_xaudio2'" == "0") { next; }
if ($0 == "USE_THREADS" && "'$with_threads'" == "0") { next; }
if ($0 == "USE_SSE" && "'$with_sse'" != "1") { next; }
skip += 1;

235
docs/admin_network.md Normal file
View File

@@ -0,0 +1,235 @@
# OpenTTD's admin network
Last updated: 2011-01-20
## Table of contents
- 1.0) [Preface](#10-preface)
- 2.0) [Joining the network](#20-joining-the-network)
- 3.0) [Asking for updates](#30-asking-for-updates)
- 3.1) [Polling manually](#31-polling-manually)
- 4.0) [Sending rcon commands](#40-sending-rcon-commands)
- 5.0) [Sending chat](#50-sending-chat)
- 5.1) [Receiving chat](#51-receiving-chat)
- 6.0) [Disconnecting](#60-disconnecting)
- 7.0) [Certain packet information](#70-certain-packet-information)
## 1.0) Preface
The admin network provides a dedicated network protocol designed for other
applications to communicate with OpenTTD. Connected applications can execute
console commands remotely (rcon commands) with no further authentication.
Furthermore information about clients and companies can be provided.
Admin applications remain connected when starting a new game or loading a saved
game in contrast to normal OpenTTD clients that get disconnected.
This document describes the admin network and its protocol.
Please refer to the mentioned enums in `src/network/core/tcp_admin.h`
Please also note that further improvements to the admin protocol can mean that
more packet types will be sent by the server. For forward compatibility it is
therefore wise to ignore unknown packets. Future improvements might also add
additional data to packets. This data should be ignored. Data will never be
removed from packets in later versions, except the possibility that complete
packets are dropped in favour of a new packet.
This though will be reflected in the protocol version as announced in the
`ADMIN_PACKET_SERVER_PROTOCOL` in section 2.0).
A reference implementation in Java for a client connecting to the admin interface
can be found at: [http://dev.openttdcoop.org/projects/joan](http://dev.openttdcoop.org/projects/joan)
## 2.0) Joining the network
Create a TCP connection to the server on port 3977. The application is
expected to authenticate within 10 seconds.
To authenticate send a `ADMIN_PACKET_ADMIN_JOIN` packet.
The server will reply with `ADMIN_PACKET_SERVER_PROTOCOL` followed directly by
`ADMIN_PACKET_SERVER_WELCOME`.
`ADMIN_PACKET_SERVER_PROTOCOL` contains details about the protocol version.
It is the job of your application to check this number and decide whether
it will remain connected or not.
Furthermore, this packet holds details on every `AdminUpdateType` and the
supported `AdminFrequencyTypes` (bitwise representation).
`ADMIN_PACKET_SERVER_WELCOME` contains details on the server and the map,
e.g. if the server is dedicated, its NetworkLanguage, size of the Map, etc.
Once you have received `ADMIN_PACKET_SERVER_WELCOME` you are connected and
authorized to do your thing.
The server will not provide any game related updates unless you ask for them.
There are four packets the server will none the less send, if applicable:
- ADMIN_PACKET_SERVER_ERROR
- ADMIN_PACKET_SERVER_WELCOME
- ADMIN_PACKET_SERVER_NEWGAME
- ADMIN_PACKET_SERVER_SHUTDOWN
However, `ADMIN_PACKET_SERVER_WELCOME` only after a `ADMIN_PACKET_SERVER_NEWGAME`
## 3.0) Asking for updates
Asking for updates is done with `ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY`.
With this packet you define which update you wish to receive at which
frequency.
Note: not every update type supports every frequency. If in doubt, you can
verify against the data received in `ADMIN_PACKET_SERVER_PROTOCOL`.
The server will not confirm your registered update. However, asking for an
invalid `AdminUpdateType` or a not supported `AdminUpdateFrequency` you will be
disconnected from the server with `NETWORK_ERROR_ILLEGAL_PACKET`.
Additional debug information can be found with a debug level of `net=3`.
`ADMIN_UPDATE_DATE` results in the server sending:
- ADMIN_PACKET_SERVER_DATE
`ADMIN_UPDATE_CLIENT_INFO` results in the server sending:
- ADMIN_PACKET_SERVER_CLIENT_JOIN
- ADMIN_PACKET_SERVER_CLIENT_INFO
- ADMIN_PACKET_SERVER_CLIENT_UPDATE
- ADMIN_PACKET_SERVER_CLIENT_QUIT
- ADMIN_PACKET_SERVER_CLIENT_ERROR
`ADMIN_UPDATE_COMPANY_INFO` results in the server sending:
- ADMIN_PACKET_SERVER_COMPANY_NEW
- ADMIN_PACKET_SERVER_COMPANY_INFO
- ADMIN_PACKET_SERVER_COMPANY_UPDATE
- ADMIN_PACKET_SERVER_COMPANY_REMOVE
`ADMIN_UPDATE_COMPANY_ECONOMY` results in the server sending:
- ADMIN_PACKET_SERVER_COMPANY_ECONOMY
`ADMIN_UPDATE_COMPANY_STATS` results in the server sending:
- ADMIN_PACKET_SERVER_COMPANY_STATS
`ADMIN_UPDATE_CHAT` results in the server sending:
- ADMIN_PACKET_SERVER_CHAT
`ADMIN_UPDATE_CONSOLE` results in the server sending:
- ADMIN_PACKET_SERVER_CONSOLE
`ADMIN_UPDATE_CMD_LOGGING` results in the server sending:
- ADMIN_PACKET_SERVER_CMD_LOGGING
## 3.1) Polling manually
Certain `AdminUpdateTypes` can also be polled:
- ADMIN_UPDATE_DATE
- ADMIN_UPDATE_CLIENT_INFO
- ADMIN_UPDATE_COMPANY_INFO
- ADMIN_UPDATE_COMPANY_ECONOMY
- ADMIN_UPDATE_COMPANY_STATS
- ADMIN_UPDATE_CMD_NAMES
`ADMIN_UPDATE_CLIENT_INFO` and `ADMIN_UPDATE_COMPANY_INFO` accept an additional
parameter. This parameter is used to specify a certain client or company.
Setting this parameter to `UINT32_MAX (0xFFFFFFFF)` will tell the server you
want to receive updates for all clients or companies.
Not supported `AdminUpdateType` in the poll will result in the server
disconnecting the application with `NETWORK_ERROR_ILLEGAL_PACKET`.
Additional debug information can be found with a debug level of `net=3`.
## 4.0) Sending rcon commands
Rcon runs separate from the `ADMIN_UPDATE_CONSOLE` `AdminUpdateType`. Requesting
the execution of a remote console command is done with the packet
`ADMIN_PACKET_ADMIN_RCON`.
Note: No additional authentication is required for rcon commands.
The server will reply with one or more `ADMIN_PACKET_SERVER_RCON` packets.
Finally an `ADMIN_PACKET_ADMIN_RCON_END` packet will be sent. Applications
will not receive the answer twice if they have asked for the `AdminUpdateType`
`ADMIN_UPDATE_CONSOLE`, as the result is not printed on the servers console
(just like clients rcon commands).
Furthermore, sending a `say` command (or any similar command) will not
be sent back into the admin network.
Chat from the server itself will only be sent to the admin network when it
was not sent from the admin network.
Note that when content is queried or updated via rcon, the processing
happens asynchronously. But the `ADMIN_PACKET_ADMIN_RCON_END` packet is sent
already right after the content is requested as there's no immediate output.
Thus other packages and the output of content rcon command may be sent at
an arbitrary later time, mixing into the output of other console activity,
e.g. also of possible subsequent other rcon commands sent.
## 5.0) Sending chat
Sending a `ADMIN_PACKET_ADMIN_CHAT` results in chat originating from the server.
Currently four types of chat are supported:
- NETWORK_ACTION_CHAT
- NETWORK_ACTION_CHAT_CLIENT
- NETWORK_ACTION_CHAT_COMPANY
- NETWORK_ACTION_SERVER_MESSAGE
`NETWORK_ACTION_SERVER_MESSAGE` can be sent to a single client or company
using the respective `DestType` and ID.
This is a message prefixed with the 3 stars, e.g. `*** foo has joined the game`
## 5.1) Receiving chat
Register `ADMIN_UPDATE_CHAT` at `ADMIN_FREQUENCY_AUTOMATIC` to receive chat.
The application will be able to receive all chat the server can see.
The configuration option `network.server_admin_chat` specifies whether
private chat for to the server is distributed into the admin network.
## 6.0) Disconnecting
It is a kind thing to say good bye before leaving. Do this by sending the
`ADMIN_PACKET_ADMIN_QUIT` packet.
## 7.0) Certain packet information
All `ADMIN_PACKET_SERVER_*` packets have an enum value greater 100.
`ADMIN_PACKET_SERVER_WELCOME`
Either directly follows `ADMIN_PACKET_SERVER_PROTOCOL` or is sent
after a new game has been started or a map loaded, i.e. also
after ADMIN_PACKET_SERVER_NEWGAME.
`ADMIN_PACKET_SERVER_CLIENT_JOIN` and `ADMIN_PACKET_SERVER_COMPANY_NEW`
These packets directly follow their respective INFO packets. If you receive
a CLIENT_JOIN / COMPANY_NEW packet without having received the INFO packet
it may be a good idea to POLL for the specific ID.
`ADMIN_PACKET_SERVER_CMD_NAMES` and `ADMIN_PACKET_SERVER_CMD_LOGGING`
Data provided with these packets is not stable and will not be
treated as such. Do not rely on IDs or names to be constant
across different versions / revisions of OpenTTD.
Data provided in this packet is for logging purposes only.

View File

@@ -0,0 +1,69 @@
# How to compile lang files (OpenTTD and strgen)
Last updated: 2009-06-30
## strgen usage
This guide is only interesting for people who want to alter something
themselves without access to [translator.openttd.org](https://translator.openttd.org/).
Please note that your compiled language file will only be compatible with the OpenTTD version
you have downloaded `english.txt`, the master language file, for. While this is
not always true, namely when changes in the code have not touched language
files, your safest bet is to assume this 'limitation'.
As a first step you need to compile strgen. This is as easy as typing
`'make strgen'`. You can download the precompile strgen from:
[http://www.openttd.org/download-strgen](http://www.openttd.org/download-strgen)
strgen takes as argument a txt file and translates it to a lng file, allowing
it to be used inside OpenTTD. strgen needs the master language file
`english.txt` to work. Below are some examples of strgen usage.
## Examples
### Example 1
If you are in the root of your working copy (git repository), you should type
`./strgen/strgen -s lang lang/english.txt`
to compile `english.txt` into `english.lng`. It will be placed in the lang dir.
### Example 2
You only have the strgen executable (no working copy) and you want to compile
a txt file in the same directory. You should type
`./strgen english.txt`
and you will get and `english.lng` in the same dir.
### Example 3
You have strgen somewhere, `english.txt` in `/usr/openttd/lang` and you want the
resulting language file to go to /tmp. Use
`./strgen -s /usr/openttd/lang -d /tmp english.txt`
You can interchange `english.txt` to whichever language you want to generate a
.lng file for.
## strgen command switches
`-v | --version`
strgen will tell what git revision it was last modified
`-t | --todo`
strgen will add <TODO> to any untranslated/missing strings and use the english
strings while compiling the language file
`-w | --warning`
strgen will print any missing strings or wrongly translated (bad format)
to standard error output(stderr)
`-h | --help | -?`
Print out a summarized help message explaining these switches
`-s | --source_dir`
strgen will search for the master file english.txt in the directory specified
by this switch instead of the current directory
`-d | --dest_dir`
strgen will put <language>.lng in the directory specified by this switch; if
no dest_dir is given, output is the same as source_dir

267
docs/desync.md Normal file
View File

@@ -0,0 +1,267 @@
# Some explanations about Desyncs
Last updated: 2014-02-23
## Table of contents
- 1.0) Desync theory
- 1.1) [OpenTTD multiplayer architecture](#11-openttd-multiplayer-architecture)
- 1.2) [What is a Desync and how is it detected](#12-what-is-a-desync-and-how-is-it-detected)
- 1.3) [Typical causes of Desyncs](#13-typical-causes-of-desyncs)
- 2.0) What to do in case of a Desync
- 2.1) [Cache debugging](#21-cache-debugging)
- 2.2) [Desync recording](#22-desync-recording)
- 3.0) Evaluating the Desync records
- 3.1) [Replaying](#31-replaying)
- 3.2) [Evaluation of the replay](#32-evaluation-of-the-replay)
- 3.3) [Comparing savegames](#33-comparing-savegames)
## 1.1) OpenTTD multiplayer architecture
OpenTTD has a huge gamestate, which changes all of the time.
The savegame contains the complete gamestate at a specific point
in time. But this state changes completely each tick: Vehicles move
and trees grow.
However, most of these changes in the gamestate are deterministic:
Without a player interfering a vehicle follows its orders always
in the same way, and trees always grow the same.
In OpenTTD multiplayer synchronisation works by creating a savegame
when clients join, and then transferring that savegame to the client,
so it has the complete gamestate at a fixed point in time.
Afterwards clients only receive 'commands', that is: Stuff which is
not predictable, like
- player actions
- AI actions
- GameScript actions
- Admin Port command
- rcon commands
- ...
These commands contain the information on how to execute the command,
and when to execute it. Time is measured in 'network frames'.
Mind that network frames to not match ingame time. Network frames
also run while the game is paused, to give a defined behaviour to
stuff that is executing while the game is paused.
The deterministic part of the gamestate is run by the clients on
their own. All they get from the server is the instruction to
run the gamestate up to a certain network time, which basically
says that there are no commands scheduled in that time.
When a client (which includes the server itself) wants to execute
a command (i.e. a non-predictable action), it does this by
- calling DoCommandP resp. DoCommandPInternal
- These functions first do a local test-run of the command to
check simple preconditions. (Just to give the client an
immediate response without bothering the server and waiting for
the response.) The test-run may not actually change the
gamestate, all changes must be discarded.
- If the local test-run succeeds the command is sent to the server.
- The server inserts the command into the command queue, which
assigns a network frame to the commands, i.e. when it shall be
executed on all clients.
- Enhanced with this specific timestamp, the command is send to all
clients, which execute the command simultaneously in the same
network frame in the same order.
## 1.2) What is a Desync and how is it detected
In the ideal case all clients have the same gamestate as the server
and run in sync. That is, vehicle movement is the same on all
clients, and commands are executed the same everywhere and
have the same results.
When a Desync happens, it means that the gamestates on the clients
(including the server) are no longer the same. Just imagine
that a vehicle picks the left line instead of the right line at
a junction on one client.
The important thing here is, that no one notices when a Desync
occurs. The desync client will continue to simulate the gamestate
and execute commands from the server. Once the gamestate differs
it will increasingly spiral out of control: If a vehicle picks a
different route, it will arrive at a different time at a station,
which will load different cargo, which causes other vehicles to
load other stuff, which causes industries to notice different
servicing, which causes industries to change production, ...
the client could run all day in a different universe.
To limit how long a Desync can remain unnoticed, the server
transfers some checksums every now and then for the gamestate.
Currently this checksum is the state of the random number
generator of the game logic. A lot of things in OpenTTD depend
on the RNG, and if the gamestate differs, it is likely that the
RNG is called at different times, and the state differs when
checked.
The clients compare this 'checksum' with the checksum of their
own gamestate at the specific network frame. If they differ,
the client disconnects with a Desync error.
The important thing here is: The detection of the Desync is
only an ultimate failure detection. It does not give any
indication on when the Desync happened. The Desync may after
all have occurred long ago, and just did not affect the checksum
up to now. The checksum may have matched 10 times or more
since the Desync happened, and only now the Desync has spiraled
enough to finally affect the checksum. (There was once a desync
which was only noticed by the checksum after 20 game years.)
## 1.3) Typical causes of Desyncs
Desyncs can be caused by the following scenarios:
- The savegame does not describe the complete gamestate.
- Some information which affects the progression of the
gamestate is not saved in the savegame.
- Some information which affects the progression of the
gamestate is not loaded from the savegame.
This includes the case that something is not completely
reset before loading the savegame, so data from the
previous game is carried over to the new one.
- The gamestate does not behave deterministic.
- Cache mismatch: The game logic depends on some cached
values, which are not invalidated properly. This is
the usual case for NewGRF-specific Desyncs.
- Undefined behaviour: The game logic performs multiple
things in an undefined order or with an undefined
result. E.g. when sorting something with a key while
some keys are equal. Or some computation that depends
on the CPU architecture (32/64 bit, little/big endian).
- The gamestate is modified when it shall not be modified.
- The test-run of a command alters the gamestate.
- The gamestate is altered by a player or script without
using commands.
## 2.1) Cache debugging
Desyncs which are caused by improper cache validation can
often be found by enabling cache validation:
- Start OpenTTD with '-d desync=2'.
- This will enable validation of caches every tick.
That is, cached values are recomputed every tick and compared
to the cached value.
- Differences are logged to 'commands-out.log' in the autosave
folder.
Mind that this type of debugging can also be done in singleplayer.
## 2.2) Desync recording
If you have a server, which happens to encounter Desyncs often,
you can enable recording of the gamestate alterations. This
will later allow the replay the gamestate and locate the Desync
cause.
There are two levels of Desync recording, which are enabled
via '-d desync=2' resp. '-d desync=3'. Both will record all
commands to a file 'commands-out.log' in the autosave folder.
If you have the savegame from the start of the server, and
this command log you can replay the whole game. (see Section 3.1)
If you do not start the server from a savegame, there will
also be a savegame created just after a map has been generated.
The savegame will be named 'dmp_cmds_*.sav' and be put into
the autosave folder.
In addition to that '-d desync=3' also creates regular savegames
at defined spots in network time. (more defined than regular
autosaves). These will be created in the autosave folder
and will also be named 'dmp_cmds_*.sav'.
These saves allow comparing the gamestate with the original
gamestate during replaying, and thus greatly help debugging.
However, they also take a lot of disk space.
## 3.1) Replaying
To replay a Desync recording, you need these files:
- The savegame from when the server was started, resp.
the automatically created savegame from when the map
was generated.
- The 'commands-out.log' file.
- Optionally the 'dmp_cmds_*.sav'.
Put these files into a safe spot. (Not your autosave folder!)
Next, prepare your OpenTTD for replaying:
- Get the same version of OpenTTD as the original server was running.
- Uncomment/enable the define 'DEBUG_DUMP_COMMANDS' in
'src/network/network_func.h'.
(DEBUG_FAILED_DUMP_COMMANDS is explained later)
- Put the 'commands-out.log' into the root save folder, and rename
it to 'commands.log'.
- Run 'openttd -D -d desync=3 -g startsavegame.sav'.
This replays the server log and creates new 'commands-out.log'
and 'dmp_cmds_*.sav' in your autosave folder.
## 3.2) Evaluation of the replay
The replaying will also compare the checksums which are part of
the 'commands-out.log' with the replayed gamestate.
If they differ, it will trigger a 'NOT_REACHED'.
If the replay succeeds without mismatch, that is the replay reproduces
the original server state:
- Repeat the replay starting from incrementally later 'dmp_cmds_*.sav'
while truncating the 'commands.log' at the beginning appropriately.
The 'dmp_cmds_*.sav' can be your own ones from the first reply, or
the ones from the original server (if you have them).
(This simulates the view of joining clients during the game.)
- If one of those replays fails, you have located the Desync between
the last dmp_cmds that reproduces the replay and the first one
that fails.
If the replay does not succeed without mismatch, you can check the logs
whether there were failed commands. Then you may try to replay with
DEBUG_FAILED_DUMP_COMMANDS enabled. If the replay then fails, the
command test-run of the failed command modified the game state.
If you have the original 'dmp_cmds_*.sav', you can also compare those
savegames with your own ones from the replay. You can also comment/disable
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
the replay after the mismatch has already been detected.
See Section 3.2 on how to compare savegames.
If the saves differ you have located the Desync between the last dmp_cmds
that match and the first one that does not. The difference of the saves
may point you in the direction of what causes it.
If the replay succeeds without mismatch, and you do not have any
'dmp_cmd_*.sav' from the original server, it is a lost case.
Enable creation of the 'dmp_cmd_*.sav' on the server, and wait for the
next Desync.
Finally, you can also compare the 'commands-out.log' from the original
server with the one from the replay. They will differ in stuff like
dates, and the original log will contain the chat, but otherwise they
should match.
## 3.3) Comparing savegames
The binary form of the savegames from the original server and from
your replay will always differ:
- The savegame contains paths to used NewGRF files.
- The gamelog will log your loading of the savegame.
- The savegame data of AIs and the Gamescript will differ.
Scripts are not run during the replay, only their recorded commands
are replayed. Their internal state will thus not change in the
replay and will differ.
To compare savegame more semantically, there exist some ugly hackish
tools at:
http://devs.openttd.org/~frosch/texts/zpipe.c
http://devs.openttd.org/~frosch/texts/printhunk.c
The first one decompresses OpenTTD savegames. The second one creates
a textual representation of an uncompressed savegame, by parsing hunks
and arrays and such. With both tools you need to be a bit careful
since they work on stdin and stdout, which may not deal well with
binary data.
If you have the textual representation of the savegames, you can
compare them with regular diff tools.

View File

@@ -16,7 +16,7 @@
<a href="landscape_grid.html">Landscape grid</a> page.
</p>
<p>Nine attributes (counting &quot;<span style="font-weight: bold;">type</span>&quot; and
&quot;<span style="font-weight: bold;">height</span>&quot;) hold the informations about a tile.<BR>
&quot;<span style="font-weight: bold;">height</span>&quot;) hold the information about a tile.<BR>
These attributes are referred to as
&quot;<span style="font-weight: bold;">type</span>",
&quot;<span style="font-weight: bold;">height</span>",
@@ -61,7 +61,7 @@
<a name="tropic_zone"></a>
Bits 1..0:
<table border="1" style="width: 30em;">
<tr bgcolor="#CCCCCC"><td colspan="2">Only meaningfull in tropic climate. It contains the definition of the available zones</td></tr>
<tr bgcolor="#CCCCCC"><td colspan="2">Only meaningful in tropic climate. It contains the definition of the available zones</td></tr>
<tr><td style="width: 5em;"><tt>00</tt></td><td>normal</td></tr>
<tr><td><tt>01</tt></td><td>desert</td></tr>
<tr><td><tt>02</tt></td><td>rain forest</td></tr>
@@ -98,6 +98,32 @@
</li>
</ul>
</li>
<li><span style="font-weight: bold;">m4:</span><br>
<a name="RoadType"></a>
Road roadtype. Used for all tiles with road (road, station, tunnelbridge).
<ul>
<li>
Bits 5..0: Road roadtype, 0x3F for no road.
</li>
</ul>
</li>
<li><span style="font-weight: bold;">m8:</span><br>
<a name="TramType"></a>
Tram roadtype. Used for all tiles with road (road, station, tunnelbridge).
<ul>
<li>
Bits 11..6: Tram roadtype, 0x3F for no tram.
</li>
</ul>
</li>
<li><span style="font-weight: bold;">m8:</span><br>
<ul>
<li>
<a name="RailType"></a>
Bits 5..0: Railtype. Used for all tiles with rail (road, rail, station, tunnelbridge).
</li>
</ul>
</li>
<li><span style="font-weight: bold;">m7:</span><br>
Animation frame/state. Used for houses, industries, objects and stations.
</li>
@@ -108,7 +134,7 @@
<table border=1 cellpadding=3>
<tr bgcolor="#0099FF">
<th align=left><font color="#FFFFFF">Class</font></th>
<th align=left><font color="#FFFFFF">Meaning & details of encoding</font></th>
<th align=left><font color="#FFFFFF">Meaning &amp; details of encoding</font></th>
</tr>
<tr bgcolor="#CCCCCC">
<td align=left><strong><a name="Class0"><tt> 0 </tt></a></strong></td>
@@ -223,6 +249,7 @@
<td valign=top nowrap>&nbsp;</td>
<td>
<ul>
<li>m1 bit 7: Ship docking tile status (for half-tile with water)</li>
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the tile</li>
<li>m2: see signals</li>
<li>m3 bits 7..4: see signals</li>
@@ -535,21 +562,10 @@
<td>
<ul>
<li>m2: Index into the array of towns (owning town for town roads; closest town otherwise, INVALID_TOWN if there is no town or we are creating a town)</li>
<li>m7 bit 5 set = on snow or desert</li>
<li>m7 bits 7..6: present road types
<table>
<tr>
<td>bit 0&nbsp; </td>
<td>normal road</td>
</tr>
<tr>
<td>bit 1&nbsp; </td>
<td>tram</td>
</tr>
</table>
</li>
<li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of road type 1 (tram); OWNER_NONE (<tt>10</tt>) is stored as OWNER_TOWN (<tt>0F</tt>)
<li>m4 bits 5..0: <a href="#RoadType">Roadtype</a></li>
<li>m7 bit 5 set = on snow or desert</li>
<li>m8 bits 11..6: <a href="#TramType">Tramtype</a></li>
<li>m5 bits 7 clear: road or level-crossing
<ul>
<li>m6 bits 5..3:
@@ -744,7 +760,7 @@
</ul>
</li>
</ul>
<small><a name="newhouses"></a>Newhouses is the name englobing a newGRF feature developped by TTDPatch devs (mainly Csaboka).<br>
<small><a name="newhouses"></a>Newhouses is the name englobing a newGRF feature developed by TTDPatch devs (mainly Csaboka).<br>
It allows the replacement of the properties as well as the graphics of houses in the game.<br>
To distinguish between the standard behaviour and the newGRF one, HouseID (m4 + m3[6]) is tested for anything above 110.<br>
110 is the count of standard houses. So above 110 means there is a new definition of at least one house</small>
@@ -856,12 +872,14 @@
<td valign=top nowrap>&nbsp;</td>
<td>
<ul>
<li>m1 bit 7: Ship docking tile status (for buoys)</li>
<li>m1 bits 6..5: water class for buoys, water part of docks and for airport tiles</li>
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the station</li>
<li>m2: index into the array of stations</li>
<li>m3 bits 7..4: persistent random data for railway stations/waypoints and airports)</li>
<li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of tram tracks (road stop)</li>
<li>m4: custom station id; 0 means standard graphics</li>
<li>m4: <a href="#RoadType">Roadtype</a> for road stops</li>
<li>m5: graphics index (range from 0..255 for each station type):
<table>
<tr>
@@ -977,8 +995,8 @@
<li>m6 bit 2: pbs reservation state for railway stations/waypoints</li>
<li>m7 bits 4..0: <a href="#OwnershipInfo">owner</a> of road (road stops)</li>
<li>m7 bits 7..6: present road types (road stops)</li>
<li>m7: animation frame (railway stations/waypoints, airports)</li>
<li>m8 bits 11..6: <a href="#TramType">Tramtype</a></li>
<li>m8 bits 5..0: <a href="#TrackType">track type</a> for railway stations/waypoints</li>
</ul>
</td>
@@ -992,6 +1010,7 @@
<td valign=top nowrap>&nbsp;</td>
<td>
<ul>
<li>m1 bit 7: Ship docking tile status</li>
<li>m1 bits 6..5 : Water class (sea, canal or river)
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> (for sea, rivers, and coasts normally <tt>11</tt>)</li>
<li>m2: Depot index (for depots only)</li>
@@ -1443,8 +1462,10 @@
<td valign=top nowrap>&nbsp;</td>
<td>
<ul>
<li>m1 bit 7: Ship docking tile status (for aqueducts)</li>
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a></li>
<li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of tram</li>
<li>m4: <a href="#RoadType">Roadtype</a></li>
<li>m5 bit 4: pbs reservation state for railway</li>
<li>m5 bits 7 clear: tunnel entrance/exit</li>
<li>m5 bit 7 set: bridge ramp
@@ -1581,7 +1602,7 @@
</li>
<li>m7 bits 4..0: <a href="#OwnershipInfo">owner</a> of road</li>
<li>m7 bit 5 set = on snow or desert</li>
<li>m7 bits 7..6: present road types for road</li>
<li>m8 bits 11..6: <a href="#TramType">Tramtype</a></li>
<li>m8 bits 5..0: <a href="#TrackType">track type</a> for railway</li>
</ul>
</td>

View File

@@ -100,7 +100,7 @@ the array so you can quickly see what is used and what is not.
<td class="caption">rail</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOO</span>X XXXX</td>
<td class="bits">X<span class="free">OO</span>X XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX <span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO</span> XXXX</td>
@@ -143,11 +143,11 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="free">OOO</span>X XXXX</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XXX<span class="free">O</span> XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OO</span>X<span class="free">O</span> XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX XX<span class="free">OO OOOO</span></td>
</tr>
<tr>
<td class="caption">level crossing</td>
@@ -159,8 +159,8 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXXX <span class="free">OOO</span>X</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OO</span>XX XXXX</td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX XXXX XXXX</td>
</tr>
<tr>
<td class="caption">road depot</td>
@@ -169,11 +169,11 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX <span class="free">OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">-inherit-</td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXX<span class="free">O</span> XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OO</span>X<span class="free">O</span> XXXX</td>
<td class="bits">-inherit-</td>
</tr>
<tr>
<td>3</td>
@@ -208,7 +208,7 @@ the array so you can quickly see what is used and what is not.
<td class="caption">rail station</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">O</span>XXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
<td class="bits">XXXX <span class="free">OOOO</span></td>
<td class="bits">XXXX XXXX</td>
@@ -237,11 +237,11 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">XXXX <span class="free">OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XX<span class="free">O</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOO</span>X XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX XX<span class="free">OO OOOO</span></td>
</tr>
<tr>
<td class="caption">dock</td>
@@ -300,7 +300,7 @@ the array so you can quickly see what is used and what is not.
<td class="caption">sea, shore</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">O</span>XXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
@@ -354,14 +354,14 @@ the array so you can quickly see what is used and what is not.
<td class="caption">tunnel entrance</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOO</span>X XXXX</td>
<td class="bits">X<span class="free">OO</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits">XXXX <span class="free">OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits">X<span class="free">OO</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO OO</span>XX XXXX</td>
<td class="bits"><span class="free">OO</span>XX XXXX</td>
<td class="bits"><span class="free">OOOO</span> XXXX XXXX XXXX</td>
</tr>
<tr>
<td>bridge ramp</td>
@@ -370,7 +370,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
<td class="bits">-inherit-</td>

30
docs/linkgraph.md Normal file
View File

@@ -0,0 +1,30 @@
# Some clarifications about the link graph
`InitializeLinkGraphs` joins all threads, so if the game is abandoned
with some threads still running, they're joined as soon as the next game
(possibly the title game) is started. See also `InitializeGame`.
The MCF (multi-commodity flow) algorithm can be quite CPU-hungry as it's
NP-hard and takes exponential time (though with a very small constant
factor) in the number of nodes.
This is why it is run in a separate thread where possible. However after
some time the thread is joined and if it hasn't finished by then the game
will hang. This problem gets worse if we are running on a platform without
threads. However, as those are usually the ones with less CPU power I
assume the contention for the CPU would make the game hard to play even
with threads or even without cargodist (autosave ...). I might be wrong,
but I won't put any work into this before someone shows me some problem.
You can configure the link graph recalculation time. A link graph
recalculation time of X days means that each link graph job has X days
to run before it is joined. The downside is that the flow stats won't be
updated before the job is finished and thus a high value means less
updates and longer times until changes in capacities are accounted for.
If you play a very large map with a complicated link graph you may want to
raise the time setting to avoid lags. The same holds for systems with slow
CPUs.
Another option to avoid excessive lags is to reduce the accuracy of link
graph calculations. Generally the accuracy is inversely correlated to the
CPU requirements of the MCF algorithm.

213
docs/multiplayer.md Normal file
View File

@@ -0,0 +1,213 @@
# Multiplayer manual for OpenTTD
Last updated: 2011-02-16
## Table of contents
- 1.0) [Starting a server](#10-starting-a-server)
- 2.0) [Connecting to a server](#20-connecting-to-a-server)
- 2.1) [Connecting to a server over the console](#21-connecting-to-a-server-over-the-console)
- 3.0) [Playing internet games](#30-playing-internet-games)
- 4.0) [Tips for servers](#40-tips-for-servers)
- 4.1)[Imposing landscaping limits](#41-imposing-landscaping-limits)
- 5.0) [Some useful things](#50-some-useful-things)
- 6.0) [Troubleshooting](#60-troubleshooting)
## 1.0) Starting a server
- Make sure that you have your firewall of the computer as well as possible
routers or modems of the server configured such that:
- port 3979 is free for both UDP and TCP connections in- and outgoing
- port 3978 is free outbound for UDP in order to advertise with the master
server (if desired). Otherwise you'll have to tell players your IP.
- port 3977 if use of the admin interface is desired (see admin_network.txt)
- Click "multiplayer" on the startup screen
- Click "start server"
- Type in a game name
- Select the type of game ('LAN/Internet' or 'Internet (advertise)'. With the
last one other people are able to see you online. Else they need your IP and
port to join)
- Click "start game", "load game" or "load scenario"
- Start playing
## 2.0) Connecting to a server
- Click "multiplayer" on the startup screen
- If you want to connect to any network game in your LAN click on 'LAN', then
on 'Find Server'
- If you want to see which servers all online on the Internet, click on
'Internet' and 'Find Server'
- If there were more than one server
- select one in the list below the buttons
- click on 'join game'
- If you want to play and you have the ip or hostname of the game server you
want connect to.
- click add server
- type in the ip address or hostname
- if you want to add a port use :<port>
- Now you can select a company and press: "Join company", to help that company
- Or you can press "Spectate game", to spectate the game
- Or you can press "New company", and start your own company (if there are
slots free)
- You see a progressbar how far you are with joining the server.
- Happy playing
## 2.1) Connecting to a server over the console
- Open the console and type in the following command:
connect `<ip/host>:<port>#<company-no>`
## 3.0) Playing internet games
- Servers with a red dot behind it have a different version then you have. You
will not be able to join those servers.
- Servers with a yellow dot behind it have NewGRFs that you do not have. You
will not be able to join those servers. However, via "NewGRF Settings" and
"Find missing content online" you might be able to download the needed
NewGRFs after which you can join the server.
- It can happen that a connection is that slow, or you have that many clients
connected to your server, that your clients start to loose their connection.
Some things you can do about it:
- [network] frame_freq:
change it in console with: 'set network.frame_freq <number>'
the number should be between the 0 and 10, not much higher. It indicates
the delay between clicking and showing up. The higher, the more you notice
it, but the less bandwidth you use.
A good value for Internet-games is 2 or 3.
- [network] sync_freq:
change it in console with: 'set network.sync_freq <number>'
the number should be between the 50 and 1000, not much lower, not much
higher. It indicates the time between sync-frames. A sync-frame is a frame
which checks if all clients are still in sync. When the value it too high,
clients can desync in 1960, but the server detects it in 1970. Not really
handy. The lower the value, the more bandwidth it uses.
NB: changing frame_freq has more effect on the bandwidth then sync_freq.
## 4.0) Tips for servers
- You can launch a dedicated server by adding -D as parameter.
- In UNIX like systems, you can fork your dedicated server by adding -f as
parameter.
- You can automatically clean companies that do not have a client connected to
them, for, let's say, 3 years. You can do this via: 'set autoclean_companies'
and 'set autoclean_protected' and 'set autoclean_unprotected'. Unprotected
removes a password from a company when it is not used for more then the
defined amount of months. 'set autoclean_novehicles' can be used to remove
companies without any vehicles quickly.
- You can also do this manually via the console: 'reset_company'.
- You can let your server automatically restart a map when, let's say, year 2030
is reached. See 'set restart_game_date' for detail.
- If you want to be on the server-list, enable Advertising. To do this, select
'Internet (advertise)' in the Start Server menu, or type in console:
'set server_advertise 1'.
- You can protect your server with a password via the console: 'set server_pw',
or via the Start Server menu.
- When you have many clients connected to your server via Internet, watch your
bandwidth (if you have any limit on it, set by your ISP). One client uses
about 1.5 kilobytes per second up and down. To decrease this amount, setting
'frame_freq' to 1 will reduce it to roughly 1 kilobyte per second per client.
- OpenTTD's default settings for maximum number of clients, and amount of data
from clients to process are chosen to not influence the normal playing of
people, but to prevent or at least make it less likely that someone can
perform a (distributed) denial-of-service attack on your server by causing
an out-of-memory event by flooding the server with data to send to all
clients. The major factor in this is the maximum number of clients; with
32 clients "only" sending one chat message causes 1024 messages to be
distributed in total, with 64 clients that already quadruples to 4096. Given
that upstream bandwidth is usually the limiting factor, a queue of packets
that need to be sent will be created.
To prevent clients from exploiting this "explosion" of packets to send we
limit the number of incoming data, resulting in effectively limiting the
amount of data that OpenTTD will send to the clients. Even with the default
limits it is possible to generate about 70.000 packets per second, or about
7 megabit per second of traffic.
Given that OpenTTD kicks clients after they have not reacted within about 9
seconds from sending a frame update packet it would be possible that OpenTTD
keeps about 600.000 packets in memory, using about 50 megabytes of memory.
Given that OpenTTD allows short bursts of packets, you can have slightly
more packets in memory in case of a distributed denial of service attack.
When increasing the amount of incoming data, or the maximum number of
clients the amount of memory OpenTTD needs in case of a distributed denial
of service attack is linearly related to the amount of incoming data and
quadratic to the amount of clients. In short, a rule of thumb for, the
maximum memory usage for packets is:
#max_clients * #max_clients * bytes_per_frame * 10 KiB.
### 4.1) Imposing landscaping limits
- You can impose limits on companies by the following 4 settings:
- terraform_per_64k_frames
- terraform_frame_burst
- clear_per_64k_frames
- clear_frame_burst
- Explaining 'per_64K_frames' and 'burst'
- 'burst' defines 3 things, the maximum limit, the limit of a single action,
and the initial value for the limit assigned to a new company.
This setting is fairly simple and requires no math.
A value of 1 means a single tile can be affected by a single action.
This results in having to click 400 times when wanting to cover an area
of 20 x 20 tiles.
The default value 4096 covers an area of 64 x 64 tiles.
- 'per_64k_frames' defines the number of tiles added to each companies limit
per frame (however not past the possible maximum value,the 'burst').
64k rather resembles the exact number of 65536 frames. So setting this
variable to 65536 means: 65536 / 65536 = 1 tile per frame.
As a day consists of 74 frames, a company's limit is increased by 74
tiles during the course of a single day (2.22 seconds).
To achieve a 1 tile per day increase the following calculation is needed:
1 / 74 (frames per day) * 65536 (per_64k_frames) = 885.62...
after rounding: a value of 886 means adding a bit over 1 tile per day.
There is still enough space to scale this value downwards:
decreasing this value to 127 results in a bit over 1 tile added to the
allowance per week (7 days).
To create a setup in which a company gets an initial allowance only,
set the value to 0 - no increase of the allowance per frame.
- Even though construction actions include a clear tile action, they are not
affected by the above settings.
## 5.0) Some useful things
- You can protect your company so nobody else can join uninvited. To do this,
set a password in your Company Screen
- You can give other players some money via the ClientList (under the 'head'
in the mainbar).
- You can chat with other players via ENTER or via SHIFT+T or via the ClientList
- Servers can now kick players, so don't make them use it!
## 6.0) Troubleshooting
- My advertising server does not show up in list at servers.openttd.org
Run openttd with the '-d net=2' parameter. That will show which incoming
communication is received, whether the replies from the master server or
communication from an admin tool reach the programme. See section 1
'Starting a server' further up for the ports and protocols used by OpenTTD.
The ports can be configured in the config file.

View File

@@ -59,7 +59,7 @@ ROOT_DIR=`pwd`
# Determine if we are using a modified version
# Assume the dir is not modified
MODIFIED="0"
if [ -d "$ROOT_DIR/.git" ]; then
if [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; then
# We are a git checkout
# Refresh the index to make sure file stat info is in sync, then look for modifications
git update-index --refresh >/dev/null

View File

@@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2019-09-16
Release version: 1.9.3
Last updated: 2019-10-29
Release version: 1.10.0-beta1
------------------------------------------------------------------------
@@ -220,7 +220,7 @@ Entry- and exit signals are not dragged [#4378]:
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
due to compatibility 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
@@ -404,7 +404,7 @@ Some houses and industries are not affected by transparency [#5817]:
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
interrupted if one of the players stops competing for the resources 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

View File

@@ -90,7 +90,7 @@ GM_TT19.GM = Funk Central
GM_TT20.GM = Jammit
GM_TT21.GM = Movin' On
; MIDI timecodes where the playback should attemp to start and stop short.
; MIDI timecodes where the playback should attempt to start and stop short.
; This is to allow fixing undesired silences in original MIDI files.
; However not all music drivers may support this.
[timingtrim]

View File

@@ -7,7 +7,7 @@
// 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/>.
//
-1 * 0 0C "OpenTTD GUI graphics"
-1 * 3 05 15 \b 179 // OPENTTD_SPRITE_COUNT
-1 * 3 05 15 \b 184 // OPENTTD_SPRITE_COUNT
-1 sprites/openttdgui.png 8bpp 66 8 64 31 -31 7 normal
-1 sprites/openttdgui.png 8bpp 146 8 64 31 -31 7 normal
-1 sprites/openttdgui.png 8bpp 226 8 64 31 -31 7 normal
@@ -187,3 +187,8 @@
-1 sprites/openttdgui_group_livery.png 8bpp 21 0 20 20 0 0 normal
-1 sprites/openttdgui_group_livery.png 8bpp 42 0 20 20 0 0 normal
-1 sprites/openttdgui_group_livery.png 8bpp 63 0 20 20 0 0 normal
-1 sprites/openttdgui_build_tram.png 8bpp 0 0 20 20 0 0 normal
-1 sprites/openttdgui_convert_road.png 8bpp 0 0 20 20 0 0 normal
-1 sprites/openttdgui_convert_road.png 8bpp 24 0 32 32 0 0 normal
-1 sprites/openttdgui_convert_tram.png 8bpp 0 0 20 20 0 0 normal
-1 sprites/openttdgui_convert_tram.png 8bpp 24 0 32 32 0 0 normal

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -7,7 +7,7 @@
// 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/>.
//
-1 * 0 0C "Tram track graphics by PikkaBird"
-1 * 3 05 0B 71
-1 * 3 05 0B 77
-1 sprites/tramtracks.png 8bpp 18 8 20 13 0 4 normal
-1 sprites/tramtracks.png 8bpp 50 8 20 13 0 4 normal
-1 sprites/tramtracks.png 8bpp 82 8 64 36 -18 -8 normal
@@ -121,3 +121,9 @@
-1 sprites/tramtracks.png 8bpp 722 696 64 23 -31 0 normal
-1 sprites/tramtracks.png 8bpp 2 776 64 23 -31 0 normal
-1 sprites/tramtracks.png 8bpp 82 776 64 39 -31 -8 normal
-1 sprites/tramtracks_bare_depot.png 8bpp 0 0 64 31 -31 0 normal
-1 sprites/tramtracks_bare_depot.png 8bpp 80 0 62 64 2 -49 normal
-1 sprites/tramtracks_bare_depot.png 8bpp 158 0 64 31 -31 0 normal
-1 sprites/tramtracks_bare_depot.png 8bpp 238 0 62 64 -62 -49 normal
-1 sprites/tramtracks_bare_depot.png 8bpp 318 0 62 64 -62 -49 normal
-1 sprites/tramtracks_bare_depot.png 8bpp 398 0 62 64 2 -49 normal

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -1,3 +1,9 @@
openttd (1.10.0~beta1-0) unstable; urgency=low
* New upstream release 1.10.0-beta1
-- OpenTTD <info@openttd.org> Tue, 29 Oct 2019 00:00:00 +0000
openttd (1.9.3-0) unstable; urgency=low
* New upstream release 1.9.3
@@ -7,7 +13,6 @@ openttd (1.9.3-0) unstable; urgency=low
openttd (1.9.3~RC1-0) unstable; urgency=low
* New upstream release 1.9.3-RC1
-- OpenTTD <info@openttd.org> Sat, 07 Sep 2019 23:30:00 +0200
openttd (1.9.2-0) unstable; urgency=low
@@ -1057,7 +1062,7 @@ openttd (0.4.0-1) unstable; urgency=low
openttd (0.3.6-1) unstable; urgency=low
* New upstream release
* Modifed Makefile to install xpm icon and scenarios in /usr/share/games/openttd/
* Modified Makefile to install xpm icon and scenarios in /usr/share/games/openttd/
* Added openttd.32.xpm, openttd.64.xpm was too big
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Tue, 25 Jan 2005 19:21:08 +0100

View File

@@ -3,7 +3,7 @@ Section: games
Priority: optional
Maintainer: Matthijs Kooijman <matthijs@stdin.nl>
Uploaders: Jordi Mallach <jordi@debian.org>
Build-Depends: debhelper (>= 7.0.50), libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev
Build-Depends: debhelper (>= 7.0.50), libsdl2-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev
Standards-Version: 3.8.4
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/openttd.git
Vcs-Git: git://anonscm.debian.org/collab-maint/openttd.git

View File

@@ -29,7 +29,7 @@ include /usr/share/dpkg/buildflags.mk
# to be explicit about the dependencies, in case we're not running in a
# clean build root.
override_dh_auto_configure:
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --without-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu-sort --with-liblzo2 --with-lzma --without-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
# Do some extra installation
override_dh_auto_install:

View File

@@ -1,6 +1,6 @@
@echo off
set OPENTTD_VERSION=1.9.3
set OPENTTD_VERSION=1.10.0
set OPENSFX_VERSION=0.8.0
set NOSOUND_VERSION=0.8.0
set OPENGFX_VERSION=1.2.0

View File

@@ -71,7 +71,7 @@
<!-- page 1: introductory page -->
<PAGE INDEX="1" TYPE="README">
<NEXTBUTTON TARGET=2>~Next</NEXTBUTTON>
<README EXTRACTFROMPCK="1">README.TXT</README>
<README EXTRACTFROMPCK="1">README.md</README>
<TEXT>Welcome to the OpenTTD installer. This program will install OpenTTD 1.0 on your system. Before we begin the installation process, please take a moment to read the following document.
Select "Next" to continue, or "Cancel" to abort installation.</TEXT>
@@ -80,7 +80,7 @@ Select "Next" to continue, or "Cancel" to abort installation.</TEXT>
<!-- page 2: licence page -->
<PAGE INDEX="2" TYPE="README">
<NEXTBUTTON TARGET=3>~Next</NEXTBUTTON>
<README EXTRACTFROMPCK="1">COPYING</README>
<README EXTRACTFROMPCK="1">COPYING.md</README>
<TEXT>OpenTTD is licenced under the GNU General Public License. The text of the licence is below.
Select "Next" if you agree to this licence.

View File

@@ -46,7 +46,7 @@ Sat May 1 15:59:32 UTC 2010 - Marcel Gmür <ammler@openttdcoop.org>
Thu Apr 1 08:53:54 UTC 2010 - Marcel Gmür <ammler@openttdcoop.org>
- upstream update 1.0.0 (finally!)
* completely independend game but still working also
* completely independent game but still working also
with ttd original gaphics, sounds and music
- Add: Recommends openmsx
- requires lzo2
@@ -54,7 +54,7 @@ Thu Apr 1 08:53:54 UTC 2010 - Marcel Gmür <ammler@openttdcoop.org>
-------------------------------------------------------------------
Fri Dec 18 2009 Marcel Gmür <ammler@openttdcoop.org> - 0.7.4
- support for differen branches
- support for different branches
- easy support for dedicated branch
- let openttd build system make the dektop file
- split the package to data and gui

View File

@@ -17,9 +17,9 @@
#
Name: openttd
Version: 1.9.3
Version: 1.10.beta1
Release: 0
%define srcver 1.9.3
%define srcver 1.10.0-beta1
Summary: An open source reimplementation of Chris Sawyer's Transport Tycoon Deluxe
License: GPL-2.0
Group: Amusements/Games/Strategy/Other
@@ -61,7 +61,7 @@ BuildRequires: kernel
BuildRequires: pkg-config
%endif
# bulding openttd.grf is not required as it is a) part of source and
# building openttd.grf is not required as it is a) part of source and
# b) required only, if you want to use the original set
%if 0%{?with_grfcodec}
BuildRequires: grfcodec
@@ -81,7 +81,7 @@ the original data from the game or install the recommend subackages OpenGFX for
free graphics, OpenSFX for free sounds and OpenMSX for free music.
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
information, see the file 'COPYING.md' included with every release and source
download of the game.
%package gui
@@ -91,7 +91,7 @@ Group: Amusements/Games/Strategy/Other
Requires: %{name}
Conflicts: %{name}-dedicated
BuildRequires: SDL-devel
BuildRequires: SDL2-devel
BuildRequires: fontconfig-devel
%if 0%{?rhel_version} != 600

View File

@@ -1,9 +1,9 @@
# Version numbers to update
!define APPV_MAJOR 1
!define APPV_MINOR 9
!define APPV_MAINT 3
!define APPV_MINOR 10
!define APPV_MAINT 0
!define APPV_BUILD 0
!define APPV_EXTRA ""
!define APPV_EXTRA "-beta1"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
@@ -63,7 +63,7 @@ Var CDDRIVE
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\..\COPYING"
!insertmacro MUI_PAGE_LICENSE "..\..\..\COPYING.md"
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_COMPONENTS
@@ -143,10 +143,10 @@ Section "!OpenTTD" Section1
Push "$INSTDIR\scripts\README.md"
Call unix2dos
; Copy some documention files
; Copy some documentation files
SetOutPath "$INSTDIR\docs\"
File ${PATH_ROOT}docs\multiplayer.txt
Push "$INSTDIR\docs\multiplayer.txt"
File ${PATH_ROOT}docs\multiplayer.md
Push "$INSTDIR\docs\multiplayer.md"
Call unix2dos
; Copy the rest of the stuff
@@ -156,8 +156,8 @@ Section "!OpenTTD" Section1
File ${PATH_ROOT}changelog.txt
Push "$INSTDIR\changelog.txt"
Call unix2dos
File ${PATH_ROOT}COPYING
Push "$INSTDIR\COPYING"
File ${PATH_ROOT}COPYING.md
Push "$INSTDIR\COPYING.md"
Call unix2dos
File ${PATH_ROOT}README.md
Push "$INSTDIR\README.md"
@@ -218,7 +218,7 @@ Section "!OpenTTD" Section1
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Changelog.lnk" "$INSTDIR\Changelog.txt"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Known-bugs.lnk" "$INSTDIR\known-bugs.txt"
CreateDirectory "$SMPROGRAMS\$SHORTCUTS\Docs"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Docs\Multiplayer.lnk" "$INSTDIR\docs\multiplayer.txt"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Docs\Multiplayer.lnk" "$INSTDIR\docs\multiplayer.md"
CreateDirectory "$SMPROGRAMS\$SHORTCUTS\Scripts"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Scripts\Readme.lnk" "$INSTDIR\scripts\README.md"
!insertmacro MUI_STARTMENU_WRITE_END
@@ -392,7 +392,7 @@ Section "Uninstall"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\known-bugs.txt"
Delete "$INSTDIR\openttd.exe"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\COPYING.md"
Delete "$INSTDIR\INSTALL.LOG"
Delete "$INSTDIR\crash.log"
Delete "$INSTDIR\crash.dmp"

View File

@@ -132,14 +132,14 @@ load_main_data() {
if ($0 == "DEDICATED" && "'$enable_dedicated'" != "1") { next; }
if ($0 == "AI" && "'$enable_ai'" == "0") { next; }
if ($0 == "COCOA" && "'$with_cocoa'" == "0") { next; }
if ($0 == "BEOS" && "'$os'" != "BEOS") { next; }
if ($0 == "HAIKU" && "'$os'" != "HAIKU") { next; }
if ($0 == "WIN32" && "'$os'" != "MINGW" &&
"'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; }
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; }
if ($0 == "FLUIDSYNTH" && "'$enable_fluidsynth'" != "1") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; }
if ($0 == "USE_XAUDIO2" && "'$with_xaudio2'" == "0") { next; }
if ($0 == "USE_THREADS" && "'$with_threads'" == "0") { next; }
skip += 1;

View File

@@ -179,8 +179,9 @@ Sub load_main_data(filename, ByRef vcxproj, ByRef filters, ByRef files)
line = "MSVC" Or _
line = "DIRECTMUSIC" Or _
line = "AI" Or _
line = "SSE" Or _
line = "HAVE_THREAD" _
line = "USE_SSE" Or _
line = "USE_XAUDIO2" Or _
line = "USE_THREADS" _
) Then skip = skip + 1
deep = deep + 1
Case "#"

View File

@@ -10,7 +10,6 @@
<ProjectName>generate</ProjectName>
<ProjectGuid>{2F31FD79-D1AC-43C4-89F3-B0D5E4E53E34}</ProjectGuid>
<RootNamespace>generate</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

View File

@@ -107,7 +107,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -172,7 +172,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -293,7 +293,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -449,6 +449,7 @@
<ClInclude Include="..\src\base_media_func.h" />
<ClInclude Include="..\src\base_station_base.h" />
<ClInclude Include="..\src\bitstream.h" />
<ClInclude Include="..\src\bitmap_type.h" />
<ClInclude Include="..\src\bmp.h" />
<ClInclude Include="..\src\bridge.h" />
<ClInclude Include="..\src\cargo_table_gui.h" />
@@ -585,6 +586,7 @@
<ClInclude Include="..\src\newgrf_object.h" />
<ClInclude Include="..\src\newgrf_properties.h" />
<ClInclude Include="..\src\newgrf_railtype.h" />
<ClInclude Include="..\src\newgrf_roadtype.h" />
<ClInclude Include="..\src\newgrf_sound.h" />
<ClInclude Include="..\src\newgrf_spritegroup.h" />
<ClInclude Include="..\src\newgrf_station.h" />
@@ -615,6 +617,7 @@
<ClInclude Include="..\src\rail_gui.h" />
<ClInclude Include="..\src\rail_type.h" />
<ClInclude Include="..\src\rev.h" />
<ClInclude Include="..\src\road.h" />
<ClInclude Include="..\src\road_cmd.h" />
<ClInclude Include="..\src\road_func.h" />
<ClInclude Include="..\src\road_gui.h" />
@@ -626,6 +629,7 @@
<ClInclude Include="..\src\screenshot.h" />
<ClInclude Include="..\src\sound\sdl_s.h" />
<ClInclude Include="..\src\video\sdl_v.h" />
<ClInclude Include="..\src\video\sdl2_v.h" />
<ClInclude Include="..\src\settings_func.h" />
<ClInclude Include="..\src\settings_gui.h" />
<ClInclude Include="..\src\settings_internal.h" />
@@ -647,6 +651,7 @@
<ClInclude Include="..\src\station_base.h" />
<ClInclude Include="..\src\station_func.h" />
<ClInclude Include="..\src\station_gui.h" />
<ClInclude Include="..\src\station_kdtree.h" />
<ClInclude Include="..\src\station_type.h" />
<ClInclude Include="..\src\statusbar_gui.h" />
<ClInclude Include="..\src\stdafx.h" />
@@ -681,6 +686,7 @@
<ClInclude Include="..\src\toolbar_gui.h" />
<ClInclude Include="..\src\town.h" />
<ClInclude Include="..\src\town_type.h" />
<ClInclude Include="..\src\town_kdtree.h" />
<ClInclude Include="..\src\townname_func.h" />
<ClInclude Include="..\src\townname_type.h" />
<ClInclude Include="..\src\track_func.h" />
@@ -697,6 +703,7 @@
<ClInclude Include="..\src\vehicle_type.h" />
<ClInclude Include="..\src\vehiclelist.h" />
<ClInclude Include="..\src\viewport_func.h" />
<ClInclude Include="..\src\viewport_kdtree.h" />
<ClInclude Include="..\src\viewport_sprite_sorter.h" />
<ClInclude Include="..\src\viewport_type.h" />
<ClInclude Include="..\src\watch_gui.h" />
@@ -727,6 +734,7 @@
<ClCompile Include="..\src\core\geometry_func.cpp" />
<ClInclude Include="..\src\core\geometry_func.hpp" />
<ClInclude Include="..\src\core\geometry_type.hpp" />
<ClInclude Include="..\src\core\kdtree.hpp" />
<ClCompile Include="..\src\core\math_func.cpp" />
<ClInclude Include="..\src\core\math_func.hpp" />
<ClInclude Include="..\src\core\mem_func.hpp" />
@@ -741,7 +749,6 @@
<ClInclude Include="..\src\core\smallmatrix_type.hpp" />
<ClInclude Include="..\src\core\smallstack_type.hpp" />
<ClInclude Include="..\src\core\smallvec_type.hpp" />
<ClInclude Include="..\src\core\sort_func.hpp" />
<ClInclude Include="..\src\core\string_compare_type.hpp" />
<ClCompile Include="..\src\aircraft_gui.cpp" />
<ClCompile Include="..\src\airport_gui.cpp" />
@@ -963,6 +970,7 @@
<ClInclude Include="..\src\table\railtypes.h" />
<ClInclude Include="..\src\table\road_land.h" />
<ClInclude Include="..\src\table\roadveh_movement.h" />
<ClInclude Include="..\src\table\roadtypes.h" />
<ClInclude Include="..\src\..\objs\settings\table\settings.h" />
<ClInclude Include="..\src\table\sprites.h" />
<ClInclude Include="..\src\table\station_land.h" />
@@ -1101,6 +1109,7 @@
<ClInclude Include="..\src\script\api\script_rail.hpp" />
<ClInclude Include="..\src\script\api\script_railtypelist.hpp" />
<ClInclude Include="..\src\script\api\script_road.hpp" />
<ClInclude Include="..\src\script\api\script_roadtypelist.hpp" />
<ClInclude Include="..\src\script\api\script_sign.hpp" />
<ClInclude Include="..\src\script\api\script_signlist.hpp" />
<ClInclude Include="..\src\script\api\script_station.hpp" />
@@ -1167,6 +1176,7 @@
<ClCompile Include="..\src\script\api\script_rail.cpp" />
<ClCompile Include="..\src\script\api\script_railtypelist.cpp" />
<ClCompile Include="..\src\script\api\script_road.cpp" />
<ClCompile Include="..\src\script\api\script_roadtypelist.cpp" />
<ClCompile Include="..\src\script\api\script_sign.cpp" />
<ClCompile Include="..\src\script\api\script_signlist.cpp" />
<ClCompile Include="..\src\script\api\script_station.cpp" />
@@ -1241,6 +1251,7 @@
<ClCompile Include="..\src\newgrf_industrytiles.cpp" />
<ClCompile Include="..\src\newgrf_object.cpp" />
<ClCompile Include="..\src\newgrf_railtype.cpp" />
<ClCompile Include="..\src\newgrf_roadtype.cpp" />
<ClCompile Include="..\src\newgrf_sound.cpp" />
<ClCompile Include="..\src\newgrf_spritegroup.cpp" />
<ClCompile Include="..\src\newgrf_station.cpp" />
@@ -1303,8 +1314,6 @@
<ClCompile Include="..\src\network\core\udp.cpp" />
<ClInclude Include="..\src\network\core\udp.h" />
<ClInclude Include="..\src\pathfinder\follow_track.hpp" />
<ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp" />
<ClInclude Include="..\src\pathfinder\opf\opf_ship.h" />
<ClInclude Include="..\src\pathfinder\pathfinder_func.h" />
<ClInclude Include="..\src\pathfinder\pathfinder_type.h" />
<ClInclude Include="..\src\pathfinder\pf_performance_timer.hpp" />
@@ -1335,6 +1344,7 @@
<ClCompile Include="..\src\video\dedicated_v.cpp" />
<ClCompile Include="..\src\video\null_v.cpp" />
<ClCompile Include="..\src\video\sdl_v.cpp" />
<ClCompile Include="..\src\video\sdl2_v.cpp" />
<ClCompile Include="..\src\video\win32_v.cpp" />
<ClCompile Include="..\src\music\dmusic.cpp" />
<ClCompile Include="..\src\music\null_m.cpp" />
@@ -1342,14 +1352,14 @@
<ClCompile Include="..\src\music\win32_m.cpp" />
<ClCompile Include="..\src\sound\null_s.cpp" />
<ClCompile Include="..\src\sound\sdl_s.cpp" />
<ClCompile Include="..\src\sound\sdl2_s.cpp" />
<ClCompile Include="..\src\sound\win32_s.cpp" />
<ClCompile Include="..\src\sound\xaudio2_s.cpp" />
<ClCompile Include="..\src\os\windows\crashlog_win.cpp" />
<ResourceCompile Include="..\src\os\windows\ottdres.rc" />
<ClCompile Include="..\src\os\windows\string_uniscribe.cpp" />
<ClCompile Include="..\src\os\windows\win32.cpp" />
<ClInclude Include="..\src\thread\thread.h" />
<ClCompile Include="..\src\thread\thread_win32.cpp" />
<ClInclude Include="..\src\thread.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\media\openttd.ico" />

View File

@@ -438,6 +438,9 @@
<ClInclude Include="..\src\bitstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bitmap_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bmp.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -846,6 +849,9 @@
<ClInclude Include="..\src\newgrf_railtype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\newgrf_roadtype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\newgrf_sound.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -936,6 +942,9 @@
<ClInclude Include="..\src\rev.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\road.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\road_cmd.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -969,6 +978,9 @@
<ClInclude Include="..\src\video\sdl_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\video\sdl2_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\settings_func.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1032,6 +1044,9 @@
<ClInclude Include="..\src\station_gui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\station_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\station_type.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1134,6 +1149,9 @@
<ClInclude Include="..\src\town_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\town_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\townname_func.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1182,6 +1200,9 @@
<ClInclude Include="..\src\viewport_func.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_sprite_sorter.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1272,6 +1293,9 @@
<ClInclude Include="..\src\core\geometry_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\kdtree.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClCompile Include="..\src\core\math_func.cpp">
<Filter>Core Source Code</Filter>
</ClCompile>
@@ -1314,9 +1338,6 @@
<ClInclude Include="..\src\core\smallvec_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\sort_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\string_compare_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
@@ -1980,6 +2001,9 @@
<ClInclude Include="..\src\table\roadveh_movement.h">
<Filter>Tables</Filter>
</ClInclude>
<ClInclude Include="..\src\table\roadtypes.h">
<Filter>Tables</Filter>
</ClInclude>
<ClInclude Include="..\src\..\objs\settings\table\settings.h">
<Filter>Tables</Filter>
</ClInclude>
@@ -2394,6 +2418,9 @@
<ClInclude Include="..\src\script\api\script_road.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_roadtypelist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_sign.hpp">
<Filter>Script API</Filter>
</ClInclude>
@@ -2592,6 +2619,9 @@
<ClCompile Include="..\src\script\api\script_road.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_roadtypelist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_sign.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
@@ -2814,6 +2844,9 @@
<ClCompile Include="..\src\newgrf_railtype.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
<ClCompile Include="..\src\newgrf_roadtype.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
<ClCompile Include="..\src\newgrf_sound.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
@@ -3000,12 +3033,6 @@
<ClInclude Include="..\src\pathfinder\follow_track.hpp">
<Filter>Pathfinder</Filter>
</ClInclude>
<ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp">
<Filter>Pathfinder</Filter>
</ClCompile>
<ClInclude Include="..\src\pathfinder\opf\opf_ship.h">
<Filter>Pathfinder</Filter>
</ClInclude>
<ClInclude Include="..\src\pathfinder\pathfinder_func.h">
<Filter>Pathfinder</Filter>
</ClInclude>
@@ -3096,6 +3123,9 @@
<ClCompile Include="..\src\video\sdl_v.cpp">
<Filter>Video</Filter>
</ClCompile>
<ClCompile Include="..\src\video\sdl2_v.cpp">
<Filter>Video</Filter>
</ClCompile>
<ClCompile Include="..\src\video\win32_v.cpp">
<Filter>Video</Filter>
</ClCompile>
@@ -3117,6 +3147,9 @@
<ClCompile Include="..\src\sound\sdl_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
<ClCompile Include="..\src\sound\sdl2_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
<ClCompile Include="..\src\sound\win32_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
@@ -3135,12 +3168,9 @@
<ClCompile Include="..\src\os\windows\win32.cpp">
<Filter>Windows files</Filter>
</ClCompile>
<ClInclude Include="..\src\thread\thread.h">
<ClInclude Include="..\src\thread.h">
<Filter>Threading</Filter>
</ClInclude>
<ClCompile Include="..\src\thread\thread_win32.cpp">
<Filter>Threading</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\media\openttd.ico" />

View File

@@ -107,7 +107,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -172,7 +172,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -293,7 +293,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>

View File

@@ -107,7 +107,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -172,7 +172,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -293,7 +293,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -449,6 +449,7 @@
<ClInclude Include="..\src\base_media_func.h" />
<ClInclude Include="..\src\base_station_base.h" />
<ClInclude Include="..\src\bitstream.h" />
<ClInclude Include="..\src\bitmap_type.h" />
<ClInclude Include="..\src\bmp.h" />
<ClInclude Include="..\src\bridge.h" />
<ClInclude Include="..\src\cargo_table_gui.h" />
@@ -585,6 +586,7 @@
<ClInclude Include="..\src\newgrf_object.h" />
<ClInclude Include="..\src\newgrf_properties.h" />
<ClInclude Include="..\src\newgrf_railtype.h" />
<ClInclude Include="..\src\newgrf_roadtype.h" />
<ClInclude Include="..\src\newgrf_sound.h" />
<ClInclude Include="..\src\newgrf_spritegroup.h" />
<ClInclude Include="..\src\newgrf_station.h" />
@@ -615,6 +617,7 @@
<ClInclude Include="..\src\rail_gui.h" />
<ClInclude Include="..\src\rail_type.h" />
<ClInclude Include="..\src\rev.h" />
<ClInclude Include="..\src\road.h" />
<ClInclude Include="..\src\road_cmd.h" />
<ClInclude Include="..\src\road_func.h" />
<ClInclude Include="..\src\road_gui.h" />
@@ -626,6 +629,7 @@
<ClInclude Include="..\src\screenshot.h" />
<ClInclude Include="..\src\sound\sdl_s.h" />
<ClInclude Include="..\src\video\sdl_v.h" />
<ClInclude Include="..\src\video\sdl2_v.h" />
<ClInclude Include="..\src\settings_func.h" />
<ClInclude Include="..\src\settings_gui.h" />
<ClInclude Include="..\src\settings_internal.h" />
@@ -647,6 +651,7 @@
<ClInclude Include="..\src\station_base.h" />
<ClInclude Include="..\src\station_func.h" />
<ClInclude Include="..\src\station_gui.h" />
<ClInclude Include="..\src\station_kdtree.h" />
<ClInclude Include="..\src\station_type.h" />
<ClInclude Include="..\src\statusbar_gui.h" />
<ClInclude Include="..\src\stdafx.h" />
@@ -681,6 +686,7 @@
<ClInclude Include="..\src\toolbar_gui.h" />
<ClInclude Include="..\src\town.h" />
<ClInclude Include="..\src\town_type.h" />
<ClInclude Include="..\src\town_kdtree.h" />
<ClInclude Include="..\src\townname_func.h" />
<ClInclude Include="..\src\townname_type.h" />
<ClInclude Include="..\src\track_func.h" />
@@ -697,6 +703,7 @@
<ClInclude Include="..\src\vehicle_type.h" />
<ClInclude Include="..\src\vehiclelist.h" />
<ClInclude Include="..\src\viewport_func.h" />
<ClInclude Include="..\src\viewport_kdtree.h" />
<ClInclude Include="..\src\viewport_sprite_sorter.h" />
<ClInclude Include="..\src\viewport_type.h" />
<ClInclude Include="..\src\watch_gui.h" />
@@ -727,6 +734,7 @@
<ClCompile Include="..\src\core\geometry_func.cpp" />
<ClInclude Include="..\src\core\geometry_func.hpp" />
<ClInclude Include="..\src\core\geometry_type.hpp" />
<ClInclude Include="..\src\core\kdtree.hpp" />
<ClCompile Include="..\src\core\math_func.cpp" />
<ClInclude Include="..\src\core\math_func.hpp" />
<ClInclude Include="..\src\core\mem_func.hpp" />
@@ -741,7 +749,6 @@
<ClInclude Include="..\src\core\smallmatrix_type.hpp" />
<ClInclude Include="..\src\core\smallstack_type.hpp" />
<ClInclude Include="..\src\core\smallvec_type.hpp" />
<ClInclude Include="..\src\core\sort_func.hpp" />
<ClInclude Include="..\src\core\string_compare_type.hpp" />
<ClCompile Include="..\src\aircraft_gui.cpp" />
<ClCompile Include="..\src\airport_gui.cpp" />
@@ -963,6 +970,7 @@
<ClInclude Include="..\src\table\railtypes.h" />
<ClInclude Include="..\src\table\road_land.h" />
<ClInclude Include="..\src\table\roadveh_movement.h" />
<ClInclude Include="..\src\table\roadtypes.h" />
<ClInclude Include="..\src\..\objs\settings\table\settings.h" />
<ClInclude Include="..\src\table\sprites.h" />
<ClInclude Include="..\src\table\station_land.h" />
@@ -1101,6 +1109,7 @@
<ClInclude Include="..\src\script\api\script_rail.hpp" />
<ClInclude Include="..\src\script\api\script_railtypelist.hpp" />
<ClInclude Include="..\src\script\api\script_road.hpp" />
<ClInclude Include="..\src\script\api\script_roadtypelist.hpp" />
<ClInclude Include="..\src\script\api\script_sign.hpp" />
<ClInclude Include="..\src\script\api\script_signlist.hpp" />
<ClInclude Include="..\src\script\api\script_station.hpp" />
@@ -1167,6 +1176,7 @@
<ClCompile Include="..\src\script\api\script_rail.cpp" />
<ClCompile Include="..\src\script\api\script_railtypelist.cpp" />
<ClCompile Include="..\src\script\api\script_road.cpp" />
<ClCompile Include="..\src\script\api\script_roadtypelist.cpp" />
<ClCompile Include="..\src\script\api\script_sign.cpp" />
<ClCompile Include="..\src\script\api\script_signlist.cpp" />
<ClCompile Include="..\src\script\api\script_station.cpp" />
@@ -1241,6 +1251,7 @@
<ClCompile Include="..\src\newgrf_industrytiles.cpp" />
<ClCompile Include="..\src\newgrf_object.cpp" />
<ClCompile Include="..\src\newgrf_railtype.cpp" />
<ClCompile Include="..\src\newgrf_roadtype.cpp" />
<ClCompile Include="..\src\newgrf_sound.cpp" />
<ClCompile Include="..\src\newgrf_spritegroup.cpp" />
<ClCompile Include="..\src\newgrf_station.cpp" />
@@ -1303,8 +1314,6 @@
<ClCompile Include="..\src\network\core\udp.cpp" />
<ClInclude Include="..\src\network\core\udp.h" />
<ClInclude Include="..\src\pathfinder\follow_track.hpp" />
<ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp" />
<ClInclude Include="..\src\pathfinder\opf\opf_ship.h" />
<ClInclude Include="..\src\pathfinder\pathfinder_func.h" />
<ClInclude Include="..\src\pathfinder\pathfinder_type.h" />
<ClInclude Include="..\src\pathfinder\pf_performance_timer.hpp" />
@@ -1335,6 +1344,7 @@
<ClCompile Include="..\src\video\dedicated_v.cpp" />
<ClCompile Include="..\src\video\null_v.cpp" />
<ClCompile Include="..\src\video\sdl_v.cpp" />
<ClCompile Include="..\src\video\sdl2_v.cpp" />
<ClCompile Include="..\src\video\win32_v.cpp" />
<ClCompile Include="..\src\music\dmusic.cpp" />
<ClCompile Include="..\src\music\null_m.cpp" />
@@ -1342,14 +1352,14 @@
<ClCompile Include="..\src\music\win32_m.cpp" />
<ClCompile Include="..\src\sound\null_s.cpp" />
<ClCompile Include="..\src\sound\sdl_s.cpp" />
<ClCompile Include="..\src\sound\sdl2_s.cpp" />
<ClCompile Include="..\src\sound\win32_s.cpp" />
<ClCompile Include="..\src\sound\xaudio2_s.cpp" />
<ClCompile Include="..\src\os\windows\crashlog_win.cpp" />
<ResourceCompile Include="..\src\os\windows\ottdres.rc" />
<ClCompile Include="..\src\os\windows\string_uniscribe.cpp" />
<ClCompile Include="..\src\os\windows\win32.cpp" />
<ClInclude Include="..\src\thread\thread.h" />
<ClCompile Include="..\src\thread\thread_win32.cpp" />
<ClInclude Include="..\src\thread.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\media\openttd.ico" />

View File

@@ -438,6 +438,9 @@
<ClInclude Include="..\src\bitstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bitmap_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bmp.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -846,6 +849,9 @@
<ClInclude Include="..\src\newgrf_railtype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\newgrf_roadtype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\newgrf_sound.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -936,6 +942,9 @@
<ClInclude Include="..\src\rev.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\road.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\road_cmd.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -969,6 +978,9 @@
<ClInclude Include="..\src\video\sdl_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\video\sdl2_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\settings_func.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1032,6 +1044,9 @@
<ClInclude Include="..\src\station_gui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\station_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\station_type.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1134,6 +1149,9 @@
<ClInclude Include="..\src\town_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\town_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\townname_func.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1182,6 +1200,9 @@
<ClInclude Include="..\src\viewport_func.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_sprite_sorter.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1272,6 +1293,9 @@
<ClInclude Include="..\src\core\geometry_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\kdtree.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClCompile Include="..\src\core\math_func.cpp">
<Filter>Core Source Code</Filter>
</ClCompile>
@@ -1314,9 +1338,6 @@
<ClInclude Include="..\src\core\smallvec_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\sort_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\string_compare_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
@@ -1980,6 +2001,9 @@
<ClInclude Include="..\src\table\roadveh_movement.h">
<Filter>Tables</Filter>
</ClInclude>
<ClInclude Include="..\src\table\roadtypes.h">
<Filter>Tables</Filter>
</ClInclude>
<ClInclude Include="..\src\..\objs\settings\table\settings.h">
<Filter>Tables</Filter>
</ClInclude>
@@ -2394,6 +2418,9 @@
<ClInclude Include="..\src\script\api\script_road.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_roadtypelist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_sign.hpp">
<Filter>Script API</Filter>
</ClInclude>
@@ -2592,6 +2619,9 @@
<ClCompile Include="..\src\script\api\script_road.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_roadtypelist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_sign.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
@@ -2814,6 +2844,9 @@
<ClCompile Include="..\src\newgrf_railtype.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
<ClCompile Include="..\src\newgrf_roadtype.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
<ClCompile Include="..\src\newgrf_sound.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
@@ -3000,12 +3033,6 @@
<ClInclude Include="..\src\pathfinder\follow_track.hpp">
<Filter>Pathfinder</Filter>
</ClInclude>
<ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp">
<Filter>Pathfinder</Filter>
</ClCompile>
<ClInclude Include="..\src\pathfinder\opf\opf_ship.h">
<Filter>Pathfinder</Filter>
</ClInclude>
<ClInclude Include="..\src\pathfinder\pathfinder_func.h">
<Filter>Pathfinder</Filter>
</ClInclude>
@@ -3096,6 +3123,9 @@
<ClCompile Include="..\src\video\sdl_v.cpp">
<Filter>Video</Filter>
</ClCompile>
<ClCompile Include="..\src\video\sdl2_v.cpp">
<Filter>Video</Filter>
</ClCompile>
<ClCompile Include="..\src\video\win32_v.cpp">
<Filter>Video</Filter>
</ClCompile>
@@ -3117,6 +3147,9 @@
<ClCompile Include="..\src\sound\sdl_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
<ClCompile Include="..\src\sound\sdl2_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
<ClCompile Include="..\src\sound\win32_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
@@ -3135,12 +3168,9 @@
<ClCompile Include="..\src\os\windows\win32.cpp">
<Filter>Windows files</Filter>
</ClCompile>
<ClInclude Include="..\src\thread\thread.h">
<ClInclude Include="..\src\thread.h">
<Filter>Threading</Filter>
</ClInclude>
<ClCompile Include="..\src\thread\thread_win32.cpp">
<Filter>Threading</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\media\openttd.ico" />

View File

@@ -107,7 +107,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -172,7 +172,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -293,7 +293,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>

View File

@@ -78,16 +78,16 @@
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\objs\$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\objs\$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\objs\$(Platform)\$(Configuration)\</OutDir>
@@ -107,7 +107,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -172,7 +172,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -293,7 +293,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -449,6 +449,7 @@
<ClInclude Include="..\src\base_media_func.h" />
<ClInclude Include="..\src\base_station_base.h" />
<ClInclude Include="..\src\bitstream.h" />
<ClInclude Include="..\src\bitmap_type.h" />
<ClInclude Include="..\src\bmp.h" />
<ClInclude Include="..\src\bridge.h" />
<ClInclude Include="..\src\cargo_table_gui.h" />
@@ -585,6 +586,7 @@
<ClInclude Include="..\src\newgrf_object.h" />
<ClInclude Include="..\src\newgrf_properties.h" />
<ClInclude Include="..\src\newgrf_railtype.h" />
<ClInclude Include="..\src\newgrf_roadtype.h" />
<ClInclude Include="..\src\newgrf_sound.h" />
<ClInclude Include="..\src\newgrf_spritegroup.h" />
<ClInclude Include="..\src\newgrf_station.h" />
@@ -615,6 +617,7 @@
<ClInclude Include="..\src\rail_gui.h" />
<ClInclude Include="..\src\rail_type.h" />
<ClInclude Include="..\src\rev.h" />
<ClInclude Include="..\src\road.h" />
<ClInclude Include="..\src\road_cmd.h" />
<ClInclude Include="..\src\road_func.h" />
<ClInclude Include="..\src\road_gui.h" />
@@ -626,6 +629,7 @@
<ClInclude Include="..\src\screenshot.h" />
<ClInclude Include="..\src\sound\sdl_s.h" />
<ClInclude Include="..\src\video\sdl_v.h" />
<ClInclude Include="..\src\video\sdl2_v.h" />
<ClInclude Include="..\src\settings_func.h" />
<ClInclude Include="..\src\settings_gui.h" />
<ClInclude Include="..\src\settings_internal.h" />
@@ -647,6 +651,7 @@
<ClInclude Include="..\src\station_base.h" />
<ClInclude Include="..\src\station_func.h" />
<ClInclude Include="..\src\station_gui.h" />
<ClInclude Include="..\src\station_kdtree.h" />
<ClInclude Include="..\src\station_type.h" />
<ClInclude Include="..\src\statusbar_gui.h" />
<ClInclude Include="..\src\stdafx.h" />
@@ -681,6 +686,7 @@
<ClInclude Include="..\src\toolbar_gui.h" />
<ClInclude Include="..\src\town.h" />
<ClInclude Include="..\src\town_type.h" />
<ClInclude Include="..\src\town_kdtree.h" />
<ClInclude Include="..\src\townname_func.h" />
<ClInclude Include="..\src\townname_type.h" />
<ClInclude Include="..\src\track_func.h" />
@@ -697,6 +703,7 @@
<ClInclude Include="..\src\vehicle_type.h" />
<ClInclude Include="..\src\vehiclelist.h" />
<ClInclude Include="..\src\viewport_func.h" />
<ClInclude Include="..\src\viewport_kdtree.h" />
<ClInclude Include="..\src\viewport_sprite_sorter.h" />
<ClInclude Include="..\src\viewport_type.h" />
<ClInclude Include="..\src\watch_gui.h" />
@@ -727,6 +734,7 @@
<ClCompile Include="..\src\core\geometry_func.cpp" />
<ClInclude Include="..\src\core\geometry_func.hpp" />
<ClInclude Include="..\src\core\geometry_type.hpp" />
<ClInclude Include="..\src\core\kdtree.hpp" />
<ClCompile Include="..\src\core\math_func.cpp" />
<ClInclude Include="..\src\core\math_func.hpp" />
<ClInclude Include="..\src\core\mem_func.hpp" />
@@ -741,7 +749,6 @@
<ClInclude Include="..\src\core\smallmatrix_type.hpp" />
<ClInclude Include="..\src\core\smallstack_type.hpp" />
<ClInclude Include="..\src\core\smallvec_type.hpp" />
<ClInclude Include="..\src\core\sort_func.hpp" />
<ClInclude Include="..\src\core\string_compare_type.hpp" />
<ClCompile Include="..\src\aircraft_gui.cpp" />
<ClCompile Include="..\src\airport_gui.cpp" />
@@ -963,6 +970,7 @@
<ClInclude Include="..\src\table\railtypes.h" />
<ClInclude Include="..\src\table\road_land.h" />
<ClInclude Include="..\src\table\roadveh_movement.h" />
<ClInclude Include="..\src\table\roadtypes.h" />
<ClInclude Include="..\src\..\objs\settings\table\settings.h" />
<ClInclude Include="..\src\table\sprites.h" />
<ClInclude Include="..\src\table\station_land.h" />
@@ -1101,6 +1109,7 @@
<ClInclude Include="..\src\script\api\script_rail.hpp" />
<ClInclude Include="..\src\script\api\script_railtypelist.hpp" />
<ClInclude Include="..\src\script\api\script_road.hpp" />
<ClInclude Include="..\src\script\api\script_roadtypelist.hpp" />
<ClInclude Include="..\src\script\api\script_sign.hpp" />
<ClInclude Include="..\src\script\api\script_signlist.hpp" />
<ClInclude Include="..\src\script\api\script_station.hpp" />
@@ -1167,6 +1176,7 @@
<ClCompile Include="..\src\script\api\script_rail.cpp" />
<ClCompile Include="..\src\script\api\script_railtypelist.cpp" />
<ClCompile Include="..\src\script\api\script_road.cpp" />
<ClCompile Include="..\src\script\api\script_roadtypelist.cpp" />
<ClCompile Include="..\src\script\api\script_sign.cpp" />
<ClCompile Include="..\src\script\api\script_signlist.cpp" />
<ClCompile Include="..\src\script\api\script_station.cpp" />
@@ -1241,6 +1251,7 @@
<ClCompile Include="..\src\newgrf_industrytiles.cpp" />
<ClCompile Include="..\src\newgrf_object.cpp" />
<ClCompile Include="..\src\newgrf_railtype.cpp" />
<ClCompile Include="..\src\newgrf_roadtype.cpp" />
<ClCompile Include="..\src\newgrf_sound.cpp" />
<ClCompile Include="..\src\newgrf_spritegroup.cpp" />
<ClCompile Include="..\src\newgrf_station.cpp" />
@@ -1303,8 +1314,6 @@
<ClCompile Include="..\src\network\core\udp.cpp" />
<ClInclude Include="..\src\network\core\udp.h" />
<ClInclude Include="..\src\pathfinder\follow_track.hpp" />
<ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp" />
<ClInclude Include="..\src\pathfinder\opf\opf_ship.h" />
<ClInclude Include="..\src\pathfinder\pathfinder_func.h" />
<ClInclude Include="..\src\pathfinder\pathfinder_type.h" />
<ClInclude Include="..\src\pathfinder\pf_performance_timer.hpp" />
@@ -1335,6 +1344,7 @@
<ClCompile Include="..\src\video\dedicated_v.cpp" />
<ClCompile Include="..\src\video\null_v.cpp" />
<ClCompile Include="..\src\video\sdl_v.cpp" />
<ClCompile Include="..\src\video\sdl2_v.cpp" />
<ClCompile Include="..\src\video\win32_v.cpp" />
<ClCompile Include="..\src\music\dmusic.cpp" />
<ClCompile Include="..\src\music\null_m.cpp" />
@@ -1342,14 +1352,14 @@
<ClCompile Include="..\src\music\win32_m.cpp" />
<ClCompile Include="..\src\sound\null_s.cpp" />
<ClCompile Include="..\src\sound\sdl_s.cpp" />
<ClCompile Include="..\src\sound\sdl2_s.cpp" />
<ClCompile Include="..\src\sound\win32_s.cpp" />
<ClCompile Include="..\src\sound\xaudio2_s.cpp" />
<ClCompile Include="..\src\os\windows\crashlog_win.cpp" />
<ResourceCompile Include="..\src\os\windows\ottdres.rc" />
<ClCompile Include="..\src\os\windows\string_uniscribe.cpp" />
<ClCompile Include="..\src\os\windows\win32.cpp" />
<ClInclude Include="..\src\thread\thread.h" />
<ClCompile Include="..\src\thread\thread_win32.cpp" />
<ClInclude Include="..\src\thread.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\media\openttd.ico" />

View File

@@ -438,6 +438,9 @@
<ClInclude Include="..\src\bitstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bitmap_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bmp.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -846,6 +849,9 @@
<ClInclude Include="..\src\newgrf_railtype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\newgrf_roadtype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\newgrf_sound.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -936,6 +942,9 @@
<ClInclude Include="..\src\rev.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\road.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\road_cmd.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -969,6 +978,9 @@
<ClInclude Include="..\src\video\sdl_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\video\sdl2_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\settings_func.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1032,6 +1044,9 @@
<ClInclude Include="..\src\station_gui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\station_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\station_type.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1134,6 +1149,9 @@
<ClInclude Include="..\src\town_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\town_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\townname_func.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1182,6 +1200,9 @@
<ClInclude Include="..\src\viewport_func.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_kdtree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_sprite_sorter.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1272,6 +1293,9 @@
<ClInclude Include="..\src\core\geometry_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\kdtree.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClCompile Include="..\src\core\math_func.cpp">
<Filter>Core Source Code</Filter>
</ClCompile>
@@ -1314,9 +1338,6 @@
<ClInclude Include="..\src\core\smallvec_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\sort_func.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
<ClInclude Include="..\src\core\string_compare_type.hpp">
<Filter>Core Source Code</Filter>
</ClInclude>
@@ -1980,6 +2001,9 @@
<ClInclude Include="..\src\table\roadveh_movement.h">
<Filter>Tables</Filter>
</ClInclude>
<ClInclude Include="..\src\table\roadtypes.h">
<Filter>Tables</Filter>
</ClInclude>
<ClInclude Include="..\src\..\objs\settings\table\settings.h">
<Filter>Tables</Filter>
</ClInclude>
@@ -2394,6 +2418,9 @@
<ClInclude Include="..\src\script\api\script_road.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_roadtypelist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_sign.hpp">
<Filter>Script API</Filter>
</ClInclude>
@@ -2592,6 +2619,9 @@
<ClCompile Include="..\src\script\api\script_road.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_roadtypelist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_sign.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
@@ -2814,6 +2844,9 @@
<ClCompile Include="..\src\newgrf_railtype.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
<ClCompile Include="..\src\newgrf_roadtype.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
<ClCompile Include="..\src\newgrf_sound.cpp">
<Filter>NewGRF</Filter>
</ClCompile>
@@ -3000,12 +3033,6 @@
<ClInclude Include="..\src\pathfinder\follow_track.hpp">
<Filter>Pathfinder</Filter>
</ClInclude>
<ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp">
<Filter>Pathfinder</Filter>
</ClCompile>
<ClInclude Include="..\src\pathfinder\opf\opf_ship.h">
<Filter>Pathfinder</Filter>
</ClInclude>
<ClInclude Include="..\src\pathfinder\pathfinder_func.h">
<Filter>Pathfinder</Filter>
</ClInclude>
@@ -3096,6 +3123,9 @@
<ClCompile Include="..\src\video\sdl_v.cpp">
<Filter>Video</Filter>
</ClCompile>
<ClCompile Include="..\src\video\sdl2_v.cpp">
<Filter>Video</Filter>
</ClCompile>
<ClCompile Include="..\src\video\win32_v.cpp">
<Filter>Video</Filter>
</ClCompile>
@@ -3117,6 +3147,9 @@
<ClCompile Include="..\src\sound\sdl_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
<ClCompile Include="..\src\sound\sdl2_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
<ClCompile Include="..\src\sound\win32_s.cpp">
<Filter>Sound</Filter>
</ClCompile>
@@ -3135,12 +3168,9 @@
<ClCompile Include="..\src\os\windows\win32.cpp">
<Filter>Windows files</Filter>
</ClCompile>
<ClInclude Include="..\src\thread\thread.h">
<ClInclude Include="..\src\thread.h">
<Filter>Threading</Filter>
</ClInclude>
<ClCompile Include="..\src\thread\thread_win32.cpp">
<Filter>Threading</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\media\openttd.ico" />

View File

@@ -78,16 +78,16 @@
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\objs\$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\objs\$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\objs\$(Platform)\$(Configuration)\</OutDir>
@@ -107,7 +107,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -172,7 +172,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -230,7 +230,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -293,7 +293,7 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;WITH_PNG;WITH_FREETYPE;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_XAUDIO2;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LIBLZMA;WITH_PNG;WITH_UNISCRIBE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>

View File

@@ -10,7 +10,6 @@
<ProjectName>settingsgen</ProjectName>
<ProjectGuid>{E9548DE9-F089-49B7-93A6-30BE2CC311C7}</ProjectGuid>
<RootNamespace>settings</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

View File

@@ -10,7 +10,6 @@
<ProjectName>strgen</ProjectName>
<ProjectGuid>{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}</ProjectGuid>
<RootNamespace>strgen</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -30,9 +29,9 @@
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\objs\strgen\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\objs\strgen\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet>NativeMinimumRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>

View File

@@ -110,7 +110,7 @@ townname.cpp
vehicle.cpp
vehiclelist.cpp
viewport.cpp
#if SSE
#if USE_SSE
viewport_sprite_sorter_sse4.cpp
#end
waypoint.cpp
@@ -136,6 +136,7 @@ base_media_base.h
base_media_func.h
base_station_base.h
bitstream.h
bitmap_type.h
bmp.h
bridge.h
cargo_table_gui.h
@@ -272,6 +273,7 @@ newgrf_industrytiles.h
newgrf_object.h
newgrf_properties.h
newgrf_railtype.h
newgrf_roadtype.h
newgrf_sound.h
newgrf_spritegroup.h
newgrf_station.h
@@ -302,6 +304,7 @@ rail.h
rail_gui.h
rail_type.h
rev.h
road.h
road_cmd.h
road_func.h
road_gui.h
@@ -313,6 +316,7 @@ safeguards.h
screenshot.h
sound/sdl_s.h
video/sdl_v.h
video/sdl2_v.h
settings_func.h
settings_gui.h
settings_internal.h
@@ -334,6 +338,7 @@ spritecache.h
station_base.h
station_func.h
station_gui.h
station_kdtree.h
station_type.h
statusbar_gui.h
stdafx.h
@@ -368,6 +373,7 @@ timetable.h
toolbar_gui.h
town.h
town_type.h
town_kdtree.h
townname_func.h
townname_type.h
track_func.h
@@ -384,6 +390,7 @@ vehicle_gui_base.h
vehicle_type.h
vehiclelist.h
viewport_func.h
viewport_kdtree.h
viewport_sprite_sorter.h
viewport_type.h
watch_gui.h
@@ -407,7 +414,6 @@ zoom_type.h
music/bemidi.h
music/cocoa_m.h
music/extmidi.h
music/libtimidity.h
music/fluidsynth.h
music/os2_m.h
music/qtmidi.h
@@ -433,6 +439,7 @@ core/enum_type.hpp
core/geometry_func.cpp
core/geometry_func.hpp
core/geometry_type.hpp
core/kdtree.hpp
core/math_func.cpp
core/math_func.hpp
core/mem_func.hpp
@@ -447,7 +454,6 @@ core/smallmap_type.hpp
core/smallmatrix_type.hpp
core/smallstack_type.hpp
core/smallvec_type.hpp
core/sort_func.hpp
core/string_compare_type.hpp
# GUI Source Code
@@ -681,6 +687,7 @@ table/pricebase.h
table/railtypes.h
table/road_land.h
table/roadveh_movement.h
table/roadtypes.h
../objs/settings/table/settings.h
table/sprites.h
table/station_land.h
@@ -837,6 +844,7 @@ script/api/script_order.hpp
script/api/script_rail.hpp
script/api/script_railtypelist.hpp
script/api/script_road.hpp
script/api/script_roadtypelist.hpp
script/api/script_sign.hpp
script/api/script_signlist.hpp
script/api/script_station.hpp
@@ -905,6 +913,7 @@ script/api/script_order.cpp
script/api/script_rail.cpp
script/api/script_railtypelist.cpp
script/api/script_road.cpp
script/api/script_roadtypelist.cpp
script/api/script_sign.cpp
script/api/script_signlist.cpp
script/api/script_station.cpp
@@ -933,7 +942,7 @@ script/api/script_window.cpp
#else
blitter/32bpp_anim.cpp
blitter/32bpp_anim.hpp
#if SSE
#if USE_SSE
blitter/32bpp_anim_sse2.cpp
blitter/32bpp_anim_sse2.hpp
blitter/32bpp_anim_sse4.cpp
@@ -945,7 +954,7 @@ blitter/32bpp_optimized.cpp
blitter/32bpp_optimized.hpp
blitter/32bpp_simple.cpp
blitter/32bpp_simple.hpp
#if SSE
#if USE_SSE
blitter/32bpp_sse_func.hpp
blitter/32bpp_sse_type.h
blitter/32bpp_sse2.cpp
@@ -994,6 +1003,7 @@ newgrf_industries.cpp
newgrf_industrytiles.cpp
newgrf_object.cpp
newgrf_railtype.cpp
newgrf_roadtype.cpp
newgrf_sound.cpp
newgrf_spritegroup.cpp
newgrf_station.cpp
@@ -1064,8 +1074,6 @@ network/core/udp.h
# Pathfinder
pathfinder/follow_track.hpp
pathfinder/opf/opf_ship.cpp
pathfinder/opf/opf_ship.h
pathfinder/pathfinder_func.h
pathfinder/pathfinder_type.h
pathfinder/pf_performance_timer.hpp
@@ -1109,6 +1117,9 @@ video/null_v.cpp
#if SDL
video/sdl_v.cpp
#end
#if SDL2
video/sdl2_v.cpp
#end
#if WIN32
video/win32_v.cpp
#end
@@ -1130,21 +1141,12 @@ music/midifile.cpp
#else
#if WIN32
music/win32_m.cpp
#else
#if DOS
#else
#if MORPHOS
#else
music/extmidi.cpp
#end
#end
#end
#if BEOS
#if HAIKU
music/bemidi.cpp
#end
#if LIBTIMIDITY
music/libtimidity.cpp
#end
#if FLUIDSYNTH
music/fluidsynth.cpp
#end
@@ -1160,11 +1162,16 @@ sound/null_s.cpp
#if SDL
sound/sdl_s.cpp
#end
#if SDL2
sound/sdl2_s.cpp
#end
#if WIN32
sound/win32_s.cpp
#if USE_XAUDIO2
sound/xaudio2_s.cpp
#end
#end
#end
#if OSX
# OSX Files
@@ -1197,21 +1204,4 @@ sound/null_s.cpp
#end
# Threading
thread/thread.h
#if HAVE_THREAD
#if WIN32
thread/thread_win32.cpp
#else
#if OS2
thread/thread_os2.cpp
#else
#if MORPHOS
thread/thread_morphos.cpp
#else
thread/thread_pthread.cpp
#end
#end
#end
#else
thread/thread_none.cpp
#end
thread.h

View File

@@ -142,7 +142,7 @@ public:
break;
}
Lex();
return ret;
return std::move(ret);
}
bool IsEndOfStatement() { return ((_lex._prevtoken == '\n') || (_token == SQUIRREL_EOB) || (_token == '}') || (_token == ';')); }
void OptionalSemicolon()

View File

@@ -20,12 +20,6 @@ struct SQOuterVar
_src=src;
_type=t;
}
SQOuterVar(const SQOuterVar &ov)
{
_type=ov._type;
_src=ov._src;
_name=ov._name;
}
SQOuterType _type;
SQObjectPtr _name;
SQObjectPtr _src;
@@ -34,13 +28,6 @@ struct SQOuterVar
struct SQLocalVarInfo
{
SQLocalVarInfo():_start_op(0),_end_op(0), _pos(0){}
SQLocalVarInfo(const SQLocalVarInfo &lvi)
{
_name=lvi._name;
_start_op=lvi._start_op;
_end_op=lvi._end_op;
_pos=lvi._pos;
}
SQObjectPtr _name;
SQUnsignedInteger _start_op;
SQUnsignedInteger _end_op;

View File

@@ -502,14 +502,14 @@ SQObject SQFuncState::CreateString(const SQChar *s,SQInteger len)
{
SQObjectPtr ns(SQString::Create(_sharedstate,s,len));
_table(_strings)->NewSlot(ns,(SQInteger)1);
return ns;
return std::move(ns);
}
SQObject SQFuncState::CreateTable()
{
SQObjectPtr nt(SQTable::Create(_sharedstate,0));
_table(_strings)->NewSlot(nt,(SQInteger)1);
return nt;
return std::move(nt);
}
SQFunctionProto *SQFuncState::BuildProto()

View File

@@ -9,8 +9,10 @@
#include "../../../core/alloc_func.hpp"
#include "../../../safeguards.h"
#ifdef SQUIRREL_DEFAULT_ALLOCATOR
void *sq_vm_malloc(SQUnsignedInteger size) { return MallocT<char>((size_t)size); }
void *sq_vm_realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size) { return ReallocT<char>(static_cast<char*>(p), (size_t)size); }
void sq_vm_free(void *p, SQUnsignedInteger size) { free(p); }
#endif

View File

@@ -12,9 +12,8 @@
void sq_base_register(HSQUIRRELVM v);
struct SQExceptionTrap{
SQExceptionTrap() {}
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target){ _stacksize = ss; _stackbase = stackbase; _ip = ip; _extarget = ex_target;}
SQExceptionTrap(const SQExceptionTrap &et) { (*this) = et; }
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target)
: _stackbase(stackbase), _stacksize(ss), _ip(ip), _extarget(ex_target) {}
SQInteger _stackbase;
SQInteger _stacksize;
SQInstruction *_ip;

View File

@@ -32,7 +32,7 @@ public:
START_NEXT_EASY = DAYS_IN_YEAR * 2,
START_NEXT_MEDIUM = DAYS_IN_YEAR,
START_NEXT_HARD = DAYS_IN_YEAR / 2,
START_NEXT_MIN = 1,
START_NEXT_MIN = 0,
START_NEXT_MAX = 3600,
START_NEXT_DEVIATION = 60,
};
@@ -164,11 +164,9 @@ public:
/** Gets the ScriptScanner instance that is used to find AI Libraries */
static AIScannerLibrary *GetScannerLibrary();
#if defined(ENABLE_NETWORK)
/** Wrapper function for AIScanner::HasAI */
static bool HasAI(const struct ContentInfo *ci, bool md5sum);
static bool HasAILibrary(const ContentInfo *ci, bool md5sum);
#endif
private:
static uint frame_counter; ///< Tick counter for the AI code
static class AIScannerInfo *scanner_info; ///< ScriptScanner instance that is used to find AIs

View File

@@ -31,7 +31,7 @@ ScriptConfigItem _start_date_config = {
AI::START_NEXT_DEVIATION,
30,
SCRIPTCONFIG_NONE,
NULL,
nullptr,
false
};
@@ -52,7 +52,7 @@ AIConfig::AIConfig(const AIConfig *config) : ScriptConfig(config)
} else {
config = &_settings_game.ai_config[company];
}
if (*config == NULL) *config = new AIConfig();
if (*config == nullptr) *config = new AIConfig();
return *config;
}
@@ -69,7 +69,7 @@ ScriptInfo *AIConfig::FindInfo(const char *name, int version, bool force_exact_m
bool AIConfig::ResetInfo(bool force_exact_match)
{
this->info = (ScriptInfo *)AI::FindInfo(this->name, force_exact_match ? this->version : -1, force_exact_match);
return this->info != NULL;
return this->info != nullptr;
}
void AIConfig::PushExtraConfigList()
@@ -90,7 +90,7 @@ void AIConfig::ClearConfigList()
int AIConfig::GetSetting(const char *name) const
{
if (this->info == NULL) {
if (this->info == nullptr) {
SettingValueList::const_iterator it = this->settings.find(name);
if (it == this->settings.end()) {
assert(strcmp("start_date", name) == 0);
@@ -111,7 +111,7 @@ int AIConfig::GetSetting(const char *name) const
void AIConfig::SetSetting(const char *name, int value)
{
if (this->info == NULL) {
if (this->info == nullptr) {
if (strcmp("start_date", name) != 0) return;
value = Clamp(value, AI::START_NEXT_MIN, AI::START_NEXT_MAX);
@@ -127,3 +127,14 @@ void AIConfig::SetSetting(const char *name, int value)
ScriptConfig::SetSetting(name, value);
}
void AIConfig::AddRandomDeviation()
{
int start_date = this->GetSetting("start_date");
ScriptConfig::AddRandomDeviation();
/* start_date = 0 is a special case, where random deviation does not occur.
* If start_date was not already 0, then a minimum value of 1 must apply. */
this->SetSetting("start_date", start_date != 0 ? max(1, this->GetSetting("start_date")) : 0);
}

View File

@@ -30,8 +30,9 @@ public:
class AIInfo *GetInfo() const;
/* virtual */ int GetSetting(const char *name) const;
/* virtual */ void SetSetting(const char *name, int value);
int GetSetting(const char *name) const override;
void SetSetting(const char *name, int value) override;
void AddRandomDeviation() override;
/**
* When ever the AI Scanner is reloaded, all infos become invalid. This
@@ -44,9 +45,9 @@ public:
bool ResetInfo(bool force_exact_match);
protected:
/* virtual */ void PushExtraConfigList();
/* virtual */ void ClearConfigList();
/* virtual */ ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match);
void PushExtraConfigList() override;
void ClearConfigList() override;
ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match) override;
};
#endif /* AI_CONFIG_HPP */

View File

@@ -26,8 +26,8 @@
#include "../safeguards.h"
/* static */ uint AI::frame_counter = 0;
/* static */ AIScannerInfo *AI::scanner_info = NULL;
/* static */ AIScannerLibrary *AI::scanner_library = NULL;
/* static */ AIScannerInfo *AI::scanner_info = nullptr;
/* static */ AIScannerLibrary *AI::scanner_library = nullptr;
/* static */ bool AI::CanStartNew()
{
@@ -44,19 +44,19 @@
AIConfig *config = AIConfig::GetConfig(company, AIConfig::SSS_FORCE_GAME);
AIInfo *info = config->GetInfo();
if (info == NULL || (rerandomise_ai && config->IsRandom())) {
if (info == nullptr || (rerandomise_ai && config->IsRandom())) {
info = AI::scanner_info->SelectRandomAI();
assert(info != NULL);
assert(info != nullptr);
/* Load default data and store the name in the settings */
config->Change(info->GetName(), -1, false, true);
}
config->AnchorUnchangeableSettings();
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
c->ai_info = info;
assert(c->ai_instance == NULL);
assert(c->ai_instance == nullptr);
c->ai_instance = new AIInstance();
c->ai_instance->Initialize(info);
@@ -76,7 +76,7 @@
assert(_settings_game.difficulty.competitor_speed <= 4);
if ((AI::frame_counter & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return;
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
const Company *c;
FOR_ALL_COMPANIES(c) {
if (c->is_ai) {
@@ -107,12 +107,12 @@
if (_networking && !_network_server) return;
PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + company));
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
delete c->ai_instance;
c->ai_instance = NULL;
c->ai_info = NULL;
c->ai_instance = nullptr;
c->ai_info = nullptr;
cur_company.Restore();
@@ -127,7 +127,7 @@
* for the server owner to unpause the script again. */
if (_network_dedicated) return;
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company::Get(company)->ai_instance->Pause();
cur_company.Restore();
@@ -135,7 +135,7 @@
/* static */ void AI::Unpause(CompanyID company)
{
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company::Get(company)->ai_instance->Unpause();
cur_company.Restore();
@@ -143,7 +143,7 @@
/* static */ bool AI::IsPaused(CompanyID company)
{
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
bool paused = Company::Get(company)->ai_instance->IsPaused();
cur_company.Restore();
@@ -164,10 +164,10 @@
/* static */ void AI::Initialize()
{
if (AI::scanner_info != NULL) AI::Uninitialize(true);
if (AI::scanner_info != nullptr) AI::Uninitialize(true);
AI::frame_counter = 0;
if (AI::scanner_info == NULL) {
if (AI::scanner_info == nullptr) {
TarScanner::DoScan(TarScanner::AI);
AI::scanner_info = new AIScannerInfo();
AI::scanner_info->Initialize();
@@ -187,17 +187,17 @@
} else {
delete AI::scanner_info;
delete AI::scanner_library;
AI::scanner_info = NULL;
AI::scanner_library = NULL;
AI::scanner_info = nullptr;
AI::scanner_library = nullptr;
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (_settings_game.ai_config[c] != NULL) {
if (_settings_game.ai_config[c] != nullptr) {
delete _settings_game.ai_config[c];
_settings_game.ai_config[c] = NULL;
_settings_game.ai_config[c] = nullptr;
}
if (_settings_newgame.ai_config[c] != NULL) {
if (_settings_newgame.ai_config[c] != nullptr) {
delete _settings_newgame.ai_config[c];
_settings_newgame.ai_config[c] = NULL;
_settings_newgame.ai_config[c] = nullptr;
}
}
}
@@ -209,10 +209,10 @@
* the AIConfig. If not, remove the AI from the list (which will assign
* a random new AI on reload). */
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (_settings_game.ai_config[c] != NULL && _settings_game.ai_config[c]->HasScript()) {
if (_settings_game.ai_config[c] != nullptr && _settings_game.ai_config[c]->HasScript()) {
if (!_settings_game.ai_config[c]->ResetInfo(true)) {
DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
_settings_game.ai_config[c]->Change(NULL);
_settings_game.ai_config[c]->Change(nullptr);
if (Company::IsValidAiID(c)) {
/* The code belonging to an already running AI was deleted. We can only do
* one thing here to keep everything sane and that is kill the AI. After
@@ -226,10 +226,10 @@
Company::Get(c)->ai_info = _settings_game.ai_config[c]->GetInfo();
}
}
if (_settings_newgame.ai_config[c] != NULL && _settings_newgame.ai_config[c]->HasScript()) {
if (_settings_newgame.ai_config[c] != nullptr && _settings_newgame.ai_config[c]->HasScript()) {
if (!_settings_newgame.ai_config[c]->ResetInfo(false)) {
DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
_settings_newgame.ai_config[c]->Change(NULL);
_settings_newgame.ai_config[c]->Change(nullptr);
}
}
}
@@ -253,7 +253,7 @@
}
/* Queue the event */
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company::Get(_current_company)->ai_instance->InsertEvent(event);
cur_company.Restore();
@@ -283,9 +283,9 @@
{
if (!_networking || _network_server) {
Company *c = Company::GetIfValid(company);
assert(c != NULL && c->ai_instance != NULL);
assert(c != nullptr && c->ai_instance != nullptr);
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
c->ai_instance->Save();
cur_company.Restore();
} else {
@@ -297,9 +297,9 @@
{
if (!_networking || _network_server) {
Company *c = Company::GetIfValid(company);
assert(c != NULL && c->ai_instance != NULL);
assert(c != nullptr && c->ai_instance != nullptr);
Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
c->ai_instance->Load(version);
cur_company.Restore();
} else {
@@ -362,8 +362,6 @@
InvalidateWindowClassesData(WC_AI_SETTINGS);
}
#if defined(ENABLE_NETWORK)
/**
* Check whether we have an AI (library) with the exact characteristics as ci.
* @param ci the characteristics to search on (shortname and md5sum)
@@ -380,8 +378,6 @@
return AI::scanner_library->HasScript(ci, md5sum);
}
#endif /* defined(ENABLE_NETWORK) */
/* static */ AIScannerInfo *AI::GetScannerInfo()
{
return AI::scanner_info;

View File

@@ -98,7 +98,7 @@ struct AIListWindow : public Window {
}
}
virtual void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_AIL_CAPTION:
@@ -107,7 +107,7 @@ struct AIListWindow : public Window {
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
if (widget == WID_AIL_LIST) {
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
@@ -118,7 +118,7 @@ struct AIListWindow : public Window {
}
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_AIL_LIST: {
@@ -139,13 +139,13 @@ struct AIListWindow : public Window {
break;
}
case WID_AIL_INFO_BG: {
AIInfo *selected_info = NULL;
AIInfo *selected_info = nullptr;
ScriptInfoList::const_iterator it = this->info_list->begin();
for (int i = 1; selected_info == NULL && it != this->info_list->end(); i++, it++) {
for (int i = 1; selected_info == nullptr && it != this->info_list->end(); i++, it++) {
if (this->selected == i - 1) selected_info = static_cast<AIInfo *>((*it).second);
}
/* Some info about the currently selected AI. */
if (selected_info != NULL) {
if (selected_info != nullptr) {
int y = r.top + WD_FRAMERECT_TOP;
SetDParamStr(0, selected_info->GetAuthor());
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, STR_AI_LIST_AUTHOR);
@@ -153,7 +153,7 @@ struct AIListWindow : public Window {
SetDParam(0, selected_info->GetVersion());
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, STR_AI_LIST_VERSION);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
if (selected_info->GetURL() != NULL) {
if (selected_info->GetURL() != nullptr) {
SetDParamStr(0, selected_info->GetURL());
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, STR_AI_LIST_URL);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
@@ -172,7 +172,7 @@ struct AIListWindow : public Window {
void ChangeAI()
{
if (this->selected == -1) {
GetConfig(slot)->Change(NULL);
GetConfig(slot)->Change(nullptr);
} else {
ScriptInfoList::const_iterator it = this->info_list->begin();
for (int i = 0; i < this->selected; i++) it++;
@@ -183,7 +183,7 @@ struct AIListWindow : public Window {
DeleteWindowByClass(WC_QUERY_STRING);
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_AIL_LIST: { // Select one of the AIs
@@ -211,7 +211,7 @@ struct AIListWindow : public Window {
}
}
virtual void OnResize()
void OnResize() override
{
this->vscroll->SetCapacityFromWidget(this, WID_AIL_LIST);
}
@@ -221,7 +221,7 @@ struct AIListWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
delete this;
@@ -317,7 +317,7 @@ struct AISettingsWindow : public Window {
this->RebuildVisibleSettings();
}
virtual void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_AIS_CAPTION:
@@ -346,7 +346,7 @@ struct AISettingsWindow : public Window {
this->vscroll->SetCount((int)this->visible_settings.size());
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
if (widget == WID_AIS_BACKGROUND) {
this->line_height = max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
@@ -357,7 +357,7 @@ struct AISettingsWindow : public Window {
}
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
if (widget != WID_AIS_BACKGROUND) return;
@@ -407,7 +407,7 @@ struct AISettingsWindow : public Window {
} else {
DrawArrowButtons(buttons_left, y + button_y_offset, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, editable && current_value > config_item.min_value, editable && current_value < config_item.max_value);
}
if (config_item.labels != NULL && config_item.labels->Contains(current_value)) {
if (config_item.labels != nullptr && config_item.labels->Contains(current_value)) {
SetDParam(idx++, STR_JUST_RAW_STRING);
SetDParamStr(idx++, config_item.labels->Find(current_value)->second);
} else {
@@ -421,7 +421,7 @@ struct AISettingsWindow : public Window {
}
}
virtual void OnPaint()
void OnPaint() override
{
if (this->closing_dropdown) {
this->closing_dropdown = false;
@@ -430,7 +430,7 @@ struct AISettingsWindow : public Window {
this->DrawWidgets();
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_AIS_BACKGROUND: {
@@ -479,12 +479,12 @@ struct AISettingsWindow : public Window {
this->clicked_dropdown = true;
this->closing_dropdown = false;
DropDownList *list = new DropDownList();
DropDownList list;
for (int i = config_item.min_value; i <= config_item.max_value; i++) {
*list->Append() = new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false);
list.emplace_back(new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false));
}
ShowDropDownListAt(this, list, old_val, -1, wi_rect, COLOUR_ORANGE, true);
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE, true);
}
}
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
@@ -530,7 +530,7 @@ struct AISettingsWindow : public Window {
}
}
virtual void OnQueryTextFinished(char *str)
void OnQueryTextFinished(char *str) override
{
if (StrEmpty(str)) return;
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
@@ -542,7 +542,7 @@ struct AISettingsWindow : public Window {
this->SetDirty();
}
virtual void OnDropdownSelect(int widget, int index)
void OnDropdownSelect(int widget, int index) override
{
assert(this->clicked_dropdown);
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
@@ -553,7 +553,7 @@ struct AISettingsWindow : public Window {
this->SetDirty();
}
virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close)
void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override
{
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
* the same dropdown button was clicked again, and then not open the dropdown again.
@@ -564,12 +564,12 @@ struct AISettingsWindow : public Window {
this->SetDirty();
}
virtual void OnResize()
void OnResize() override
{
this->vscroll->SetCapacityFromWidget(this, WID_AIS_BACKGROUND);
}
virtual void OnRealtimeTick(uint delta_ms)
void OnRealtimeTick(uint delta_ms) override
{
if (this->timeout.Elapsed(delta_ms)) {
this->clicked_button = -1;
@@ -582,7 +582,7 @@ struct AISettingsWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
this->RebuildVisibleSettings();
HideDropDownMenu(this);
@@ -646,7 +646,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
this->LoadTextfile(textfile, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
}
/* virtual */ void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
if (widget == WID_TF_CAPTION) {
SetDParam(0, (slot == OWNER_DEITY) ? STR_CONTENT_TYPE_GAME_SCRIPT : STR_CONTENT_TYPE_AI);
@@ -743,7 +743,7 @@ struct AIConfigWindow : public Window {
DeleteWindowByClass(WC_AI_SETTINGS);
}
virtual void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_AIC_NUMBER:
@@ -767,7 +767,7 @@ struct AIConfigWindow : public Window {
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_AIC_GAMELIST:
@@ -805,12 +805,12 @@ struct AIConfigWindow : public Window {
*/
static bool IsEditable(CompanyID slot)
{
if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL || Game::GetInstance() != NULL;
if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL || Game::GetInstance() != nullptr;
if (_game_mode != GM_NORMAL) {
return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
}
if (Company::IsValidID(slot) || slot < 0) return false;
if (Company::IsValidID(slot)) return false;
int max_slot = GetGameSettings().difficulty.max_no_competitors;
for (CompanyID cid = COMPANY_FIRST; cid < (CompanyID)max_slot && cid < MAX_COMPANIES; cid++) {
@@ -819,13 +819,13 @@ struct AIConfigWindow : public Window {
return slot < max_slot;
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_AIC_GAMELIST: {
StringID text = STR_AI_CONFIG_NONE;
if (GameConfig::GetConfig()->GetInfo() != NULL) {
if (GameConfig::GetConfig()->GetInfo() != nullptr) {
SetDParamStr(0, GameConfig::GetConfig()->GetInfo()->GetName());
text = STR_JUST_RAW_STRING;
}
@@ -843,7 +843,7 @@ struct AIConfigWindow : public Window {
if ((_game_mode != GM_NORMAL && i == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(i))) {
text = STR_AI_CONFIG_HUMAN_PLAYER;
} else if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != NULL) {
} else if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != nullptr) {
SetDParamStr(0, AIConfig::GetConfig((CompanyID)i)->GetInfo()->GetName());
text = STR_JUST_RAW_STRING;
} else {
@@ -858,10 +858,10 @@ struct AIConfigWindow : public Window {
}
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
if (widget >= WID_AIC_TEXTFILE && widget < WID_AIC_TEXTFILE + TFT_END) {
if (this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot) == NULL) return;
if (this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot) == nullptr) return;
ShowScriptTextfileWindow((TextfileType)(widget - WID_AIC_TEXTFILE), this->selected_slot);
return;
@@ -928,9 +928,7 @@ struct AIConfigWindow : public Window {
if (!_network_available) {
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
#if defined(ENABLE_NETWORK)
ShowNetworkContentListWindow(NULL, CONTENT_TYPE_AI, CONTENT_TYPE_GAME);
#endif
ShowNetworkContentListWindow(nullptr, CONTENT_TYPE_AI, CONTENT_TYPE_GAME);
}
break;
}
@@ -941,7 +939,7 @@ struct AIConfigWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (!IsEditable(this->selected_slot)) {
this->selected_slot = INVALID_COMPANY;
@@ -957,7 +955,7 @@ struct AIConfigWindow : public Window {
this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
for (TextfileType tft = TFT_BEGIN; tft < TFT_END; tft++) {
this->SetWidgetDisabledState(WID_AIC_TEXTFILE + tft, this->selected_slot == INVALID_COMPANY || (GetConfig(this->selected_slot)->GetTextfile(tft, this->selected_slot) == NULL));
this->SetWidgetDisabledState(WID_AIC_TEXTFILE + tft, this->selected_slot == INVALID_COMPANY || (GetConfig(this->selected_slot)->GetTextfile(tft, this->selected_slot) == nullptr));
}
}
};
@@ -1026,7 +1024,7 @@ struct AIDebugWindow : public Window {
{
if (ai_debug_company == OWNER_DEITY) {
GameInstance *game = Game::GetInstance();
return game == NULL || game->IsDead();
return game == nullptr || game->IsDead();
}
return !Company::IsValidAiID(ai_debug_company) || Company::Get(ai_debug_company)->ai_instance->IsDead();
}
@@ -1040,7 +1038,7 @@ struct AIDebugWindow : public Window {
{
switch (company) {
case INVALID_COMPANY: return false;
case OWNER_DEITY: return Game::GetInstance() != NULL;
case OWNER_DEITY: return Game::GetInstance() != nullptr;
default: return Company::IsValidAiID(company);
}
}
@@ -1065,7 +1063,7 @@ struct AIDebugWindow : public Window {
}
/* If no AI is available, see if there is a game script. */
if (Game::GetInstance() != NULL) ChangeToAI(OWNER_DEITY);
if (Game::GetInstance() != nullptr) ChangeToAI(OWNER_DEITY);
}
/**
@@ -1098,7 +1096,7 @@ struct AIDebugWindow : public Window {
this->InvalidateData(-1);
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
if (widget == WID_AID_LOG_PANEL) {
resize->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
@@ -1106,7 +1104,7 @@ struct AIDebugWindow : public Window {
}
}
virtual void OnPaint()
void OnPaint() override
{
this->SelectValidDebugCompany();
@@ -1142,7 +1140,7 @@ struct AIDebugWindow : public Window {
/* Set button colour for Game Script. */
GameInstance *game = Game::GetInstance();
bool valid = game != NULL;
bool valid = game != nullptr;
bool dead = valid && game->IsDead();
bool paused = valid && game->IsPaused();
@@ -1156,7 +1154,7 @@ struct AIDebugWindow : public Window {
ScriptLog::LogData *log = this->GetLogPointer();
int scroll_count = (log == NULL) ? 0 : log->used;
int scroll_count = (log == nullptr) ? 0 : log->used;
if (this->vscroll->GetCount() != scroll_count) {
this->vscroll->SetCount(scroll_count);
@@ -1164,7 +1162,7 @@ struct AIDebugWindow : public Window {
this->SetWidgetDirty(WID_AID_SCROLLBAR);
}
if (log == NULL) return;
if (log == nullptr) return;
/* Detect when the user scrolls the window. Enable autoscroll when the
* bottom-most line becomes visible. */
@@ -1184,13 +1182,13 @@ struct AIDebugWindow : public Window {
this->last_vscroll_pos = this->vscroll->GetPosition();
}
virtual void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_AID_NAME_TEXT:
if (ai_debug_company == OWNER_DEITY) {
const GameInfo *info = Game::GetInfo();
assert(info != NULL);
assert(info != nullptr);
SetDParam(0, STR_AI_DEBUG_NAME_AND_VERSION);
SetDParamStr(1, info->GetName());
SetDParam(2, info->GetVersion());
@@ -1198,7 +1196,7 @@ struct AIDebugWindow : public Window {
SetDParam(0, STR_EMPTY);
} else {
const AIInfo *info = Company::Get(ai_debug_company)->ai_info;
assert(info != NULL);
assert(info != nullptr);
SetDParam(0, STR_AI_DEBUG_NAME_AND_VERSION);
SetDParamStr(1, info->GetName());
SetDParam(2, info->GetVersion());
@@ -1207,19 +1205,19 @@ struct AIDebugWindow : public Window {
}
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
if (ai_debug_company == INVALID_COMPANY) return;
switch (widget) {
case WID_AID_LOG_PANEL: {
ScriptLog::LogData *log = this->GetLogPointer();
if (log == NULL) return;
if (log == nullptr) return;
int y = this->top_offset;
for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < log->used; i++) {
int pos = (i + log->pos + 1 - log->used + log->count) % log->count;
if (log->lines[pos] == NULL) break;
if (log->lines[pos] == nullptr) break;
TextColour colour;
switch (log->type[pos]) {
@@ -1266,7 +1264,7 @@ struct AIDebugWindow : public Window {
this->last_vscroll_pos = this->vscroll->GetPosition();
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
/* Also called for hotkeys, so check for disabledness */
if (this->IsWidgetDisabled(widget)) return;
@@ -1336,7 +1334,7 @@ struct AIDebugWindow : public Window {
}
}
virtual void OnEditboxChanged(int wid)
void OnEditboxChanged(int wid) override
{
if (wid == WID_AID_BREAK_STR_EDIT_BOX) {
/* Save the current string to static member so it can be restored next time the window is opened. */
@@ -1351,7 +1349,7 @@ struct AIDebugWindow : public Window {
* This is the company ID of the AI/GS which wrote a new log message, or -1 in other cases.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
/* If the log message is related to the active company tab, check the break string.
* This needs to be done in gameloop-scope, so the AI is suspended immediately. */
@@ -1359,7 +1357,7 @@ struct AIDebugWindow : public Window {
/* Get the log instance of the active company */
ScriptLog::LogData *log = this->GetLogPointer();
if (log != NULL) {
if (log != nullptr) {
this->break_string_filter.ResetState();
this->break_string_filter.AddLine(log->lines[log->pos]);
if (this->break_string_filter.GetState()) {
@@ -1387,8 +1385,8 @@ struct AIDebugWindow : public Window {
this->SelectValidDebugCompany();
ScriptLog::LogData *log = ai_debug_company != INVALID_COMPANY ? this->GetLogPointer() : NULL;
this->vscroll->SetCount((log == NULL) ? 0 : log->used);
ScriptLog::LogData *log = ai_debug_company != INVALID_COMPANY ? this->GetLogPointer() : nullptr;
this->vscroll->SetCount((log == nullptr) ? 0 : log->used);
/* Update company buttons */
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
@@ -1396,7 +1394,7 @@ struct AIDebugWindow : public Window {
this->SetWidgetLoweredState(i + WID_AID_COMPANY_BUTTON_START, ai_debug_company == i);
}
this->SetWidgetDisabledState(WID_AID_SCRIPT_GAME, Game::GetGameInstance() == NULL);
this->SetWidgetDisabledState(WID_AID_SCRIPT_GAME, Game::GetGameInstance() == nullptr);
this->SetWidgetLoweredState(WID_AID_SCRIPT_GAME, ai_debug_company == OWNER_DEITY);
this->SetWidgetLoweredState(WID_AID_BREAK_STR_ON_OFF_BTN, this->break_check_enabled);
@@ -1408,7 +1406,7 @@ struct AIDebugWindow : public Window {
(ai_debug_company == OWNER_DEITY ? !Game::IsPaused() : !AI::IsPaused(ai_debug_company)));
}
virtual void OnResize()
void OnResize() override
{
this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL);
}
@@ -1439,7 +1437,7 @@ static EventState AIDebugGlobalHotkeys(int hotkey)
{
if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
Window *w = ShowAIDebugWindow(INVALID_COMPANY);
if (w == NULL) return ES_NOT_HANDLED;
if (w == nullptr) return ES_NOT_HANDLED;
return w->OnHotkey(hotkey);
}
@@ -1532,14 +1530,14 @@ Window *ShowAIDebugWindow(CompanyID show_company)
{
if (!_networking || _network_server) {
AIDebugWindow *w = (AIDebugWindow *)BringWindowToFrontById(WC_AI_DEBUG, 0);
if (w == NULL) w = new AIDebugWindow(&_ai_debug_desc, 0);
if (w == nullptr) w = new AIDebugWindow(&_ai_debug_desc, 0);
if (show_company != INVALID_COMPANY) w->ChangeToAI(show_company);
return w;
} else {
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
}
return NULL;
return nullptr;
}
/**
@@ -1565,7 +1563,7 @@ void ShowAIDebugWindowIfAIError()
}
GameInstance *g = Game::GetGameInstance();
if (g != NULL && g->IsDead()) {
if (g != nullptr && g->IsDead()) {
ShowAIDebugWindow(OWNER_DEITY);
}
}

View File

@@ -29,7 +29,7 @@ static bool CheckAPIVersion(const char *api_version)
return strcmp(api_version, "0.7") == 0 || strcmp(api_version, "1.0") == 0 || strcmp(api_version, "1.1") == 0 ||
strcmp(api_version, "1.2") == 0 || strcmp(api_version, "1.3") == 0 || strcmp(api_version, "1.4") == 0 ||
strcmp(api_version, "1.5") == 0 || strcmp(api_version, "1.6") == 0 || strcmp(api_version, "1.7") == 0 ||
strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0;
strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0 || strcmp(api_version, "1.10") == 0;
}
#if defined(_WIN32)
@@ -65,8 +65,8 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
/* static */ SQInteger AIInfo::Constructor(HSQUIRRELVM vm)
{
/* Get the AIInfo */
SQUserPointer instance = NULL;
if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == NULL) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI");
SQUserPointer instance = nullptr;
if (SQ_FAILED(sq_getinstanceup(vm, 2, &instance, 0)) || instance == nullptr) return sq_throwerror(vm, "Pass an instance of a child class of AIInfo to RegisterAI");
AIInfo *info = (AIInfo *)instance;
SQInteger res = ScriptInfo::Constructor(vm, info);
@@ -100,7 +100,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
}
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
sq_setinstanceup(vm, 2, NULL);
sq_setinstanceup(vm, 2, nullptr);
/* Register the AI to the base system */
info->GetScanner()->RegisterScript(info);
return 0;
@@ -112,7 +112,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
SQUserPointer instance;
sq_getinstanceup(vm, 2, &instance, 0);
AIInfo *info = (AIInfo *)instance;
info->api_version = NULL;
info->api_version = nullptr;
SQInteger res = ScriptInfo::Constructor(vm, info);
if (res != 0) return res;
@@ -122,7 +122,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
info->api_version = stredup(buf);
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
sq_setinstanceup(vm, 2, NULL);
sq_setinstanceup(vm, 2, nullptr);
/* Register the AI to the base system */
static_cast<AIScannerInfo *>(info->GetScanner())->SetDummyAI(info);
return 0;
@@ -131,7 +131,7 @@ template <> const char *GetClassName<AIInfo, ST_AI>() { return "AIInfo"; }
AIInfo::AIInfo() :
min_loadable_version(0),
use_as_random(false),
api_version(NULL)
api_version(nullptr)
{
}

View File

@@ -59,7 +59,7 @@ private:
/** All static information from an AI library like name, version, etc. */
class AILibrary : public ScriptInfo {
public:
AILibrary() : ScriptInfo(), category(NULL) {};
AILibrary() : ScriptInfo(), category(nullptr) {};
~AILibrary();
/**

View File

@@ -62,6 +62,7 @@
#include "../script/api/ai/ai_rail.hpp.sq"
#include "../script/api/ai/ai_railtypelist.hpp.sq"
#include "../script/api/ai/ai_road.hpp.sq"
#include "../script/api/ai/ai_roadtypelist.hpp.sq"
#include "../script/api/ai/ai_sign.hpp.sq"
#include "../script/api/ai/ai_signlist.hpp.sq"
#include "../script/api/ai/ai_station.hpp.sq"
@@ -145,6 +146,7 @@ void AIInstance::RegisterAPI()
SQAIEventSubsidyOffer_Register(this->engine);
SQAIEventSubsidyOfferExpired_Register(this->engine);
SQAIEventTownFounded_Register(this->engine);
SQAIEventVehicleAutoReplaced_Register(this->engine);
SQAIEventVehicleCrashed_Register(this->engine);
SQAIEventVehicleLost_Register(this->engine);
SQAIEventVehicleUnprofitable_Register(this->engine);
@@ -167,6 +169,7 @@ void AIInstance::RegisterAPI()
SQAIRail_Register(this->engine);
SQAIRailTypeList_Register(this->engine);
SQAIRoad_Register(this->engine);
SQAIRoadTypeList_Register(this->engine);
SQAISign_Register(this->engine);
SQAISignList_Register(this->engine);
SQAIStation_Register(this->engine);
@@ -216,10 +219,10 @@ void AIInstance::Died()
ShowAIDebugWindow(_current_company);
const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
if (info != NULL) {
if (info != nullptr) {
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
if (info->GetURL() != NULL) {
if (info->GetURL() != nullptr) {
ScriptLog::Info("Please report the error to the following URL:");
ScriptLog::Info(info->GetURL());
}
@@ -228,6 +231,7 @@ void AIInstance::Died()
void AIInstance::LoadDummyScript()
{
ScriptAllocatorScope alloc_scope(this->engine);
extern void Script_CreateDummy(HSQUIRRELVM vm, StringID string, const char *type);
Script_CreateDummy(this->engine->GetVM(), STR_ERROR_AI_NO_AI_FOUND, "AI");
}
@@ -259,7 +263,7 @@ void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint3
* when the company does not exist anymore.
*/
const Company *c = Company::GetIfValid(_current_company);
if (c == NULL || c->ai_instance == NULL) return;
if (c == nullptr || c->ai_instance == nullptr) return;
if (c->ai_instance->DoCommandCallback(result, tile, p1, p2, cmd)) {
c->ai_instance->Continue();

View File

@@ -25,14 +25,14 @@ public:
*/
void Initialize(class AIInfo *info);
/* virtual */ int GetSetting(const char *name);
/* virtual */ ScriptInfo *FindLibrary(const char *library, int version);
int GetSetting(const char *name) override;
ScriptInfo *FindLibrary(const char *library, int version) override;
private:
/* virtual */ void RegisterAPI();
/* virtual */ void Died();
/* virtual */ CommandCallback *GetDoCommandCallback();
/* virtual */ void LoadDummyScript();
void RegisterAPI() override;
void Died() override;
CommandCallback *GetDoCommandCallback() override;
void LoadDummyScript() override;
};
#endif /* AI_INSTANCE_HPP */

View File

@@ -23,7 +23,7 @@
AIScannerInfo::AIScannerInfo() :
ScriptScanner(),
info_dummy(NULL)
info_dummy(nullptr)
{
}
@@ -31,6 +31,8 @@ void AIScannerInfo::Initialize()
{
ScriptScanner::Initialize("AIScanner");
ScriptAllocatorScope alloc_scope(this->engine);
/* Create the dummy AI */
free(this->main_script);
this->main_script = stredup("%_dummy");
@@ -94,14 +96,14 @@ AIInfo *AIScannerInfo::SelectRandomAI() const
AIInfo *AIScannerInfo::FindInfo(const char *nameParam, int versionParam, bool force_exact_match)
{
if (this->info_list.size() == 0) return NULL;
if (nameParam == NULL) return NULL;
if (this->info_list.size() == 0) return nullptr;
if (nameParam == nullptr) return nullptr;
char ai_name[1024];
strecpy(ai_name, nameParam, lastof(ai_name));
strtolower(ai_name);
AIInfo *info = NULL;
AIInfo *info = nullptr;
int version = -1;
if (versionParam == -1) {
@@ -110,7 +112,7 @@ AIInfo *AIScannerInfo::FindInfo(const char *nameParam, int versionParam, bool fo
/* If we didn't find a match AI, maybe the user included a version */
char *e = strrchr(ai_name, '.');
if (e == NULL) return NULL;
if (e == nullptr) return nullptr;
*e = '\0';
e++;
versionParam = atoi(e);
@@ -165,7 +167,7 @@ AILibrary *AIScannerLibrary::FindLibrary(const char *library, int version)
/* Check if the library + version exists */
ScriptInfoList::iterator iter = this->info_list.find(library_name);
if (iter == this->info_list.end()) return NULL;
if (iter == this->info_list.end()) return nullptr;
return static_cast<AILibrary *>((*iter).second);
}

View File

@@ -19,7 +19,7 @@ public:
AIScannerInfo();
~AIScannerInfo();
/* virtual */ void Initialize();
void Initialize() override;
/**
* Select a random AI.
@@ -32,7 +32,7 @@ public:
* @param nameParam The name of the AI.
* @param versionParam The version of the AI, or -1 if you want the latest.
* @param force_exact_match Only match name+version, never latest.
* @return NULL if no match found, otherwise the AI that matched.
* @return nullptr if no match found, otherwise the AI that matched.
*/
class AIInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match);
@@ -42,11 +42,11 @@ public:
void SetDummyAI(class AIInfo *info);
protected:
/* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
/* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; }
/* virtual */ Subdirectory GetDirectory() const { return AI_DIR; }
/* virtual */ const char *GetScannerName() const { return "AIs"; }
/* virtual */ void RegisterAPI(class Squirrel *engine);
void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
const char *GetFileName() const override { return PATHSEP "info.nut"; }
Subdirectory GetDirectory() const override { return AI_DIR; }
const char *GetScannerName() const override { return "AIs"; }
void RegisterAPI(class Squirrel *engine) override;
private:
AIInfo *info_dummy; ///< The dummy AI.
@@ -54,22 +54,22 @@ private:
class AIScannerLibrary : public ScriptScanner {
public:
/* virtual */ void Initialize();
void Initialize() override;
/**
* Find a library in the pool.
* @param library The library name to find.
* @param version The version the library should have.
* @return The library if found, NULL otherwise.
* @return The library if found, nullptr otherwise.
*/
class AILibrary *FindLibrary(const char *library, int version);
protected:
/* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
/* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
/* virtual */ Subdirectory GetDirectory() const { return AI_LIBRARY_DIR; }
/* virtual */ const char *GetScannerName() const { return "AI Libraries"; }
/* virtual */ void RegisterAPI(class Squirrel *engine);
void GetScriptName(ScriptInfo *info, char *name, const char *last) override;
const char *GetFileName() const override { return PATHSEP "library.nut"; }
Subdirectory GetDirectory() const override { return AI_LIBRARY_DIR; }
const char *GetScannerName() const override { return "AI Libraries"; }
void RegisterAPI(class Squirrel *engine) override;
};
#endif /* AI_SCANNER_HPP */

View File

@@ -79,7 +79,7 @@ struct Aircraft FINAL : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
byte previous_pos; ///< Previous desired position of the aircraft.
StationID targetairport; ///< Airport to go to next.
byte state; ///< State of the airport. @see AirportMovementStates
DirectionByte last_direction;
Direction last_direction;
byte number_consecutive_turns; ///< Protection to prevent the aircraft of making a lot of turns in order to reach a specific point.
byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns.
byte flags; ///< Aircraft flags. @see AirVehicleFlags

View File

@@ -143,7 +143,7 @@ static StationID FindNearestHangar(const Aircraft *v)
if (v->acache.cached_max_range_sqr != 0) {
/* Check if our current destination can be reached from the depot airport. */
const Station *cur_dest = GetTargetAirportIfValid(v);
if (cur_dest != NULL && DistanceSquare(st->airport.tile, cur_dest->airport.tile) > v->acache.cached_max_range_sqr) continue;
if (cur_dest != nullptr && DistanceSquare(st->airport.tile, cur_dest->airport.tile) > v->acache.cached_max_range_sqr) continue;
}
if (distance < best || index == INVALID_STATION) {
best = distance;
@@ -295,7 +295,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
v->cargo_type = e->GetDefaultCargoType();
u->cargo_type = CT_MAIL;
v->name = NULL;
v->name = nullptr;
v->last_station_visited = INVALID_STATION;
v->last_loading_station = INVALID_STATION;
@@ -379,7 +379,7 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination,
{
const Station *st = GetTargetAirportIfValid(this);
/* If the station is not a valid airport or if it has no hangars */
if (st == NULL || !CanVehicleUseStation(this, st) || !st->airport.HasHangar()) {
if (st == nullptr || !CanVehicleUseStation(this, st) || !st->airport.HasHangar()) {
/* the aircraft has to search for a hangar on its own */
StationID station = FindNearestHangar(this);
@@ -388,8 +388,8 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination,
st = Station::Get(station);
}
if (location != NULL) *location = st->xy;
if (destination != NULL) *destination = st->index;
if (location != nullptr) *location = st->xy;
if (destination != nullptr) *destination = st->index;
return true;
}
@@ -408,7 +408,7 @@ static void CheckIfAircraftNeedsService(Aircraft *v)
const Station *st = Station::Get(v->current_order.GetDestination());
assert(st != NULL);
assert(st != nullptr);
/* only goto depot if the target airport has a depot */
if (st->airport.HasHangar() && CanVehicleUseStation(v, st)) {
@@ -531,7 +531,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
u->UpdatePositionAndViewport();
u = u->Next();
if (u != NULL) {
if (u != nullptr) {
u->x_pos = x;
u->y_pos = y;
u->z_pos = z + ROTOR_Z_OFFSET;
@@ -552,7 +552,7 @@ void HandleAircraftEnterHangar(Aircraft *v)
Aircraft *u = v->Next();
u->vehstatus |= VS_HIDDEN;
u = u->Next();
if (u != NULL) {
if (u != nullptr) {
u->vehstatus |= VS_HIDDEN;
u->cur_speed = 0;
}
@@ -725,8 +725,8 @@ void GetAircraftFlightLevelBounds(const Vehicle *v, int *min_level, int *max_lev
/* Make faster planes fly higher so that they can overtake slower ones */
base_altitude += min(20 * (v->vcache.cached_max_speed / 200) - 90, 0);
if (min_level != NULL) *min_level = base_altitude + AIRCRAFT_MIN_FLYING_ALTITUDE;
if (max_level != NULL) *max_level = base_altitude + AIRCRAFT_MAX_FLYING_ALTITUDE;
if (min_level != nullptr) *min_level = base_altitude + AIRCRAFT_MIN_FLYING_ALTITUDE;
if (max_level != nullptr) *max_level = base_altitude + AIRCRAFT_MAX_FLYING_ALTITUDE;
}
/**
@@ -801,8 +801,8 @@ template int GetAircraftFlightLevel(Aircraft *v, bool takeoff);
*/
static byte AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc, Direction rotation)
{
assert(v != NULL);
assert(apc != NULL);
assert(v != nullptr);
assert(apc != nullptr);
/* In the case the station doesn't exit anymore, set target tile 0.
* It doesn't hurt much, aircraft will go to next order, nearest hangar
@@ -810,7 +810,7 @@ static byte AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc,
TileIndex tile = 0;
const Station *st = Station::GetIfValid(v->targetairport);
if (st != NULL) {
if (st != nullptr) {
/* Make sure we don't go to INVALID_TILE if the airport has been removed. */
tile = (st->airport.tile != INVALID_TILE) ? st->airport.tile : st->xy;
}
@@ -844,13 +844,13 @@ static bool AircraftController(Aircraft *v)
{
int count;
/* NULL if station is invalid */
/* nullptr if station is invalid */
const Station *st = Station::GetIfValid(v->targetairport);
/* INVALID_TILE if there is no station */
TileIndex tile = INVALID_TILE;
Direction rotation = DIR_N;
uint size_x = 1, size_y = 1;
if (st != NULL) {
if (st != nullptr) {
if (st->airport.tile != INVALID_TILE) {
tile = st->airport.tile;
rotation = st->airport.rotation;
@@ -864,7 +864,7 @@ static bool AircraftController(Aircraft *v)
const AirportFTAClass *afc = tile == INVALID_TILE ? GetAirport(AT_DUMMY) : st->airport.GetFTA();
/* prevent going to INVALID_TILE if airport is deleted. */
if (st == NULL || st->airport.tile == INVALID_TILE) {
if (st == nullptr || st->airport.tile == INVALID_TILE) {
/* Jump into our "holding pattern" state machine if possible */
if (v->pos >= afc->nofelements) {
v->pos = v->previous_pos = AircraftGetEntryPoint(v, afc, DIR_N);
@@ -904,7 +904,7 @@ static bool AircraftController(Aircraft *v)
v->tile = 0;
int z_dest;
GetAircraftFlightLevelBounds(v, &z_dest, NULL);
GetAircraftFlightLevelBounds(v, &z_dest, nullptr);
/* Reached altitude? */
if (v->z_pos >= z_dest) {
@@ -921,7 +921,7 @@ static bool AircraftController(Aircraft *v)
if (amd.flag & AMED_HELI_LOWER) {
SetBit(v->flags, VAF_HELI_DIRECT_DESCENT);
if (st == NULL) {
if (st == nullptr) {
/* FIXME - AircraftController -> if station no longer exists, do not land
* helicopter will circle until sign disappears, then go to next order
* what to do when it is the only order left, right now it just stays in 1 place */
@@ -1127,7 +1127,7 @@ static bool HandleCrashedAircraft(Aircraft *v)
Station *st = GetTargetAirportIfValid(v);
/* make aircraft crash down to the ground */
if (v->crashed_counter < 500 && st == NULL && ((v->crashed_counter % 3) == 0) ) {
if (v->crashed_counter < 500 && st == nullptr && ((v->crashed_counter % 3) == 0) ) {
int z = GetSlopePixelZ(Clamp(v->x_pos, 0, MapMaxX() * TILE_SIZE), Clamp(v->y_pos, 0, MapMaxY() * TILE_SIZE));
v->z_pos -= 1;
if (v->z_pos == z) {
@@ -1158,7 +1158,7 @@ static bool HandleCrashedAircraft(Aircraft *v)
/* clear runway-in on all airports, set by crashing plane
* small airports use AIRPORT_BUSY, city airports use RUNWAY_IN_OUT_block, etc.
* but they all share the same number */
if (st != NULL) {
if (st != nullptr) {
CLRBITS(st->airport.flags, RUNWAY_IN_block);
CLRBITS(st->airport.flags, RUNWAY_IN_OUT_block); // commuter airport
CLRBITS(st->airport.flags, RUNWAY_IN2_block); // intercontinental
@@ -1232,8 +1232,8 @@ void HandleMissingAircraftOrders(Aircraft *v)
* actually stops.
*/
const Station *st = GetTargetAirportIfValid(v);
if (st == NULL) {
Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE);
if (st == nullptr) {
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
CommandCost ret = DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_SEND_VEHICLE_TO_DEPOT);
cur_company.Restore();
@@ -1288,17 +1288,17 @@ static void CrashAirplane(Aircraft *v)
v->Next()->cargo.Truncate();
const Station *st = GetTargetAirportIfValid(v);
StringID newsitem;
if (st == NULL) {
if (st == nullptr) {
newsitem = STR_NEWS_PLANE_CRASH_OUT_OF_FUEL;
} else {
SetDParam(1, st->index);
newsitem = STR_NEWS_AIRCRAFT_CRASH;
}
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, st == NULL ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
Game::NewEvent(new ScriptEventVehicleCrashed(v->index, v->tile, st == NULL ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
Game::NewEvent(new ScriptEventVehicleCrashed(v->index, v->tile, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
AddVehicleNewsItem(newsitem, NT_ACCIDENT, v->index, st != NULL ? st->index : INVALID_STATION);
AddVehicleNewsItem(newsitem, NT_ACCIDENT, v->index, st != nullptr ? st->index : INVALID_STATION);
ModifyStationRatingAround(v->tile, v->owner, -160, 30);
if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_12_EXPLOSION, v);
@@ -1310,18 +1310,17 @@ static void CrashAirplane(Aircraft *v)
*/
static void MaybeCrashAirplane(Aircraft *v)
{
if (_settings_game.vehicle.plane_crashes == 0) return;
Station *st = Station::Get(v->targetairport);
/* FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports */
uint32 prob = (0x4000 << _settings_game.vehicle.plane_crashes);
uint32 prob;
if ((st->airport.GetFTA()->flags & AirportFTAClass::SHORT_STRIP) &&
(AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) &&
!_cheats.no_jetcrash.value) {
prob /= 20;
prob = 3276;
} else {
prob /= 1500;
if (_settings_game.vehicle.plane_crashes == 0) return;
prob = (0x4000 << _settings_game.vehicle.plane_crashes) / 1500;
}
if (GB(Random(), 0, 22) > prob) return;
@@ -1393,8 +1392,8 @@ void AircraftNextAirportPos_and_Order(Aircraft *v)
}
const Station *st = GetTargetAirportIfValid(v);
const AirportFTAClass *apc = st == NULL ? GetAirport(AT_DUMMY) : st->airport.GetFTA();
Direction rotation = st == NULL ? DIR_N : st->airport.rotation;
const AirportFTAClass *apc = st == nullptr ? GetAirport(AT_DUMMY) : st->airport.GetFTA();
Direction rotation = st == nullptr ? DIR_N : st->airport.rotation;
v->pos = v->previous_pos = AircraftGetEntryPoint(v, apc, rotation);
}
@@ -1419,7 +1418,7 @@ void AircraftLeaveHangar(Aircraft *v, Direction exit_dir)
/* Rotor blades */
u = u->Next();
if (u != NULL) {
if (u != nullptr) {
u->vehstatus &= ~VS_HIDDEN;
u->cur_speed = 80;
}
@@ -1589,7 +1588,7 @@ static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass
/* Send the helicopter to a hangar if needed for replacement */
if (v->NeedsAutomaticServicing()) {
Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
DoCommand(v->tile, v->index | DEPOT_SERVICE | DEPOT_LOCATE_HANGAR, 0, DC_EXEC, CMD_SEND_VEHICLE_TO_DEPOT);
cur_company.Restore();
}
@@ -1606,7 +1605,7 @@ static void AircraftEventHandler_Flying(Aircraft *v, const AirportFTAClass *apc)
* it is possible to choose from multiple landing runways, so loop until a free one is found */
byte landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
const AirportFTA *current = apc->layout[v->pos].next;
while (current != NULL) {
while (current != nullptr) {
if (current->heading == landingtype) {
/* save speed before, since if AirportHasBlock is false, it resets them to 0
* we don't want that for plane in air
@@ -1640,7 +1639,7 @@ static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *apc
/* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed */
if (v->NeedsAutomaticServicing()) {
Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
DoCommand(v->tile, v->index | DEPOT_SERVICE, 0, DC_EXEC, CMD_SEND_VEHICLE_TO_DEPOT);
cur_company.Restore();
}
@@ -1762,7 +1761,7 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc)
v->previous_pos = v->pos; // save previous location
/* there is only one choice to move to */
if (current->next == NULL) {
if (current->next == nullptr) {
if (AirportSetBlocks(v, current, apc)) {
v->pos = current->next_position;
UpdateAircraftCache(v);
@@ -1781,7 +1780,7 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc)
return false;
}
current = current->next;
} while (current != NULL);
} while (current != nullptr);
DEBUG(misc, 0, "[Ap] cannot move further on Airport! (pos %d state %d) for vehicle %d", v->pos, v->state, v->index);
NOT_REACHED();
@@ -1816,7 +1815,7 @@ static bool AirportHasBlock(Aircraft *v, const AirportFTA *current_pos, const Ai
* "reserve" a block for the plane
* @param v airplane that requires the operation
* @param current_pos of the vehicle in the list of blocks
* @param apc airport on which block is requsted to be set
* @param apc airport on which block is requested to be set
* @returns true on success. Eg, next block was free and we have occupied it
*/
static bool AirportSetBlocks(Aircraft *v, const AirportFTA *current_pos, const AirportFTAClass *apc)
@@ -1831,7 +1830,7 @@ static bool AirportSetBlocks(Aircraft *v, const AirportFTA *current_pos, const A
* this means more blocks should be checked/set */
const AirportFTA *current = current_pos;
if (current == reference) current = current->next;
while (current != NULL) {
while (current != nullptr) {
if (current->heading == current_pos->heading && current->block != 0) {
airport_flags |= current->block;
break;
@@ -1926,8 +1925,8 @@ static uint GetNumTerminals(const AirportFTAClass *apc)
static bool AirportFindFreeTerminal(Aircraft *v, const AirportFTAClass *apc)
{
/* example of more terminalgroups
* {0,HANGAR,NOTHING_block,1}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER_block,1}, {0,0,N,1},
* Heading 255 denotes a group. We see 2 groups here:
* {0,HANGAR,NOTHING_block,1}, {0,TERMGROUP,TERM_GROUP1_block,0}, {0,TERMGROUP,TERM_GROUP2_ENTER_block,1}, {0,0,N,1},
* Heading TERMGROUP denotes a group. We see 2 groups here:
* 1. group 0 -- TERM_GROUP1_block (check block)
* 2. group 1 -- TERM_GROUP2_ENTER_block (check block)
* First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it
@@ -1939,8 +1938,8 @@ static bool AirportFindFreeTerminal(Aircraft *v, const AirportFTAClass *apc)
const Station *st = Station::Get(v->targetairport);
const AirportFTA *temp = apc->layout[v->pos].next;
while (temp != NULL) {
if (temp->heading == 255) {
while (temp != nullptr) {
if (temp->heading == TERMGROUP) {
if (!(st->airport.flags & temp->block)) {
/* read which group do we want to go to?
* (the first free group) */
@@ -2038,9 +2037,9 @@ static bool AircraftEventHandler(Aircraft *v, int loop)
/* Check the distance to the next destination. This code works because the target
* airport is only updated after take off and not on the ground. */
Station *cur_st = Station::GetIfValid(v->targetairport);
Station *next_st = v->current_order.IsType(OT_GOTO_STATION) || v->current_order.IsType(OT_GOTO_DEPOT) ? Station::GetIfValid(v->current_order.GetDestination()) : NULL;
Station *next_st = v->current_order.IsType(OT_GOTO_STATION) || v->current_order.IsType(OT_GOTO_DEPOT) ? Station::GetIfValid(v->current_order.GetDestination()) : nullptr;
if (cur_st != NULL && cur_st->airport.tile != INVALID_TILE && next_st != NULL && next_st->airport.tile != INVALID_TILE) {
if (cur_st != nullptr && cur_st->airport.tile != INVALID_TILE && next_st != nullptr && next_st->airport.tile != INVALID_TILE) {
uint dist = DistanceSquare(cur_st->airport.tile, next_st->airport.tile);
AircraftHandleDestTooFar(v, dist > v->acache.cached_max_range_sqr);
}
@@ -2078,16 +2077,16 @@ bool Aircraft::Tick()
* Returns aircraft's target station if v->target_airport
* is a valid station with airport.
* @param v vehicle to get target airport for
* @return pointer to target station, NULL if invalid
* @return pointer to target station, nullptr if invalid
*/
Station *GetTargetAirportIfValid(const Aircraft *v)
{
assert(v->type == VEH_AIRCRAFT);
Station *st = Station::GetIfValid(v->targetairport);
if (st == NULL) return NULL;
if (st == nullptr) return nullptr;
return st->airport.tile == INVALID_TILE ? NULL : st;
return st->airport.tile == INVALID_TILE ? nullptr : st;
}
/**

View File

@@ -36,7 +36,7 @@ void DrawAircraftDetails(const Aircraft *v, int left, int right, int y)
int y_offset = (v->Next()->cargo_cap != 0) ? -(FONT_HEIGHT_NORMAL + 1): 0;
Money feeder_share = 0;
for (const Aircraft *u = v; u != NULL; u = u->Next()) {
for (const Aircraft *u = v; u != nullptr; u = u->Next()) {
if (u->IsNormalAircraft()) {
SetDParam(0, u->engine_type);
SetDParam(1, u->build_year);

View File

@@ -46,7 +46,7 @@
* @param delta_z Height of the airport above the land.
*/
#define HELIPORT(name, num_helipads, delta_z) \
AIRPORT_GENERIC(name, NULL, num_helipads, AirportFTAClass::HELICOPTERS, delta_z)
AIRPORT_GENERIC(name, nullptr, num_helipads, AirportFTAClass::HELICOPTERS, delta_z)
AIRPORT(country, 0, true)
AIRPORT(city, 0, false)
@@ -58,7 +58,7 @@ HELIPORT(helidepot, 1, 0)
AIRPORT(intercontinental, 2, false)
HELIPORT(helistation, 3, 0)
HELIPORT(oilrig, 1, 54)
AIRPORT_GENERIC(dummy, NULL, 0, AirportFTAClass::ALL, 0)
AIRPORT_GENERIC(dummy, nullptr, 0, AirportFTAClass::ALL, 0)
#undef HELIPORT
#undef AIRPORT
@@ -135,7 +135,7 @@ AirportFTAClass::~AirportFTAClass()
{
for (uint i = 0; i < nofelements; i++) {
AirportFTA *current = layout[i].next;
while (current != NULL) {
while (current != nullptr) {
AirportFTA *next = current->next;
free(current);
current = next;
@@ -195,7 +195,7 @@ static AirportFTA *AirportBuildAutomata(uint nofelements, const AirportFTAbuildu
current = current->next;
internalcounter++;
}
current->next = NULL;
current->next = nullptr;
internalcounter++;
}
return FAutomata;

View File

@@ -83,6 +83,7 @@ enum AirportMovementStates {
TERM8 = 20, ///< Heading for terminal 8.
HELIPAD3 = 21, ///< Heading for helipad 3.
MAX_HEADINGS = 21, ///< Last valid target to head for.
TERMGROUP = 255, ///< Aircraft is looking for a free terminal in a terminalgroup.
};
/** Movement Blocks on Airports blocks (eg_airport_flags). */
@@ -133,7 +134,7 @@ struct AirportMovingData {
int16 x; ///< x-coordinate of the destination.
int16 y; ///< y-coordinate of the destination.
uint16 flag; ///< special flags when moving towards the destination.
DirectionByte direction; ///< Direction to turn the aircraft after reaching the destination.
Direction direction; ///< Direction to turn the aircraft after reaching the destination.
};
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y);

View File

@@ -79,6 +79,7 @@ struct BuildAirToolbarWindow : Window {
~BuildAirToolbarWindow()
{
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
}
@@ -87,14 +88,14 @@ struct BuildAirToolbarWindow : Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (!gui_scope) return;
if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) delete this;
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_AT_AIRPORT:
@@ -114,7 +115,7 @@ struct BuildAirToolbarWindow : Window {
}
virtual void OnPlaceObject(Point pt, TileIndex tile)
void OnPlaceObject(Point pt, TileIndex tile) override
{
switch (this->last_user_action) {
case WID_AT_AIRPORT:
@@ -129,20 +130,22 @@ struct BuildAirToolbarWindow : Window {
}
}
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
{
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
}
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
{
if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
}
}
virtual void OnPlaceObjectAbort()
void OnPlaceObjectAbort() override
{
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
this->RaiseButtons();
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
@@ -161,7 +164,7 @@ static EventState AirportToolbarGlobalHotkeys(int hotkey)
{
if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
Window *w = ShowBuildAirToolbar();
if (w == NULL) return ES_NOT_HANDLED;
if (w == nullptr) return ES_NOT_HANDLED;
return w->OnHotkey(hotkey);
}
@@ -198,11 +201,11 @@ static WindowDesc _air_toolbar_desc(
*
* If the terraform toolbar is linked to the toolbar, that window is also opened.
*
* @return newly opened airport toolbar, or NULL if the toolbar could not be opened.
* @return newly opened airport toolbar, or nullptr if the toolbar could not be opened.
*/
Window *ShowBuildAirToolbar()
{
if (!Company::IsValidID(_local_company)) return NULL;
if (!Company::IsValidID(_local_company)) return nullptr;
DeleteWindowByClass(WC_BUILD_TOOLBAR);
return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
@@ -214,12 +217,12 @@ class BuildAirportWindow : public PickerWindowBase {
Scrollbar *vscroll;
/** Build a dropdown list of available airport classes */
static DropDownList *BuildAirportClassDropDown()
static DropDownList BuildAirportClassDropDown()
{
DropDownList *list = new DropDownList();
DropDownList list;
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
*list->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false);
list.emplace_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
}
return list;
@@ -268,7 +271,7 @@ public:
DeleteWindowById(WC_SELECT_STATION, 0);
}
virtual void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_AP_CLASS_DROPDOWN:
@@ -293,7 +296,7 @@ public:
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_AP_CLASS_DROPDOWN: {
@@ -357,7 +360,7 @@ public:
}
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_AP_AIRPORT_LIST: {
@@ -394,7 +397,7 @@ public:
}
}
virtual void OnPaint()
void OnPaint() override
{
this->DrawWidgets();
@@ -462,7 +465,7 @@ public:
}
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_AP_CLASS_DROPDOWN:
@@ -535,7 +538,7 @@ public:
this->SelectOtherAirport(-1);
}
virtual void OnDropdownSelect(int widget, int index)
void OnDropdownSelect(int widget, int index) override
{
assert(widget == WID_AP_CLASS_DROPDOWN);
_selected_airport_class = (AirportClassID)index;
@@ -543,7 +546,7 @@ public:
this->SelectFirstAvailableAirport(false);
}
virtual void OnRealtimeTick(uint delta_ms)
void OnRealtimeTick(uint delta_ms) override
{
CheckRedrawStationCoverage(this);
}

View File

@@ -19,7 +19,7 @@
#include "safeguards.h"
/** The table/list with animated tiles. */
SmallVector<TileIndex, 256> _animated_tiles;
std::vector<TileIndex> _animated_tiles;
/**
* Removes the given tile from the animated tile table.
@@ -27,10 +27,10 @@ SmallVector<TileIndex, 256> _animated_tiles;
*/
void DeleteAnimatedTile(TileIndex tile)
{
TileIndex *to_remove = _animated_tiles.Find(tile);
if (to_remove != _animated_tiles.End()) {
auto to_remove = std::find(_animated_tiles.begin(), _animated_tiles.end(), tile);
if (to_remove != _animated_tiles.end()) {
/* The order of the remaining elements must stay the same, otherwise the animation loop may miss a tile. */
_animated_tiles.ErasePreservingOrder(to_remove);
_animated_tiles.erase(to_remove);
MarkTileDirtyByTile(tile);
}
}
@@ -43,7 +43,7 @@ void DeleteAnimatedTile(TileIndex tile)
void AddAnimatedTile(TileIndex tile)
{
MarkTileDirtyByTile(tile);
_animated_tiles.Include(tile);
include(_animated_tiles, tile);
}
/**
@@ -53,8 +53,8 @@ void AnimateAnimatedTiles()
{
PerformanceAccumulator framerate(PFE_GL_LANDSCAPE);
const TileIndex *ti = _animated_tiles.Begin();
while (ti < _animated_tiles.End()) {
const TileIndex *ti = _animated_tiles.data();
while (ti < _animated_tiles.data() + _animated_tiles.size()) {
const TileIndex curr = *ti;
AnimateTile(curr);
/* During the AnimateTile call, DeleteAnimatedTile could have been called,
@@ -75,5 +75,5 @@ void AnimateAnimatedTiles()
*/
void InitializeAnimatedTiles()
{
_animated_tiles.Clear();
_animated_tiles.clear();
}

View File

@@ -31,9 +31,9 @@ static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts
* @param mirrored Returns whether the part shall be flipped.
* @return engine to add or INVALID_ENGINE
*/
static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle *front = NULL, bool *mirrored = NULL)
static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle *front = nullptr, bool *mirrored = nullptr)
{
assert(front == NULL || front->engine_type == front_type);
assert(front == nullptr || front->engine_type == front_type);
const Engine *front_engine = Engine::Get(front_type);
@@ -44,12 +44,12 @@ static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle
/* 8 bits, bit 7 for mirroring */
callback = GB(callback, 0, 8);
if (callback == 0xFF) return INVALID_ENGINE;
if (mirrored != NULL) *mirrored = HasBit(callback, 7);
if (mirrored != nullptr) *mirrored = HasBit(callback, 7);
callback = GB(callback, 0, 7);
} else {
/* 15 bits, bit 14 for mirroring */
if (callback == 0x7FFF) return INVALID_ENGINE;
if (mirrored != NULL) *mirrored = HasBit(callback, 14);
if (mirrored != nullptr) *mirrored = HasBit(callback, 14);
callback = GB(callback, 0, 14);
}
@@ -80,7 +80,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
* either, so it doesn't matter how many articulated parts there are. */
if (!Vehicle::CanAllocateItem()) return 0;
Vehicle *v = NULL;
Vehicle *v = nullptr;
if (!purchase_window) {
v = new Vehicle();
v->engine_type = engine_type;
@@ -108,7 +108,7 @@ static inline uint16 GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_t
{
const Engine *e = Engine::Get(engine);
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
if (cargo_type != NULL) *cargo_type = cargo;
if (cargo_type != nullptr) *cargo_type = cargo;
if (cargo == CT_INVALID) return 0;
return e->GetDisplayDefaultCapacity();
}
@@ -168,16 +168,16 @@ CargoArray GetCapacityOfArticulatedParts(EngineID engine)
* @param engine Model to investigate.
* @param[out] cargoes Total amount of units that can be transported, summed by cargo.
* @param[out] refits Whether a (possibly partial) refit for each cargo is possible.
* @param cargo_type Selected refitted cargo type
* @param cargo_capacity Capacity of selected refitted cargo type
*/
void GetArticulatedVehicleCargoesAndRefits(EngineID engine, CargoArray *cargoes, CargoTypes *refits)
void GetArticulatedVehicleCargoesAndRefits(EngineID engine, CargoArray *cargoes, CargoTypes *refits, CargoID cargo_type, uint16 cargo_capacity)
{
cargoes->Clear();
*refits = 0;
const Engine *e = Engine::Get(engine);
CargoID cargo_type;
uint16 cargo_capacity = GetVehicleDefaultCapacity(engine, &cargo_type);
if (cargo_type < NUM_CARGO && cargo_capacity > 0) {
(*cargoes)[cargo_type] += cargo_capacity;
if (IsEngineRefittable(engine)) SetBit(*refits, cargo_type);
@@ -290,15 +290,15 @@ bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *car
if (v->cargo_type != CT_INVALID && v->GetEngine()->CanCarryCargo()) {
if (first_cargo == CT_INVALID) first_cargo = v->cargo_type;
if (first_cargo != v->cargo_type) {
if (cargo_type != NULL) *cargo_type = CT_INVALID;
if (cargo_type != nullptr) *cargo_type = CT_INVALID;
return true;
}
}
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
} while (v != NULL);
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : nullptr;
} while (v != nullptr);
if (cargo_type != NULL) *cargo_type = first_cargo;
if (cargo_type != nullptr) *cargo_type = first_cargo;
return false;
}
@@ -330,8 +330,8 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
assert(v->cargo_type < NUM_CARGO);
real_default_capacity[v->cargo_type] += v->cargo_cap;
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
} while (v != NULL);
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : nullptr;
} while (v != nullptr);
/* Check whether the vehicle carries more cargoes than expected */
bool carries_more = false;

View File

@@ -29,11 +29,11 @@ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine, G
{
EngineRenew *er = (EngineRenew *)erl;
while (er != NULL) {
while (er != nullptr) {
if (er->from == engine && GroupIsInGroup(group, er->group_id)) return er;
er = er->next;
}
return NULL;
return nullptr;
}
/**
@@ -46,12 +46,12 @@ void RemoveAllEngineReplacement(EngineRenewList *erl)
EngineRenew *er = (EngineRenew *)(*erl);
EngineRenew *next;
while (er != NULL) {
while (er != nullptr) {
next = er->next;
delete er;
er = next;
}
*erl = NULL; // Empty list
*erl = nullptr; // Empty list
}
/**
@@ -66,12 +66,12 @@ void RemoveAllEngineReplacement(EngineRenewList *erl)
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group, bool *replace_when_old)
{
const EngineRenew *er = GetEngineReplacement(erl, engine, group);
if (er == NULL && (group == DEFAULT_GROUP || (Group::IsValidID(group) && !Group::Get(group)->replace_protection))) {
if (er == nullptr && (group == DEFAULT_GROUP || (Group::IsValidID(group) && !Group::Get(group)->replace_protection))) {
/* We didn't find anything useful in the vehicle's own group so we will try ALL_GROUP */
er = GetEngineReplacement(erl, engine, ALL_GROUP);
}
if (replace_when_old != NULL) *replace_when_old = er == NULL ? false : er->replace_when_old;
return er == NULL ? INVALID_ENGINE : er->to;
if (replace_when_old != nullptr) *replace_when_old = er == nullptr ? false : er->replace_when_old;
return er == nullptr ? INVALID_ENGINE : er->to;
}
/**
@@ -88,7 +88,7 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
{
/* Check if the old vehicle is already in the list */
EngineRenew *er = GetEngineReplacement(*erl, old_engine, group);
if (er != NULL) {
if (er != nullptr) {
if (flags & DC_EXEC) {
er->to = new_engine;
er->replace_when_old = replace_when_old;
@@ -122,12 +122,12 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags)
{
EngineRenew *er = (EngineRenew *)(*erl);
EngineRenew *prev = NULL;
EngineRenew *prev = nullptr;
while (er != NULL) {
while (er != nullptr) {
if (er->from == engine && er->group_id == group) {
if (flags & DC_EXEC) {
if (prev == NULL) { // First element
if (prev == nullptr) { // First element
/* The second becomes the new first element */
*erl = (EngineRenewList)er->next;
} else {

View File

@@ -20,6 +20,8 @@
#include "articulated_vehicles.h"
#include "core/random_func.hpp"
#include "vehiclelist.h"
#include "road.h"
#include "ai/ai.hpp"
#include "table/strings.h"
@@ -74,6 +76,9 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company)
}
case VEH_ROAD:
/* make sure the roadtypes are compatible */
if ((GetRoadTypeInfo(e_from->u.road.roadtype)->powered_roadtypes & GetRoadTypeInfo(e_to->u.road.roadtype)->powered_roadtypes) == ROADTYPES_NONE) return false;
/* make sure that we do not replace a tram with a normal road vehicles or vice versa */
if (HasBit(e_from->info.misc_flags, EF_ROAD_TRAM) != HasBit(e_to->info.misc_flags, EF_ROAD_TRAM)) return false;
break;
@@ -98,9 +103,9 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company)
*/
void CheckCargoCapacity(Vehicle *v)
{
assert(v == NULL || v->First() == v);
assert(v == nullptr || v->First() == v);
for (Vehicle *src = v; src != NULL; src = src->Next()) {
for (Vehicle *src = v; src != nullptr; src = src->Next()) {
assert(src->cargo.TotalCount() == src->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
/* Do we need to more cargo away? */
@@ -108,7 +113,7 @@ void CheckCargoCapacity(Vehicle *v)
/* We need to move a particular amount. Try that on the other vehicles. */
uint to_spread = src->cargo.TotalCount() - src->cargo_cap;
for (Vehicle *dest = v; dest != NULL && to_spread != 0; dest = dest->Next()) {
for (Vehicle *dest = v; dest != nullptr && to_spread != 0; dest = dest->Next()) {
assert(dest->cargo.TotalCount() == dest->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
if (dest->cargo.TotalCount() >= dest->cargo_cap || dest->cargo_type != src->cargo_type) continue;
@@ -135,7 +140,7 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
{
assert(!part_of_chain || new_head->IsPrimaryVehicle());
/* Loop through source parts */
for (Vehicle *src = old_veh; src != NULL; src = src->Next()) {
for (Vehicle *src = old_veh; src != nullptr; src = src->Next()) {
assert(src->cargo.TotalCount() == src->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
if (!part_of_chain && src->type == VEH_TRAIN && src != old_veh && src != Train::From(old_veh)->other_multiheaded_part && !src->IsArticulatedPart()) {
/* Skip vehicles, which do not belong to old_veh */
@@ -145,7 +150,7 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
if (src->cargo_type >= NUM_CARGO || src->cargo.TotalCount() == 0) continue;
/* Find free space in the new chain */
for (Vehicle *dest = new_head; dest != NULL && src->cargo.TotalCount() > 0; dest = dest->Next()) {
for (Vehicle *dest = new_head; dest != nullptr && src->cargo.TotalCount() > 0; dest = dest->Next()) {
assert(dest->cargo.TotalCount() == dest->cargo.ActionCount(VehicleCargoList::MTA_KEEP));
if (!part_of_chain && dest->type == VEH_TRAIN && dest != new_head && dest != Train::From(new_head)->other_multiheaded_part && !dest->IsArticulatedPart()) {
/* Skip vehicles, which do not belong to new_head */
@@ -216,7 +221,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool
/* the old engine didn't have cargo capacity, but the new one does
* now we will figure out what cargo the train is carrying and refit to fit this */
for (v = v->First(); v != NULL; v = v->Next()) {
for (v = v->First(); v != nullptr; v = v->Next()) {
if (!v->GetEngine()->CanCarryCargo()) continue;
/* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
if (HasBit(available_cargo_types, v->cargo_type)) return v->cargo_type;
@@ -280,7 +285,7 @@ static CommandCost GetNewEngineType(const Vehicle *v, const Company *c, bool alw
*/
static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehicle, bool part_of_chain)
{
*new_vehicle = NULL;
*new_vehicle = nullptr;
/* Shall the vehicle be replaced? */
const Company *c = Company::Get(_current_company);
@@ -294,7 +299,7 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
if (refit_cargo == CT_INVALID) return CommandCost(); // incompatible cargoes
/* Build the new vehicle */
cost = DoCommand(old_veh->tile, e, 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
cost = DoCommand(old_veh->tile, e | (CT_INVALID << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
if (cost.Failed()) return cost;
Vehicle *new_veh = Vehicle::Get(_new_vehicle_id);
@@ -330,14 +335,14 @@ static inline CommandCost CmdStartStopVehicle(const Vehicle *v, bool evaluate_ca
/**
* Issue a train vehicle move command
* @param v The vehicle to move
* @param after The vehicle to insert 'v' after, or NULL to start new chain
* @param after The vehicle to insert 'v' after, or nullptr to start new chain
* @param flags the command flags to use
* @param whole_chain move all vehicles following 'v' (true), or only 'v' (false)
* @return success or error
*/
static inline CommandCost CmdMoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
{
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags | DC_NO_CARGO_CAP_CHECK, CMD_MOVE_RAIL_VEHICLE);
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != nullptr ? after->index : INVALID_VEHICLE, flags | DC_NO_CARGO_CAP_CHECK, CMD_MOVE_RAIL_VEHICLE);
}
/**
@@ -395,11 +400,11 @@ static CommandCost ReplaceFreeUnit(Vehicle **single_unit, DoCommandFlag flags, b
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES, 0);
/* Build and refit replacement vehicle */
Vehicle *new_v = NULL;
Vehicle *new_v = nullptr;
cost.AddCost(BuildReplacementVehicle(old_v, &new_v, false));
/* Was a new vehicle constructed? */
if (cost.Succeeded() && new_v != NULL) {
if (cost.Succeeded() && new_v != nullptr) {
*nothing_to_do = false;
if ((flags & DC_EXEC) != 0) {
@@ -415,6 +420,8 @@ static CommandCost ReplaceFreeUnit(Vehicle **single_unit, DoCommandFlag flags, b
TransferCargo(old_v, new_v, false);
*single_unit = new_v;
AI::NewEvent(old_v->owner, new ScriptEventVehicleAutoReplaced(old_v->index, new_v->index));
}
/* Sell the old vehicle */
@@ -449,17 +456,17 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
uint16 old_total_length = CeilDiv(Train::From(old_head)->gcache.cached_total_length, TILE_SIZE) * TILE_SIZE;
int num_units = 0; ///< Number of units in the chain
for (Train *w = Train::From(old_head); w != NULL; w = w->GetNextUnit()) num_units++;
for (Train *w = Train::From(old_head); w != nullptr; w = w->GetNextUnit()) num_units++;
Train **old_vehs = CallocT<Train *>(num_units); ///< Will store vehicles of the old chain in their order
Train **new_vehs = CallocT<Train *>(num_units); ///< New vehicles corresponding to old_vehs or NULL if no replacement
Train **new_vehs = CallocT<Train *>(num_units); ///< New vehicles corresponding to old_vehs or nullptr if no replacement
Money *new_costs = MallocT<Money>(num_units); ///< Costs for buying and refitting the new vehicles
/* Collect vehicles and build replacements
* Note: The replacement vehicles can only successfully build as long as the old vehicles are still in their chain */
int i;
Train *w;
for (w = Train::From(old_head), i = 0; w != NULL; w = w->GetNextUnit(), i++) {
for (w = Train::From(old_head), i = 0; w != nullptr; w = w->GetNextUnit(), i++) {
assert(i < num_units);
old_vehs[i] = w;
@@ -468,41 +475,41 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if (cost.Failed()) break;
new_costs[i] = ret.GetCost();
if (new_vehs[i] != NULL) *nothing_to_do = false;
if (new_vehs[i] != nullptr) *nothing_to_do = false;
}
Train *new_head = (new_vehs[0] != NULL ? new_vehs[0] : old_vehs[0]);
Train *new_head = (new_vehs[0] != nullptr ? new_vehs[0] : old_vehs[0]);
/* Note: When autoreplace has already failed here, old_vehs[] is not completely initialized. But it is also not needed. */
if (cost.Succeeded()) {
/* Separate the head, so we can start constructing the new chain */
Train *second = Train::From(old_head)->GetNextUnit();
if (second != NULL) cost.AddCost(CmdMoveVehicle(second, NULL, DC_EXEC | DC_AUTOREPLACE, true));
if (second != nullptr) cost.AddCost(CmdMoveVehicle(second, nullptr, DC_EXEC | DC_AUTOREPLACE, true));
assert(Train::From(new_head)->GetNextUnit() == NULL);
assert(Train::From(new_head)->GetNextUnit() == nullptr);
/* Append engines to the new chain
* We do this from back to front, so that the head of the temporary vehicle chain does not change all the time.
* That way we also have less trouble when exceeding the unitnumber limit.
* OTOH the vehicle attach callback is more expensive this way :s */
Train *last_engine = NULL; ///< Shall store the last engine unit after this step
Train *last_engine = nullptr; ///< Shall store the last engine unit after this step
if (cost.Succeeded()) {
for (int i = num_units - 1; i > 0; i--) {
Train *append = (new_vehs[i] != NULL ? new_vehs[i] : old_vehs[i]);
Train *append = (new_vehs[i] != nullptr ? new_vehs[i] : old_vehs[i]);
if (RailVehInfo(append->engine_type)->railveh_type == RAILVEH_WAGON) continue;
if (new_vehs[i] != NULL) {
if (new_vehs[i] != nullptr) {
/* Move the old engine to a separate row with DC_AUTOREPLACE. Else
* moving the wagon in front may fail later due to unitnumber limit.
* (We have to attach wagons without DC_AUTOREPLACE.) */
CmdMoveVehicle(old_vehs[i], NULL, DC_EXEC | DC_AUTOREPLACE, false);
CmdMoveVehicle(old_vehs[i], nullptr, DC_EXEC | DC_AUTOREPLACE, false);
}
if (last_engine == NULL) last_engine = append;
if (last_engine == nullptr) last_engine = append;
cost.AddCost(CmdMoveVehicle(append, new_head, DC_EXEC, false));
if (cost.Failed()) break;
}
if (last_engine == NULL) last_engine = new_head;
if (last_engine == nullptr) last_engine = new_head;
}
/* When wagon removal is enabled and the new engines without any wagons are already longer than the old, we have to fail */
@@ -513,8 +520,8 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
*/
if (cost.Succeeded()) {
for (int i = num_units - 1; i > 0; i--) {
assert(last_engine != NULL);
Vehicle *append = (new_vehs[i] != NULL ? new_vehs[i] : old_vehs[i]);
assert(last_engine != nullptr);
Vehicle *append = (new_vehs[i] != nullptr ? new_vehs[i] : old_vehs[i]);
if (RailVehInfo(append->engine_type)->railveh_type == RAILVEH_WAGON) {
/* Insert wagon after 'last_engine' */
@@ -524,7 +531,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
* to the train becoming too long, or the train becoming longer
* would move the vehicle to the empty vehicle chain. */
if (wagon_removal && (res.Failed() ? res.GetErrorMessage() == STR_ERROR_TRAIN_TOO_LONG : new_head->gcache.cached_total_length > old_total_length)) {
CmdMoveVehicle(append, NULL, DC_EXEC | DC_AUTOREPLACE, false);
CmdMoveVehicle(append, nullptr, DC_EXEC | DC_AUTOREPLACE, false);
break;
}
@@ -543,7 +550,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
assert(new_head->gcache.cached_total_length <= _settings_game.vehicle.max_train_length * TILE_SIZE);
for (int i = 1; i < num_units; i++) {
Vehicle *wagon = new_vehs[i];
if (wagon == NULL) continue;
if (wagon == nullptr) continue;
if (wagon->First() == new_head) break;
assert(RailVehInfo(wagon->engine_type)->railveh_type == RAILVEH_WAGON);
@@ -551,7 +558,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
/* Sell wagon */
CommandCost ret = DoCommand(0, wagon->index, 0, DC_EXEC, GetCmdSellVeh(wagon));
assert(ret.Succeeded());
new_vehs[i] = NULL;
new_vehs[i] = nullptr;
/* Revert the money subtraction when the vehicle was built.
* This value is different from the sell value, esp. because of refitting */
@@ -572,18 +579,21 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
for (int i = 0; i < num_units; i++) {
Vehicle *w = old_vehs[i];
/* Is the vehicle again part of the new chain?
* Note: We cannot test 'new_vehs[i] != NULL' as wagon removal might cause to remove both */
* Note: We cannot test 'new_vehs[i] != nullptr' as wagon removal might cause to remove both */
if (w->First() == new_head) continue;
if ((flags & DC_EXEC) != 0) TransferCargo(w, new_head, true);
/* Sell the vehicle.
* Note: This might temporarly construct new trains, so use DC_AUTOREPLACE to prevent
* Note: This might temporarily construct new trains, so use DC_AUTOREPLACE to prevent
* it from failing due to engine limits. */
cost.AddCost(DoCommand(0, w->index, 0, flags | DC_AUTOREPLACE, GetCmdSellVeh(w)));
if ((flags & DC_EXEC) != 0) {
old_vehs[i] = NULL;
if (i == 0) old_head = NULL;
old_vehs[i] = nullptr;
if (i == 0) {
AI::NewEvent(old_head->owner, new ScriptEventVehicleAutoReplaced(old_head->index, new_head->index));
old_head = nullptr;
}
}
}
@@ -596,9 +606,9 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if ((flags & DC_EXEC) == 0) {
/* Separate the head, so we can reattach the old vehicles */
Train *second = Train::From(old_head)->GetNextUnit();
if (second != NULL) CmdMoveVehicle(second, NULL, DC_EXEC | DC_AUTOREPLACE, true);
if (second != nullptr) CmdMoveVehicle(second, nullptr, DC_EXEC | DC_AUTOREPLACE, true);
assert(Train::From(old_head)->GetNextUnit() == NULL);
assert(Train::From(old_head)->GetNextUnit() == nullptr);
for (int i = num_units - 1; i > 0; i--) {
CommandCost ret = CmdMoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
@@ -610,9 +620,9 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
/* Finally undo buying of new vehicles */
if ((flags & DC_EXEC) == 0) {
for (int i = num_units - 1; i >= 0; i--) {
if (new_vehs[i] != NULL) {
if (new_vehs[i] != nullptr) {
DoCommand(0, new_vehs[i]->index, 0, DC_EXEC, GetCmdSellVeh(new_vehs[i]));
new_vehs[i] = NULL;
new_vehs[i] = nullptr;
}
}
}
@@ -622,11 +632,11 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
free(new_costs);
} else {
/* Build and refit replacement vehicle */
Vehicle *new_head = NULL;
Vehicle *new_head = nullptr;
cost.AddCost(BuildReplacementVehicle(old_head, &new_head, true));
/* Was a new vehicle constructed? */
if (cost.Succeeded() && new_head != NULL) {
if (cost.Succeeded() && new_head != nullptr) {
*nothing_to_do = false;
/* The new vehicle is constructed, now take over orders and everything... */
@@ -637,6 +647,8 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if ((flags & DC_EXEC) != 0) {
TransferCargo(old_head, new_head, true);
*chain = new_head;
AI::NewEvent(old_head->owner, new ScriptEventVehicleAutoReplaced(old_head->index, new_head->index));
}
/* Sell the old vehicle */
@@ -666,7 +678,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Vehicle *v = Vehicle::GetIfValid(p1);
if (v == NULL) return CMD_ERROR;
if (v == nullptr) return CMD_ERROR;
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;
@@ -690,12 +702,12 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
/* Test whether any replacement is set, before issuing a whole lot of commands that would end in nothing changed */
Vehicle *w = v;
bool any_replacements = false;
while (w != NULL) {
while (w != nullptr) {
EngineID e;
CommandCost cost = GetNewEngineType(w, c, false, e);
if (cost.Failed()) return cost;
any_replacements |= (e != INVALID_ENGINE);
w = (!free_wagon && w->type == VEH_TRAIN ? Train::From(w)->GetNextUnit() : NULL);
w = (!free_wagon && w->type == VEH_TRAIN ? Train::From(w)->GetNextUnit() : nullptr);
}
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES, 0);
@@ -756,7 +768,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Company *c = Company::GetIfValid(_current_company);
if (c == NULL) return CMD_ERROR;
if (c == nullptr) return CMD_ERROR;
EngineID old_engine_type = GB(p2, 0, 16);
EngineID new_engine_type = GB(p2, 16, 16);

View File

@@ -16,7 +16,7 @@
#include "company_base.h"
void RemoveAllEngineReplacement(EngineRenewList *erl);
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group, bool *replace_when_old = NULL);
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group, bool *replace_when_old = nullptr);
CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, bool replace_when_old, DoCommandFlag flags);
CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags);
@@ -38,7 +38,7 @@ static inline void RemoveAllEngineReplacementForCompany(Company *c)
* @return The engine type to replace with, or INVALID_ENGINE if no
* replacement is in the list.
*/
static inline EngineID EngineReplacementForCompany(const Company *c, EngineID engine, GroupID group, bool *replace_when_old = NULL)
static inline EngineID EngineReplacementForCompany(const Company *c, EngineID engine, GroupID group, bool *replace_when_old = nullptr)
{
return EngineReplacement(c->engine_renew_list, engine, group, replace_when_old);
}

View File

@@ -14,6 +14,7 @@
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "rail.h"
#include "road.h"
#include "strings_func.h"
#include "window_func.h"
#include "autoreplace_func.h"
@@ -24,6 +25,7 @@
#include "settings_func.h"
#include "core/geometry_func.hpp"
#include "rail_gui.h"
#include "road_gui.h"
#include "widgets/dropdown_func.h"
#include "widgets/autoreplace_widget.h"
@@ -32,11 +34,9 @@
void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);
static int CDECL EngineNumberSorter(const EngineID *a, const EngineID *b)
static bool EngineNumberSorter(const EngineID &a, const EngineID &b)
{
int r = Engine::Get(*a)->list_position - Engine::Get(*b)->list_position;
return r;
return Engine::Get(a)->list_position < Engine::Get(b)->list_position;
}
/**
@@ -88,6 +88,7 @@ class ReplaceVehicleWindow : public Window {
bool descending_sort_order; ///< Order of sorting vehicles.
bool show_hidden_engines; ///< Whether to show the hidden engines.
RailType sel_railtype; ///< Type of rail tracks selected. #INVALID_RAILTYPE to show all.
RoadType sel_roadtype; ///< Type of road selected. #INVALID_ROADTYPE to show all.
Scrollbar *vscroll[2];
/**
@@ -123,13 +124,27 @@ class ReplaceVehicleWindow : public Window {
byte side = draw_left ? 0 : 1;
GUIEngineList *list = &this->engines[side];
list->Clear();
list->clear();
const Engine *e;
FOR_ALL_ENGINES_OF_TYPE(e, type) {
if (!draw_left && !this->show_hidden_engines && e->IsHidden(_local_company)) continue;
EngineID eid = e->index;
if (type == VEH_TRAIN && !this->GenerateReplaceRailList(eid, draw_left, this->replace_engines)) continue; // special rules for trains
switch (type) {
case VEH_TRAIN:
if (!this->GenerateReplaceRailList(eid, draw_left, this->replace_engines)) continue; // special rules for trains
break;
case VEH_ROAD:
if (draw_left && this->sel_roadtype != INVALID_ROADTYPE) {
/* Ensure that the roadtype is specific to the selected one */
if (e->u.road.roadtype != this->sel_roadtype) continue;
}
break;
default:
break;
}
if (draw_left) {
const uint num_engines = GetGroupNumEngines(_local_company, this->sel_group, eid);
@@ -140,7 +155,7 @@ class ReplaceVehicleWindow : public Window {
if (!CheckAutoreplaceValidity(this->sel_engine[0], eid, _local_company)) continue;
}
*list->Append() = eid;
list->push_back(eid);
if (eid == this->sel_engine[side]) selected_engine = eid; // The selected engine is still in the list
}
this->sel_engine[side] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore)
@@ -160,8 +175,8 @@ class ReplaceVehicleWindow : public Window {
if (this->engines[0].NeedRebuild()) {
/* We need to rebuild the left engines list */
this->GenerateReplaceVehList(true);
this->vscroll[0]->SetCount(this->engines[0].Length());
if (this->reset_sel_engine && this->sel_engine[0] == INVALID_ENGINE && this->engines[0].Length() != 0) {
this->vscroll[0]->SetCount((uint)this->engines[0].size());
if (this->reset_sel_engine && this->sel_engine[0] == INVALID_ENGINE && this->engines[0].size() != 0) {
this->sel_engine[0] = this->engines[0][0];
}
}
@@ -170,7 +185,7 @@ class ReplaceVehicleWindow : public Window {
/* Either we got a request to rebuild the right engines list, or the left engines list selected a different engine */
if (this->sel_engine[0] == INVALID_ENGINE) {
/* Always empty the right engines list when nothing is selected in the left engines list */
this->engines[1].Clear();
this->engines[1].clear();
this->sel_engine[1] = INVALID_ENGINE;
} else {
if (this->reset_sel_engine && this->sel_engine[0] != INVALID_ENGINE) {
@@ -180,11 +195,11 @@ class ReplaceVehicleWindow : public Window {
}
/* Regenerate the list on the right. Note: This resets sel_engine[1] to INVALID_ENGINE, if it is no longer available. */
this->GenerateReplaceVehList(false);
this->vscroll[1]->SetCount(this->engines[1].Length());
this->vscroll[1]->SetCount((uint)this->engines[1].size());
if (this->reset_sel_engine && this->sel_engine[1] != INVALID_ENGINE) {
int position = 0;
for (EngineID *it = this->engines[1].Begin(); it != this->engines[1].End(); ++it) {
if (*it == this->sel_engine[1]) break;
for (EngineID &eid : this->engines[1]) {
if (eid == this->sel_engine[1]) break;
++position;
}
this->vscroll[1]->ScrollTowards(position);
@@ -212,6 +227,7 @@ public:
ReplaceVehicleWindow(WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc)
{
this->sel_railtype = INVALID_RAILTYPE;
this->sel_roadtype = INVALID_ROADTYPE;
this->replace_engines = true; // start with locomotives (all other vehicles will not read this bool)
this->engines[0].ForceRebuild();
this->engines[1].ForceRebuild();
@@ -231,13 +247,18 @@ public:
widget->SetLowered(this->show_hidden_engines);
this->FinishInitNested(vehicletype);
if (vehicletype == VEH_TRAIN || vehicletype == VEH_ROAD) {
widget = this->GetWidget<NWidgetCore>(WID_RV_RAIL_ROAD_TYPE_DROPDOWN);
widget->tool_tip = STR_REPLACE_HELP_RAILTYPE + vehicletype;
}
this->sort_criteria = _engine_sort_last_criteria[vehicletype];
this->descending_sort_order = _engine_sort_last_order[vehicletype];
this->owner = _local_company;
this->sel_group = id_g;
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING: {
@@ -289,14 +310,29 @@ public:
break;
}
case WID_RV_TRAIN_RAILTYPE_DROPDOWN: {
case WID_RV_RAIL_ROAD_TYPE_DROPDOWN: {
Dimension d = {0, 0};
switch (this->window_number) {
case VEH_TRAIN:
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
const RailtypeInfo *rti = GetRailTypeInfo(rt);
/* Skip rail type if it has no label */
if (rti->label == 0) continue;
d = maxdim(d, GetStringBoundingBox(rti->strings.replace_text));
}
break;
case VEH_ROAD:
for (RoadType rt = ROADTYPE_BEGIN; rt < ROADTYPE_END; rt++) {
const RoadTypeInfo *rti = GetRoadTypeInfo(rt);
/* Skip road type if it has no label */
if (rti->label == 0) continue;
d = maxdim(d, GetStringBoundingBox(rti->strings.replace_text));
}
break;
default: NOT_REACHED();
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
@@ -316,7 +352,7 @@ public:
}
}
virtual void SetStringParameters(int widget) const
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_RV_CAPTION:
@@ -353,7 +389,7 @@ public:
}
}
virtual void DrawWidget(const Rect &r, int widget) const
void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING:
@@ -384,7 +420,7 @@ public:
case WID_RV_RIGHT_MATRIX: {
int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1;
EngineID start = this->vscroll[side]->GetPosition(); // what is the offset for the start (scrolling)
EngineID end = min(this->vscroll[side]->GetCapacity() + start, this->engines[side].Length());
EngineID end = min(this->vscroll[side]->GetCapacity() + start, (uint)this->engines[side].size());
/* Do the actual drawing */
DrawEngineList((VehicleType)this->window_number, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP,
@@ -394,7 +430,7 @@ public:
}
}
virtual void OnPaint()
void OnPaint() override
{
if (this->engines[0].NeedRebuild() || this->engines[1].NeedRebuild()) this->GenerateLists();
@@ -411,9 +447,18 @@ public:
* or The selected vehicle has no replacement set up */
this->SetWidgetDisabledState(WID_RV_STOP_REPLACE, this->sel_engine[0] == INVALID_ENGINE || !EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group));
if (this->window_number == VEH_TRAIN) {
switch (this->window_number) {
case VEH_TRAIN:
/* Show the selected railtype in the pulldown menu */
this->GetWidget<NWidgetCore>(WID_RV_TRAIN_RAILTYPE_DROPDOWN)->widget_data = sel_railtype == INVALID_RAILTYPE ? STR_REPLACE_ALL_RAILTYPE : GetRailTypeInfo(sel_railtype)->strings.replace_text;
this->GetWidget<NWidgetCore>(WID_RV_RAIL_ROAD_TYPE_DROPDOWN)->widget_data = sel_railtype == INVALID_RAILTYPE ? STR_REPLACE_ALL_RAILTYPE : GetRailTypeInfo(sel_railtype)->strings.replace_text;
break;
case VEH_ROAD:
/* Show the selected roadtype in the pulldown menu */
this->GetWidget<NWidgetCore>(WID_RV_RAIL_ROAD_TYPE_DROPDOWN)->widget_data = sel_roadtype == INVALID_ROADTYPE ? STR_REPLACE_ALL_ROADTYPE : GetRoadTypeInfo(sel_roadtype)->strings.replace_text;
break;
default: break;
}
this->DrawWidgets();
@@ -423,9 +468,16 @@ public:
/* Draw details panels. */
for (int side = 0; side < 2; side++) {
if (this->sel_engine[side] != INVALID_ENGINE) {
/* Use default engine details without refitting */
const Engine *e = Engine::Get(this->sel_engine[side]);
TestedEngineDetails ted;
ted.cost = 0;
ted.cargo = e->GetDefaultCargoType();
ted.capacity = e->GetDisplayDefaultCapacity(&ted.mail_capacity);
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS);
int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side]);
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side], ted);
needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
}
}
@@ -437,7 +489,7 @@ public:
}
}
virtual void OnClick(Point pt, int widget, int click_count)
void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING:
@@ -460,15 +512,23 @@ public:
break;
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
DropDownList *list = new DropDownList();
*list->Append() = new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false);
*list->Append() = new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false);
ShowDropDownList(this, list, this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
DropDownList list;
list.emplace_back(new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false));
list.emplace_back(new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false));
ShowDropDownList(this, std::move(list), this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
break;
}
case WID_RV_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu
ShowDropDownList(this, GetRailTypeDropDownList(true, true), sel_railtype, WID_RV_TRAIN_RAILTYPE_DROPDOWN);
case WID_RV_RAIL_ROAD_TYPE_DROPDOWN: // Rail/roadtype selection dropdown menu
switch (this->window_number) {
case VEH_TRAIN:
ShowDropDownList(this, GetRailTypeDropDownList(true, true), sel_railtype, WID_RV_RAIL_ROAD_TYPE_DROPDOWN);
break;
case VEH_ROAD:
ShowDropDownList(this, GetRoadTypeDropDownList(RTTB_ROAD | RTTB_TRAM, true, true), sel_roadtype, WID_RV_RAIL_ROAD_TYPE_DROPDOWN);
break;
}
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
@@ -501,7 +561,7 @@ public:
click_side = 1;
}
uint i = this->vscroll[click_side]->GetScrolledRowFromWidget(pt.y, this, widget);
size_t engine_count = this->engines[click_side].Length();
size_t engine_count = this->engines[click_side].size();
EngineID e = engine_count > i ? this->engines[click_side][i] : INVALID_ENGINE;
if (e == this->sel_engine[click_side]) break; // we clicked the one we already selected
@@ -516,7 +576,7 @@ public:
}
}
virtual void OnDropdownSelect(int widget, int index)
void OnDropdownSelect(int widget, int index) override
{
switch (widget) {
case WID_RV_SORT_DROPDOWN:
@@ -528,10 +588,25 @@ public:
}
break;
case WID_RV_TRAIN_RAILTYPE_DROPDOWN: {
case WID_RV_RAIL_ROAD_TYPE_DROPDOWN:
switch (this->window_number) {
case VEH_TRAIN: {
RailType temp = (RailType)index;
if (temp == sel_railtype) return; // we didn't select a new one. No need to change anything
sel_railtype = temp;
break;
}
case VEH_ROAD: {
RoadType temp = (RoadType)index;
if (temp == sel_roadtype) return; // we didn't select a new one. No need to change anything
sel_roadtype = temp;
break;
}
default: NOT_REACHED();
}
/* Reset scrollbar positions */
this->vscroll[0]->SetPosition(0);
this->vscroll[1]->SetPosition(0);
@@ -541,7 +616,6 @@ public:
this->reset_sel_engine = true;
this->SetDirty();
break;
}
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
this->replace_engines = index != 0;
@@ -557,7 +631,7 @@ public:
}
}
virtual void OnResize()
void OnResize() override
{
this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
this->vscroll[1]->SetCapacityFromWidget(this, WID_RV_RIGHT_MATRIX);
@@ -568,7 +642,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (data != 0) {
/* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
@@ -598,7 +672,7 @@ static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_RAIL_ROAD_TYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN), SetDataTip(STR_BLACK_STRING, STR_REPLACE_ENGINE_WAGON_SELECT_HELP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
@@ -643,6 +717,64 @@ static WindowDesc _replace_rail_vehicle_desc(
_nested_replace_rail_vehicle_widgets, lengthof(_nested_replace_rail_vehicle_widgets)
);
static const NWidgetPart _nested_replace_road_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_VEHICLES_IN_USE, STR_REPLACE_VEHICLE_VEHICLES_IN_USE_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES, STR_REPLACE_VEHICLE_AVAILABLE_VEHICLES_TOOLTIP), SetFill(1, 1), SetMinimalSize(0, 12), SetResize(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(NWID_VERTICAL),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_RAIL_ROAD_TYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 1),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_RV_SHOW_HIDDEN_ENGINES), SetDataTip(STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN, STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_PUSHBUTTON_DROPDOWN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
static WindowDesc _replace_road_vehicle_desc(
WDP_AUTO, "replace_vehicle_road", 500, 140,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
_nested_replace_road_vehicle_widgets, lengthof(_nested_replace_road_vehicle_widgets)
);
static const NWidgetPart _nested_replace_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -705,5 +837,11 @@ static WindowDesc _replace_vehicle_desc(
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
{
DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype);
new ReplaceVehicleWindow(vehicletype == VEH_TRAIN ? &_replace_rail_vehicle_desc : &_replace_vehicle_desc, vehicletype, id_g);
WindowDesc *desc;
switch (vehicletype) {
case VEH_TRAIN: desc = &_replace_rail_vehicle_desc; break;
case VEH_ROAD: desc = &_replace_road_vehicle_desc; break;
default: desc = &_replace_vehicle_desc; break;
}
new ReplaceVehicleWindow(desc, vehicletype, id_g);
}

View File

@@ -30,7 +30,7 @@ void BaseConsist::CopyConsistPropertiesFrom(const BaseConsist *src)
if (this == src) return;
free(this->name);
this->name = src->name != NULL ? stredup(src->name) : NULL;
this->name = src->name != nullptr ? stredup(src->name) : nullptr;
this->current_order_time = src->current_order_time;
this->lateness_counter = src->lateness_counter;

View File

@@ -31,7 +31,7 @@ struct BaseConsist {
uint16 vehicle_flags; ///< Used for gradual loading and other miscellaneous things (@see VehicleFlags enum)
BaseConsist() : name(NULL) {}
BaseConsist() : name(nullptr) {}
virtual ~BaseConsist();
void CopyConsistPropertiesFrom(const BaseConsist *src);

View File

@@ -76,9 +76,9 @@ struct BaseSet {
{
free(this->name);
for (TranslatedStrings::iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
free(iter->first);
free(iter->second);
for (auto &pair : this->description) {
free(pair.first);
free(pair.second);
}
for (uint i = 0; i < NUM_FILES; i++) {
@@ -118,20 +118,20 @@ struct BaseSet {
* @param isocode the isocode to search for
* @return the description
*/
const char *GetDescription(const char *isocode = NULL) const
const char *GetDescription(const char *isocode = nullptr) const
{
if (isocode != NULL) {
if (isocode != nullptr) {
/* First the full ISO code */
for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
if (strcmp(iter->first, isocode) == 0) return iter->second;
for (const auto &pair : this->description) {
if (strcmp(pair.first, isocode) == 0) return pair.second;
}
/* Then the first two characters */
for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
if (strncmp(iter->first, isocode, 2) == 0) return iter->second;
for (const auto &pair : this->description) {
if (strncmp(pair.first, isocode, 2) == 0) return pair.second;
}
}
/* Then fall back */
return this->description.Begin()->second;
return this->description.front().second;
}
/**
@@ -151,17 +151,17 @@ struct BaseSet {
/**
* Search a textfile file next to this base media.
* @param type The type of the textfile to search for.
* @return The filename for the textfile, \c NULL otherwise.
* @return The filename for the textfile, \c nullptr otherwise.
*/
const char *GetTextfile(TextfileType type) const
{
for (uint i = 0; i < NUM_FILES; i++) {
const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename);
if (textfile != NULL) {
if (textfile != nullptr) {
return textfile;
}
}
return NULL;
return nullptr;
}
};
@@ -176,7 +176,7 @@ protected:
static Tbase_set *duplicate_sets; ///< All sets that aren't available, but needed for not downloading base sets when a newer version than the one on BaNaNaS is loaded.
static const Tbase_set *used_set; ///< The currently used set
/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename) override;
/**
* Get the extension that is used to identify this set.
@@ -231,7 +231,7 @@ template <class Tbase_set> /* static */ Tbase_set *BaseMedia<Tbase_set>::duplica
* @param ci The content info to compare it to.
* @param md5sum Should the MD5 checksum be tested as well?
* @param s The list with sets.
* @return The filename of the first file of the base set, or \c NULL if there is no match.
* @return The filename of the first file of the base set, or \c nullptr if there is no match.
*/
template <class Tbase_set>
const char *TryGetBaseSetFile(const ContentInfo *ci, bool md5sum, const Tbase_set *s);

View File

@@ -23,7 +23,7 @@
*/
#define fetch_metadata(name) \
item = metadata->GetItem(name, false); \
if (item == NULL || StrEmpty(item->value)) { \
if (item == nullptr || StrEmpty(item->value)) { \
DEBUG(grf, 0, "Base " SET_TYPE "set detail loading: %s field missing.", name); \
DEBUG(grf, 0, " Is %s readable for the user running OpenTTD?", full_filename); \
return false; \
@@ -50,7 +50,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
this->description[stredup("")] = stredup(item->value);
/* Add the translations of the descriptions too. */
for (const IniItem *item = metadata->item; item != NULL; item = item->next) {
for (const IniItem *item = metadata->item; item != nullptr; item = item->next) {
if (strncmp("description.", item->name, 12) != 0) continue;
this->description[stredup(item->name + 12)] = stredup(item->value);
@@ -65,7 +65,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
this->version = atoi(item->value);
item = metadata->GetItem("fallback", false);
this->fallback = (item != NULL && strcmp(item->value, "0") != 0 && strcmp(item->value, "false") != 0);
this->fallback = (item != nullptr && strcmp(item->value, "0") != 0 && strcmp(item->value, "false") != 0);
/* For each of the file types we want to find the file, MD5 checksums and warning messages. */
IniGroup *files = ini->GetGroup("files");
@@ -75,14 +75,14 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
MD5File *file = &this->files[i];
/* Find the filename first. */
item = files->GetItem(BaseSet<T, Tnum_files, Tsearch_in_tars>::file_names[i], false);
if (item == NULL || (item->value == NULL && !allow_empty_filename)) {
if (item == nullptr || (item->value == nullptr && !allow_empty_filename)) {
DEBUG(grf, 0, "No " SET_TYPE " file for: %s (in %s)", BaseSet<T, Tnum_files, Tsearch_in_tars>::file_names[i], full_filename);
return false;
}
const char *filename = item->value;
if (filename == NULL) {
file->filename = NULL;
if (filename == nullptr) {
file->filename = nullptr;
/* If we list no file, that file must be valid */
this->valid_files++;
this->found_files++;
@@ -93,7 +93,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
/* Then find the MD5 checksum */
item = md5s->GetItem(filename, false);
if (item == NULL || item->value == NULL) {
if (item == nullptr || item->value == nullptr) {
DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
return false;
}
@@ -119,8 +119,8 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
/* Then find the warning message when the file's missing */
item = origin->GetItem(filename, false);
if (item == NULL) item = origin->GetItem("default", false);
if (item == NULL) {
if (item == nullptr) item = origin->GetItem("default", false);
if (item == nullptr) {
DEBUG(grf, 1, "No origin warning message specified for: %s", filename);
file->missing_warning = stredup("");
} else {
@@ -159,25 +159,25 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length,
Tbase_set *set = new Tbase_set();
IniFile *ini = new IniFile();
ini->LoadFromDisk(filename, BASESET_DIR);
char *path = stredup(filename + basepath_length);
ini->LoadFromDisk(path, BASESET_DIR);
char *psep = strrchr(path, PATHSEPCHAR);
if (psep != NULL) {
if (psep != nullptr) {
psep[1] = '\0';
} else {
*path = '\0';
}
if (set->FillSetDetails(ini, path, filename)) {
Tbase_set *duplicate = NULL;
for (Tbase_set *c = BaseMedia<Tbase_set>::available_sets; c != NULL; c = c->next) {
Tbase_set *duplicate = nullptr;
for (Tbase_set *c = BaseMedia<Tbase_set>::available_sets; c != nullptr; c = c->next) {
if (strcmp(c->name, set->name) == 0 || c->shortname == set->shortname) {
duplicate = c;
break;
}
}
if (duplicate != NULL) {
if (duplicate != nullptr) {
/* The more complete set takes precedence over the version number. */
if ((duplicate->valid_files == set->valid_files && duplicate->version >= set->version) ||
duplicate->valid_files > set->valid_files) {
@@ -205,7 +205,7 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length,
}
} else {
Tbase_set **last = &BaseMedia<Tbase_set>::available_sets;
while (*last != NULL) last = &(*last)->next;
while (*last != nullptr) last = &(*last)->next;
*last = set;
ret = true;
@@ -238,7 +238,7 @@ template <class Tbase_set>
return true;
}
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != NULL; s = s->next) {
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
if (strcmp(name, s->name) == 0) {
BaseMedia<Tbase_set>::used_set = s;
CheckExternalFiles();
@@ -258,7 +258,7 @@ template <class Tbase_set>
/* static */ char *BaseMedia<Tbase_set>::GetSetsList(char *p, const char *last)
{
p += seprintf(p, last, "List of " SET_TYPE " sets:\n");
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != NULL; s = s->next) {
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
p += seprintf(p, last, "%18s: %s", s->name, s->GetDescription());
int invalid = s->GetNumInvalid();
if (invalid != 0) {
@@ -277,12 +277,11 @@ template <class Tbase_set>
return p;
}
#if defined(ENABLE_NETWORK)
#include "network/network_content.h"
template <class Tbase_set> const char *TryGetBaseSetFile(const ContentInfo *ci, bool md5sum, const Tbase_set *s)
{
for (; s != NULL; s = s->next) {
for (; s != nullptr; s = s->next) {
if (s->GetNumMissing() != 0) continue;
if (s->shortname != ci->unique_id) continue;
@@ -297,32 +296,16 @@ template <class Tbase_set> const char *TryGetBaseSetFile(const ContentInfo *ci,
}
if (memcmp(md5, ci->md5sum, sizeof(md5)) == 0) return s->files[0].filename;
}
return NULL;
return nullptr;
}
template <class Tbase_set>
/* static */ bool BaseMedia<Tbase_set>::HasSet(const ContentInfo *ci, bool md5sum)
{
return (TryGetBaseSetFile(ci, md5sum, BaseMedia<Tbase_set>::available_sets) != NULL) ||
(TryGetBaseSetFile(ci, md5sum, BaseMedia<Tbase_set>::duplicate_sets) != NULL);
return (TryGetBaseSetFile(ci, md5sum, BaseMedia<Tbase_set>::available_sets) != nullptr) ||
(TryGetBaseSetFile(ci, md5sum, BaseMedia<Tbase_set>::duplicate_sets) != nullptr);
}
#else
template <class Tbase_set>
const char *TryGetBaseSetFile(const ContentInfo *ci, bool md5sum, const Tbase_set *s)
{
return NULL;
}
template <class Tbase_set>
/* static */ bool BaseMedia<Tbase_set>::HasSet(const ContentInfo *ci, bool md5sum)
{
return false;
}
#endif /* ENABLE_NETWORK */
/**
* Count the number of available graphics sets.
* @return the number of sets
@@ -331,7 +314,7 @@ template <class Tbase_set>
/* static */ int BaseMedia<Tbase_set>::GetNumSets()
{
int n = 0;
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != NULL; s = s->next) {
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
if (s != BaseMedia<Tbase_set>::used_set && s->GetNumMissing() != 0) continue;
n++;
}
@@ -346,7 +329,7 @@ template <class Tbase_set>
/* static */ int BaseMedia<Tbase_set>::GetIndexOfUsedSet()
{
int n = 0;
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != NULL; s = s->next) {
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
if (s == BaseMedia<Tbase_set>::used_set) return n;
if (s->GetNumMissing() != 0) continue;
n++;
@@ -361,7 +344,7 @@ template <class Tbase_set>
template <class Tbase_set>
/* static */ const Tbase_set *BaseMedia<Tbase_set>::GetSet(int index)
{
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != NULL; s = s->next) {
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
if (s != BaseMedia<Tbase_set>::used_set && s->GetNumMissing() != 0) continue;
if (index == 0) return s;
index--;

View File

@@ -60,8 +60,8 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
StringID string_id; ///< Default name (town area) of station
Town *town; ///< The town this station is associated with
OwnerByte owner; ///< The owner of this station
StationFacilityByte facilities; ///< The facilities that this station has
Owner owner; ///< The owner of this station
StationFacility facilities; ///< The facilities that this station has
uint8 num_specs; ///< Number of specs in the speclist
StationSpecList *speclist; ///< List of station specs of this station
@@ -110,6 +110,12 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
*/
virtual void UpdateVirtCoord() = 0;
virtual void MoveSign(TileIndex new_xy)
{
this->xy = new_xy;
this->UpdateVirtCoord();
}
/**
* Get the tile area for a given station type.
* @param ta tile area to fill.
@@ -214,7 +220,7 @@ struct SpecializedStation : public BaseStation {
*/
static inline T *GetIfValid(size_t index)
{
return IsValidID(index) ? Get(index) : NULL;
return IsValidID(index) ? Get(index) : nullptr;
}
/**

137
src/bitmap_type.h Normal file
View File

@@ -0,0 +1,137 @@
/* $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 bitmap_type.hpp Bitmap functions. */
#ifndef BITMAP_TYPE_HPP
#define BITMAP_TYPE_HPP
#include <vector>
/** Represents a tile area containing containing individually set tiles.
* Each tile must be contained within the preallocated area.
* A std::vector<bool> is used to mark which tiles are contained.
*/
class BitmapTileArea : public TileArea {
protected:
std::vector<bool> data;
inline uint Index(uint x, uint y) const { return y * this->w + x; }
inline uint Index(TileIndex tile) const { return Index(TileX(tile) - TileX(this->tile), TileY(tile) - TileY(this->tile)); }
public:
BitmapTileArea()
{
this->tile = INVALID_TILE;
this->w = 0;
this->h = 0;
}
BitmapTileArea(const TileArea &ta)
{
this->tile = ta.tile;
this->w = ta.w;
this->h = ta.h;
this->data.resize(Index(this->w, this->h));
}
/**
* Reset and clear the BitmapTileArea.
*/
void Reset()
{
this->tile = INVALID_TILE;
this->w = 0;
this->h = 0;
this->data.clear();
}
/**
* Initialize the BitmapTileArea with the specified Rect.
* @param rect Rect to use.
*/
void Initialize(const Rect &r)
{
this->tile = TileXY(r.left, r.top);
this->w = r.right - r.left + 1;
this->h = r.bottom - r.top + 1;
this->data.clear();
this->data.resize(Index(w, h));
}
void Initialize(const TileArea &ta)
{
this->tile = ta.tile;
this->w = ta.w;
this->h = ta.h;
this->data.clear();
this->data.resize(Index(w, h));
}
/**
* Add a tile as part of the tile area.
* @param tile Tile to add.
*/
inline void SetTile(TileIndex tile)
{
assert(this->Contains(tile));
this->data[Index(tile)] = true;
}
/**
* Clear a tile from the tile area.
* @param tile Tile to clear
*/
inline void ClrTile(TileIndex tile)
{
assert(this->Contains(tile));
this->data[Index(tile)] = false;
}
/**
* Test if a tile is part of the tile area.
* @param tile Tile to check
*/
inline bool HasTile(TileIndex tile) const
{
return this->Contains(tile) && this->data[Index(tile)];
}
};
/** Iterator to iterate over all tiles belonging to a bitmaptilearea. */
class BitmapTileIterator : public OrthogonalTileIterator {
protected:
const BitmapTileArea *bitmap;
public:
/**
* Construct the iterator.
* @param bitmap BitmapTileArea to iterate.
*/
BitmapTileIterator(const BitmapTileArea &bitmap) : OrthogonalTileIterator(bitmap), bitmap(&bitmap)
{
if (!this->bitmap->HasTile(TileIndex(this->tile))) ++(*this);
}
inline TileIterator& operator ++()
{
(*this).OrthogonalTileIterator::operator++();
while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) {
(*this).OrthogonalTileIterator::operator++();
}
return *this;
}
virtual TileIterator *Clone() const
{
return new BitmapTileIterator(*this);
}
};
#endif /* BITMAP_TYPE_HPP */

View File

@@ -414,7 +414,7 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
uint32 *udst = (uint32 *)dst;
const uint32 *src = (const uint32 *)video;
if (this->anim_buf == NULL) return;
if (this->anim_buf == nullptr) return;
const uint16 *anim_line = this->ScreenToAnimOffset((const uint32 *)video) + this->anim_buf;

View File

@@ -26,8 +26,8 @@ protected:
public:
Blitter_32bppAnim() :
anim_buf(NULL),
anim_alloc(NULL),
anim_buf(nullptr),
anim_alloc(nullptr),
anim_buf_width(0),
anim_buf_height(0),
anim_buf_pitch(0)
@@ -37,21 +37,21 @@ public:
~Blitter_32bppAnim();
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
/* virtual */ int BufferSize(int width, int height);
/* virtual */ void PaletteAnimate(const Palette &palette);
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
void SetPixel(void *video, int x, int y, uint8 colour) override;
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
void DrawRect(void *video, int width, int height, uint8 colour) override;
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override;
int BufferSize(int width, int height) override;
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
/* virtual */ const char *GetName() { return "32bpp-anim"; }
/* virtual */ int GetBytesPerPixel() { return 6; }
/* virtual */ void PostResize();
const char *GetName() override { return "32bpp-anim"; }
int GetBytesPerPixel() override { return 6; }
void PostResize() override;
/**
* Look up the colour in the current palette.
@@ -77,7 +77,7 @@ public:
class FBlitter_32bppAnim : public BlitterFactory {
public:
FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
Blitter *CreateInstance() override { return new Blitter_32bppAnim(); }
};
#endif /* BLITTER_32BPP_ANIM_HPP */

View File

@@ -28,15 +28,15 @@
/** A partially 32 bpp blitter with palette animation. */
class Blitter_32bppSSE2_Anim : public Blitter_32bppAnim {
public:
/* virtual */ void PaletteAnimate(const Palette &palette);
/* virtual */ const char *GetName() { return "32bpp-sse2-anim"; }
void PaletteAnimate(const Palette &palette) override;
const char *GetName() override { return "32bpp-sse2-anim"; }
};
/** Factory for the partially 32bpp blitter with animation. */
class FBlitter_32bppSSE2_Anim : public BlitterFactory {
public:
FBlitter_32bppSSE2_Anim() : BlitterFactory("32bpp-sse2-anim", "32bpp partially SSE2 Animation Blitter (palette animation)", HasCPUIDFlag(1, 3, 26)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE2_Anim(); }
Blitter *CreateInstance() override { return new Blitter_32bppSSE2_Anim(); }
};
#endif /* WITH_SSE */

Some files were not shown because too many files have changed in this diff Show More