1
0
Fork 0

Compare commits

...

19 Commits

Author SHA1 Message Date
frosch 5603803494
Merge 1d7f23a092 into c3ee5e58a3 2024-05-10 09:45:55 +01:00
merni-ns c3ee5e58a3 Cleanup: Move remaining NPF files into pathfinder directory 2024-05-10 10:38:44 +02:00
merni-ns 798ec4184b Cleanup: Remove unused function InvalidateShipPathCache
This was only used in the callback when changing the ship pathfinder setting.
2024-05-10 10:38:44 +02:00
merni-ns 55a7c59d13 Remove: NPF and pathfinder change settings 2024-05-10 10:38:44 +02:00
translators a5c2543efc Update: Translations from eints
chinese (simplified): 7 changes by WenSimEHRP, 4 changes by ahyangyi
2024-05-10 04:40:29 +00:00
Rubidium cef9417c9f Fix: always allow setting company settings, company/president name/face
There is a nice feature that synchronises the client settings upon setting up the company. Before
this, those commands would not be executed when no-actions-while-paused is set. This means that,
silently and depending on the server configuration, your wished for configuration might not be
there.

Similarly there is the president's face that's being set while creating a new company and setting
of the president/company name upon creation, when no-actions-while-paused is set.

So, just allow these operations also while paused to get a uniform experience when joining. To
keep the UI somewhat consistent, apply this "freedom" also to the other bits set from the company
UI; specifically company name and company colour.
2024-05-09 21:51:26 +02:00
Rubidium a313676189 Doc: reason for using ::SendNet over ::Post in few cases 2024-05-09 21:51:26 +02:00
Rubidium ed888c617b Codechange: just use ::Post over ::SendNet for creating new companies 2024-05-09 21:51:26 +02:00
Koen Bussemaker 59ac27f385 Fix #12643: _is_water_region_valid is not cleared/reset in AllocateWaterRegions 2024-05-09 20:18:04 +02:00
frosch 1d7f23a092 Doc: [Script] Extend API documentation on calendar- vs economy-time 2024-03-24 21:38:11 +01:00
frosch c83552d699 Codechange: [Script] Document relation between ScriptErrorType and ErrorMessages enums 2024-03-24 21:37:01 +01:00
frosch 26ccfb064e Codechange: Add main page to script API documentation 2024-03-24 21:20:26 +01:00
frosch d272fdf2c8 Codechange: Unify naming of squirrel built-in types in Script API docs 2024-03-24 21:20:26 +01:00
frosch 7e312e0295 Codefix: broken links and syntax issues in script API documentation 2024-03-24 21:20:26 +01:00
frosch eb64857ceb Codefix: Script API documentation about IDs was incomplete 2024-03-24 21:20:26 +01:00
frosch 497094861a Codefix: Script API did not link simple types correctly 2024-03-24 21:20:10 +01:00
frosch 9446ba5ce1 Codefix: [Script] script_types was excluded from API documentation 2024-03-24 21:03:10 +01:00
frosch 00db93a2ed Update: Doxyfiles to doxygen 1.9.4 2024-03-24 21:03:10 +01:00
frosch f016c07a86 Fix: [Script] ScriptSubsidy::GetExpireDate should return an economy-date 2024-03-23 22:22:36 +01:00
81 changed files with 703 additions and 2072 deletions

View File

@ -3,6 +3,8 @@
# 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/>.
# Doxyfile 1.9.4
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
@ -13,6 +15,7 @@ PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ${CPACK_BINARY_DIR}/docs/source/
CREATE_SUBDIRS = YES
CREATE_SUBDIRS_LEVEL = 8
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
@ -35,8 +38,10 @@ STRIP_FROM_PATH = ./
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
PYTHON_DOCSTRING = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2
@ -45,6 +50,7 @@ OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 0
@ -60,16 +66,19 @@ INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = YES
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
@ -78,6 +87,7 @@ INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
@ -107,9 +117,11 @@ QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LINE_FORMAT = "at line $line of file $file"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@ -150,6 +162,10 @@ REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
CLANG_ASSISTED_PARSING = NO
CLANG_ADD_INC_PATHS = YES
CLANG_OPTIONS =
CLANG_DATABASE_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@ -175,6 +191,7 @@ HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
@ -197,12 +214,17 @@ GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
MATHJAX_EXTENSIONS =
@ -221,6 +243,7 @@ GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
@ -232,9 +255,9 @@ PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@ -244,7 +267,6 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@ -259,12 +281,12 @@ MAN_LINKS = NO
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@ -311,7 +333,6 @@ EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
@ -324,6 +345,8 @@ COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
@ -331,6 +354,7 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =

View File

@ -151,7 +151,7 @@ bool IsCommandAllowedWhilePaused(Commands cmd)
CMDPL_NO_CONSTRUCTION, ///< CMDT_VEHICLE_MANAGEMENT
CMDPL_NO_CONSTRUCTION, ///< CMDT_ROUTE_MANAGEMENT
CMDPL_NO_CONSTRUCTION, ///< CMDT_OTHER_MANAGEMENT
CMDPL_NO_CONSTRUCTION, ///< CMDT_COMPANY_SETTING
CMDPL_NO_ACTIONS, ///< CMDT_COMPANY_SETTING
CMDPL_NO_ACTIONS, ///< CMDT_SERVER_SETTING
CMDPL_NO_ACTIONS, ///< CMDT_CHEAT
};

View File

@ -898,8 +898,12 @@ CommandCost CmdCompanyCtrl(DoCommandFlag flags, CompanyCtrlAction cca, CompanyID
assert(_local_company == COMPANY_SPECTATOR);
SetLocalCompany(c->index);
/* In network games, we need to try setting the company manager face here to sync it to all clients.
* If a favorite company manager face is selected, choose it. Otherwise, use a random face. */
/*
* If a favorite company manager face is selected, choose it. Otherwise, use a random face.
* Because this needs to be synchronised over the network, only the client knows
* its configuration and we are currently in the execution of a command, we have
* to circumvent the normal ::Post logic for commands and just send the command.
*/
if (_company_manager_face != 0) Command<CMD_SET_COMPANY_MANAGER_FACE>::SendNet(STR_NULL, c->index, _company_manager_face);
/* Now that we have a new company, broadcast our company settings to

View File

@ -28,9 +28,9 @@ CommandCost CmdSetCompanyColour(DoCommandFlag flags, LiveryScheme scheme, bool p
DEF_CMD_TRAIT(CMD_COMPANY_CTRL, CmdCompanyCtrl, CMD_SPECTATOR | CMD_CLIENT_ID | CMD_NO_EST, CMDT_SERVER_SETTING)
DEF_CMD_TRAIT(CMD_COMPANY_ADD_ALLOW_LIST, CmdCompanyAddAllowList, CMD_NO_EST, CMDT_SERVER_SETTING)
DEF_CMD_TRAIT(CMD_GIVE_MONEY, CmdGiveMoney, 0, CMDT_MONEY_MANAGEMENT)
DEF_CMD_TRAIT(CMD_RENAME_COMPANY, CmdRenameCompany, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_RENAME_PRESIDENT, CmdRenamePresident, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_SET_COMPANY_MANAGER_FACE, CmdSetCompanyManagerFace, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_SET_COMPANY_COLOUR, CmdSetCompanyColour, 0, CMDT_OTHER_MANAGEMENT)
DEF_CMD_TRAIT(CMD_RENAME_COMPANY, CmdRenameCompany, 0, CMDT_COMPANY_SETTING)
DEF_CMD_TRAIT(CMD_RENAME_PRESIDENT, CmdRenamePresident, 0, CMDT_COMPANY_SETTING)
DEF_CMD_TRAIT(CMD_SET_COMPANY_MANAGER_FACE, CmdSetCompanyManagerFace, 0, CMDT_COMPANY_SETTING)
DEF_CMD_TRAIT(CMD_SET_COMPANY_COLOUR, CmdSetCompanyColour, 0, CMDT_COMPANY_SETTING)
#endif /* COMPANY_CMD_H */

View File

@ -42,7 +42,6 @@ int _debug_misc_level;
int _debug_net_level;
int _debug_sprite_level;
int _debug_oldloader_level;
int _debug_npf_level;
int _debug_yapf_level;
int _debug_fontcache_level;
int _debug_script_level;
@ -68,7 +67,6 @@ static const DebugLevel _debug_levels[] = {
DEBUG_LEVEL(net),
DEBUG_LEVEL(sprite),
DEBUG_LEVEL(oldloader),
DEBUG_LEVEL(npf),
DEBUG_LEVEL(yapf),
DEBUG_LEVEL(fontcache),
DEBUG_LEVEL(script),

View File

@ -44,7 +44,6 @@ extern int _debug_misc_level;
extern int _debug_net_level;
extern int _debug_sprite_level;
extern int _debug_oldloader_level;
extern int _debug_npf_level;
extern int _debug_yapf_level;
extern int _debug_fontcache_level;
extern int _debug_script_level;

View File

@ -30,7 +30,7 @@
#include "core/random_func.hpp"
#include "object_base.h"
#include "company_func.h"
#include "pathfinder/npf/aystar.h"
#include "pathfinder/aystar.h"
#include "saveload/saveload.h"
#include "framerate_type.h"
#include "landscape_cmd.h"

View File

@ -2130,17 +2130,8 @@ STR_CONFIG_SETTING_AI :Competitors
STR_CONFIG_SETTING_AI_NPC :Computer players
STR_CONFIG_SETTING_NETWORK :Network
STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS :Pathfinder for trains: {STRING2}
STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS_HELPTEXT :Path finder to use for trains
STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES :Pathfinder for road vehicles: {STRING2}
STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES_HELPTEXT :Path finder to use for road vehicles
STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS :Pathfinder for ships: {STRING2}
STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS_HELPTEXT :Path finder to use for ships
STR_CONFIG_SETTING_REVERSE_AT_SIGNALS :Automatic reversing at signals: {STRING2}
STR_CONFIG_SETTING_REVERSE_AT_SIGNALS_HELPTEXT :Allow trains to reverse on a signal, if they waited there a long time
###length 2
STR_CONFIG_SETTING_PATHFINDER_NPF :NPF
STR_CONFIG_SETTING_PATHFINDER_YAPF :YAPF {BLUE}(Recommended)
STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Change setting value

View File

@ -955,6 +955,7 @@ STR_GAME_OPTIONS_VOLUME :音量
STR_GAME_OPTIONS_SFX_VOLUME :音效
STR_GAME_OPTIONS_MUSIC_VOLUME :音乐
STR_GAME_OPTIONS_VOLUME_MARK :{NUM}%
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}货币单位
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}货币单位选择
@ -1052,6 +1053,7 @@ STR_GAME_OPTIONS_GUI_FONT_SPRITE_TOOLTIP :{BLACK}如果
STR_GAME_OPTIONS_GUI_FONT_AA :字体抗锯齿
STR_GAME_OPTIONS_GUI_FONT_AA_TOOLTIP :{BLACK}勾选此框以对游戏字体应用抗锯齿
STR_GAME_OPTIONS_GUI_SCALE_MARK :{DECIMAL}x
STR_GAME_OPTIONS_PARTICIPATE_SURVEY_FRAME :{BLACK}自动体验调查
STR_GAME_OPTIONS_PARTICIPATE_SURVEY :{BLACK}参与自动体验调查
@ -1080,6 +1082,8 @@ STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}基础
STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP :{BLACK}选择要使用的基础音乐组
STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}有关基础音乐组的附加信息
STR_GAME_OPTIONS_ONLINE_CONTENT :获取内容
STR_GAME_OPTIONS_ONLINE_CONTENT_TOOLTIP :查询并下载最新内容
STR_GAME_OPTIONS_SOCIAL_PLUGINS_NONE :{LTBLUE}(未安装社交平台插件)
@ -1823,6 +1827,9 @@ STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT :如果没有为
STR_CONFIG_SETTING_SERVINT_SHIPS :船只默认保养周期:{STRING}
STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT :如果没有为船只设定保养周期,按照这里设定的默认保养周期执行
###length 3
STR_CONFIG_SETTING_SERVINT_VALUE_DAYS :{COMMA}{NBSP}日
STR_CONFIG_SETTING_SERVINT_VALUE_MINUTES :{COMMA}{NBSP}分
STR_CONFIG_SETTING_SERVINT_VALUE_PERCENTAGE :{COMMA}{NBSP}%
###setting-zero-is-special
STR_CONFIG_SETTING_SERVINT_DISABLED :关闭
@ -2478,6 +2485,7 @@ STR_NETWORK_CLIENT_LIST_PLAYER_NAME_QUERY_CAPTION :你的玩家名
STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_TOOLTIP :{BLACK}要在此客户端执行的管理命令
STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_TOOLTIP :{BLACK}要在此公司执行的管理命令
STR_NETWORK_CLIENT_LIST_JOIN_TOOLTIP :{BLACK}加入该公司
STR_NETWORK_CLIENT_LIST_COMPANY_AUTHORIZE_TOOLTIP :{BLACK}授权此客户端加入你的公司
STR_NETWORK_CLIENT_LIST_CHAT_CLIENT_TOOLTIP :{BLACK}给这位玩家发消息
STR_NETWORK_CLIENT_LIST_CHAT_COMPANY_TOOLTIP :{BLACK}给公司中的所有玩家发消息
STR_NETWORK_CLIENT_LIST_CHAT_SPECTATOR_TOOLTIP :{BLACK}给所有旁观者发消息
@ -3469,7 +3477,9 @@ STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :道路类型
STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x 参数 (十六进制)
# Sprite aligner window
STR_SPRITE_ALIGNER_CAPTION_NO_ACTION :{WHITE}对齐中的 Sprite({STRING}:{NUM})
STR_SPRITE_ALIGNER_CAPTION_ACTIONA :{WHITE}对齐中的 SpriteAction 0xA, {COMMA} ({STRING}:{NUM})
STR_SPRITE_ALIGNER_CAPTION_ACTION5 :{WHITE}对齐中的 SpriteAction 0x5, 类别 {HEX}, {COMMA} ({STRING}:{NUM})
STR_SPRITE_ALIGNER_NEXT_BUTTON :{BLACK}下一个 sprite
STR_SPRITE_ALIGNER_NEXT_TOOLTIP :{BLACK}继续处理下个正常的图形元素,略过任何虚位/重新着色/文字字型相关的图形元素;并且在处理到最后的图形元素后,返回第一个图形元素继续处理。
STR_SPRITE_ALIGNER_GOTO_BUTTON :{BLACK}前往 sprite
@ -3478,6 +3488,7 @@ STR_SPRITE_ALIGNER_PREVIOUS_BUTTON :{BLACK}上一
STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP :{BLACK}继续处理上一个正常的图形元素,略过任何虚位/重新着色/文字字型相关的图形元素;并且在处理到第一个图形元素后,返回最后的图形元素继续处理。
STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}显示目前选取的 sprite。当 sprite 正在描绘时会忽略其定位。
STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}从 X 及 Y 座标方向移动图形元素。如按住 Ctrl 键再点击,可一次移动 8 个单位
STR_SPRITE_ALIGNER_SPRITE :{STRING}:{NUM}
###length 2
STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}偏移居中

View File

@ -54,7 +54,6 @@ void InitializeObjects();
void InitializeTrees();
void InitializeCompanies();
void InitializeCheats();
void InitializeNPF();
void InitializeOldNames();
/**
@ -149,8 +148,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
InitializeIndustries();
InitializeObjects();
InitializeNPF();
InitializeCompanies();
AI::Initialize();
Game::Initialize();

View File

@ -886,7 +886,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
Debug(net, 9, "Client::join_status = REGISTERING");
_network_join_status = NETWORK_JOIN_STATUS_REGISTERING;
ShowJoinStatusWindow();
Command<CMD_COMPANY_CTRL>::SendNet(STR_NULL, _local_company, CCA_NEW, INVALID_COMPANY, CRR_NONE, INVALID_CLIENT_ID);
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
}
} else {
/* take control over an existing company */

View File

@ -1460,11 +1460,7 @@ private:
*/
static void OnClickCompanyNew([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID)
{
if (_network_server) {
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
} else {
Command<CMD_COMPANY_CTRL>::SendNet(STR_NULL, _local_company, CCA_NEW, INVALID_COMPANY, CRR_NONE, INVALID_CLIENT_ID);
}
Command<CMD_COMPANY_CTRL>::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id);
}
/**

View File

@ -2157,6 +2157,13 @@ void NetworkServerNewCompany(const Company *c, NetworkClientInfo *ci)
/* ci is nullptr when replaying, or for AIs. In neither case there is a client. */
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
/*
* This function is called from a command, but is only called for the server.
* The client information is managed out-of-band from the commands, so to not have a
* different state/president/company name in the different clients, we need to
* circumvent the normal ::Post logic and go directly to sending the command.
*/
Command<CMD_COMPANY_ADD_ALLOW_LIST>::SendNet(STR_NULL, c->index, ci->public_key);
Command<CMD_RENAME_PRESIDENT>::SendNet(STR_NULL, c->index, ci->client_name);

View File

@ -1,8 +1,11 @@
add_subdirectory(npf)
add_subdirectory(yapf)
add_files(
aystar.h
aystar.cpp
follow_track.hpp
queue.h
queue.cpp
pathfinder_func.h
pathfinder_type.h
water_regions.h

View File

@ -168,7 +168,7 @@ int AyStar::Loop()
if (current == nullptr) return AYSTAR_EMPTY_OPENLIST;
/* Check for end node and if found, return that code */
if (this->EndNodeCheck(this, current) == AYSTAR_FOUND_END_NODE && !CheckIgnoreFirstTile(&current->path)) {
if (this->EndNodeCheck(this, current) == AYSTAR_FOUND_END_NODE && (&current->path)->parent != nullptr) {
if (this->FoundEndNode != nullptr) {
this->FoundEndNode(this, current);
}

View File

@ -1,8 +0,0 @@
add_files(
aystar.cpp
aystar.h
npf.cpp
npf_func.h
queue.cpp
queue.h
)

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +0,0 @@
/*
* 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 npf_func.h Functions to access the new pathfinder. */
#ifndef NPF_FUNC_H
#define NPF_FUNC_H
#include "../../track_type.h"
#include "../../direction_type.h"
#include "../../vehicle_type.h"
#include "../pathfinder_type.h"
/**
* Used when user sends road vehicle to the nearest depot or if road vehicle needs servicing using NPF.
* @param v vehicle that needs to go to some depot
* @param max_penalty max distance (in pathfinder penalty) from the current vehicle position
* (used also as optimization - the pathfinder can stop path finding if max_penalty
* was reached and no depot was seen)
* @return the data about the depot
*/
FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penalty);
/**
* Finds the best path for given road vehicle using NPF.
* @param v the RV that needs to find a path
* @param tile the tile to find the path from (should be next tile the RV is about to enter)
* @param enterdir diagonal direction which the RV will enter this new tile from
* @param path_found [out] Whether a path has been found (true) or has been guessed (false)
* @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
*/
Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, bool &path_found);
/**
* Finds the best path for given ship using NPF.
* @param v the ship that needs to find a path
* @param path_found [out] Whether a path has been found (true) or has been guessed (false)
* @return the best trackdir for next turn or INVALID_TRACK if the path could not be found
*/
Track NPFShipChooseTrack(const Ship *v, bool &path_found);
/**
* Returns true if it is better to reverse the ship before leaving depot using NPF.
* @param v the ship leaving the depot
* @param trackdir [out] the best of all possible reversed trackdirs
* @return true if reversing is better
*/
bool NPFShipCheckReverse(const Ship *v, Trackdir *trackdir);
/**
* Used when user sends train to the nearest depot or if train needs servicing using NPF
* @param v train that needs to go to some depot
* @param max_penalty max max_penalty (in pathfinder penalty) from the current train position
* (used also as optimization - the pathfinder can stop path finding if max_penalty
* was reached and no depot was seen)
* @return the data about the depot
*/
FindDepotData NPFTrainFindNearestDepot(const Train *v, int max_penalty);
/**
* Try to extend the reserved path of a train to the nearest safe tile using NPF.
*
* @param v The train that needs to find a safe tile.
* @param tile Last tile of the current reserved path.
* @param td Last trackdir of the current reserved path.
* @param override_railtype Should all physically compatible railtypes be searched, even if the vehicle can't run on them on its own?
* @return True if the path could be extended to a safe tile.
*/
bool NPFTrainFindNearestSafeTile(const Train *v, TileIndex tile, Trackdir td, bool override_railtype);
/**
* Returns true if it is better to reverse the train before leaving station using NPF.
* @param v the train leaving the station
* @return true if reversing is better
*/
bool NPFTrainCheckReverse(const Train *v);
/**
* Finds the best path for given train using NPF.
* @param v the train that needs to find a path
* @param path_found [out] Whether a path has been found (true) or has been guessed (false)
* @param reserve_track indicates whether YAPF should try to reserve the found path
* @param target [out] the target tile of the reservation, free is set to true if path was reserved
* @return the best track for next turn
*/
Track NPFTrainChooseTrack(const Train *v, bool &path_found, bool reserve_track, struct PBSTileInfo *target);
#endif /* NPF_FUNC_H */

View File

@ -11,19 +11,7 @@
#define PATHFINDER_TYPE_H
#include "../tile_type.h"
#include "npf/aystar.h"
/** Length (penalty) of one tile with NPF */
static const int NPF_TILE_LENGTH = 100;
/**
* This penalty is the equivalent of "infinite", which means that paths that
* get this penalty will be chosen, but only if there is no other route
* without it. Be careful with not applying this penalty too often, or the
* total path cost might overflow.
*/
static const int NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH;
#include "aystar.h"
/** Length (penalty) of one tile with YAPF */
static const int YAPF_TILE_LENGTH = 100;

View File

@ -405,6 +405,7 @@ void AllocateWaterRegions()
_water_regions.clear();
_water_regions.reserve(number_of_regions);
_is_water_region_valid.clear();
_is_water_region_valid.resize(number_of_regions, false);
Debug(map, 2, "Allocating {} x {} water regions", GetWaterRegionMapSizeX(), GetWaterRegionMapSizeY());

View File

@ -12,7 +12,6 @@
#include "command_func.h"
#include "error_func.h"
#include "news_func.h"
#include "pathfinder/npf/npf_func.h"
#include "station_base.h"
#include "company_func.h"
#include "articulated_vehicles.h"
@ -342,12 +341,7 @@ static FindDepotData FindClosestRoadDepot(const RoadVehicle *v, int max_distance
{
if (IsRoadDepotTile(v->tile)) return FindDepotData(v->tile, 0);
switch (_settings_game.pf.pathfinder_for_roadvehs) {
case VPF_NPF: return NPFRoadVehicleFindNearestDepot(v, max_distance);
case VPF_YAPF: return YapfRoadVehicleFindNearestDepot(v, max_distance);
default: NOT_REACHED();
}
return YapfRoadVehicleFindNearestDepot(v, max_distance);
}
ClosestDepot RoadVehicle::FindClosestDepot()
@ -989,12 +983,8 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection
}
}
switch (_settings_game.pf.pathfinder_for_roadvehs) {
case VPF_NPF: best_track = NPFRoadVehicleChooseTrack(v, tile, enterdir, path_found); break;
case VPF_YAPF: best_track = YapfRoadVehicleChooseTrack(v, tile, enterdir, trackdirs, path_found, v->path); break;
best_track = YapfRoadVehicleChooseTrack(v, tile, enterdir, trackdirs, path_found, v->path);
default: NOT_REACHED();
}
v->HandlePathfindingResult(path_found);
found_best_track:;
@ -1683,12 +1673,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
return;
}
uint max_penalty;
switch (_settings_game.pf.pathfinder_for_roadvehs) {
case VPF_NPF: max_penalty = _settings_game.pf.npf.maximum_go_to_depot_penalty; break;
case VPF_YAPF: max_penalty = _settings_game.pf.yapf.maximum_go_to_depot_penalty; break;
default: NOT_REACHED();
}
uint max_penalty = _settings_game.pf.yapf.maximum_go_to_depot_penalty;
FindDepotData rfdd = FindClosestRoadDepot(v, max_penalty);
/* Only go to the depot if it is not too far out of our way. */

View File

@ -1889,25 +1889,6 @@ bool AfterLoadGame()
if (!Company::IsValidID(GetTileOwner(t))) FixOwnerOfRailTrack(t);
}
}
/* Convert old PF settings to new */
if (_settings_game.pf.yapf.rail_use_yapf || IsSavegameVersionBefore(SLV_28)) {
_settings_game.pf.pathfinder_for_trains = VPF_YAPF;
} else {
_settings_game.pf.pathfinder_for_trains = VPF_NPF;
}
if (_settings_game.pf.yapf.road_use_yapf || IsSavegameVersionBefore(SLV_28)) {
_settings_game.pf.pathfinder_for_roadvehs = VPF_YAPF;
} else {
_settings_game.pf.pathfinder_for_roadvehs = VPF_NPF;
}
if (_settings_game.pf.yapf.ship_use_yapf) {
_settings_game.pf.pathfinder_for_ships = VPF_YAPF;
} else {
_settings_game.pf.pathfinder_for_ships = VPF_NPF;
}
}
if (IsSavegameVersionBefore(SLV_88)) {

View File

@ -95,13 +95,9 @@ const SaveLoadCompat _settings_sl_compat[] = {
SLC_VAR("vehicle.smoke_amount"),
SLC_NULL(1, SL_MIN_VERSION, SLV_159),
SLC_VAR("pf.roadveh_queue"),
SLC_VAR("pf.new_pathfinding_all"),
SLC_VAR("pf.yapf.ship_use_yapf"),
SLC_VAR("pf.yapf.road_use_yapf"),
SLC_VAR("pf.yapf.rail_use_yapf"),
SLC_VAR("pf.pathfinder_for_trains"),
SLC_VAR("pf.pathfinder_for_roadvehs"),
SLC_VAR("pf.pathfinder_for_ships"),
SLC_NULL(1, SL_MIN_VERSION, SLV_87),
SLC_NULL(3, SLV_28, SLV_87),
SLC_NULL(3, SLV_87, SLV_TABLE_CHUNKS),
SLC_VAR("vehicle.never_expire_vehicles"),
SLC_VAR("vehicle.max_trains"),
SLC_VAR("vehicle.max_roadveh"),
@ -183,24 +179,12 @@ const SaveLoadCompat _settings_sl_compat[] = {
SLC_VAR("pf.reserve_paths"),
SLC_VAR("pf.path_backoff_interval"),
SLC_NULL(3, SL_MIN_VERSION, SLV_REMOVE_OPF),
SLC_VAR("pf.npf.npf_max_search_nodes"),
SLC_VAR("pf.npf.npf_rail_firstred_penalty"),
SLC_VAR("pf.npf.npf_rail_firstred_exit_penalty"),
SLC_VAR("pf.npf.npf_rail_lastred_penalty"),
SLC_VAR("pf.npf.npf_rail_station_penalty"),
SLC_VAR("pf.npf.npf_rail_slope_penalty"),
SLC_VAR("pf.npf.npf_rail_curve_penalty"),
SLC_VAR("pf.npf.npf_rail_depot_reverse_penalty"),
SLC_VAR("pf.npf.npf_rail_pbs_cross_penalty"),
SLC_VAR("pf.npf.npf_rail_pbs_signal_back_penalty"),
SLC_VAR("pf.npf.npf_buoy_penalty"),
SLC_VAR("pf.npf.npf_water_curve_penalty"),
SLC_VAR("pf.npf.npf_road_curve_penalty"),
SLC_VAR("pf.npf.npf_crossing_penalty"),
SLC_VAR("pf.npf.npf_road_drive_through_penalty"),
SLC_VAR("pf.npf.npf_road_dt_occupied_penalty"),
SLC_VAR("pf.npf.npf_road_bay_occupied_penalty"),
SLC_VAR("pf.npf.maximum_go_to_depot_penalty"),
SLC_NULL(32, SL_MIN_VERSION, SLV_TABLE_CHUNKS),
SLC_NULL(8, SLV_100, SLV_TABLE_CHUNKS),
SLC_NULL(16, SL_MIN_VERSION, SLV_TABLE_CHUNKS),
SLC_NULL(4, SLV_47, SLV_TABLE_CHUNKS),
SLC_NULL(8, SLV_130, SLV_TABLE_CHUNKS),
SLC_NULL(4, SLV_131, SLV_TABLE_CHUNKS),
SLC_VAR("pf.yapf.disable_node_optimization"),
SLC_VAR("pf.yapf.max_search_nodes"),
SLC_VAR("pf.yapf.rail_firstred_twoway_eol"),

View File

@ -3,7 +3,7 @@
# 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/>.
# Doxyfile 1.5.4
# Doxyfile 1.9.4
#---------------------------------------------------------------------------
# Project related configuration options
@ -11,14 +11,18 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "OpenTTD AI API"
PROJECT_NUMBER = ${REV_VERSION}
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ${CPACK_BINARY_DIR}/docs/ai-api/
CREATE_SUBDIRS = NO
CREATE_SUBDIRS_LEVEL = 8
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class " \
"The $name widget " \
"The $name file " \
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
@ -34,29 +38,47 @@ STRIP_FROM_PATH = ./
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
PYTHON_DOCSTRING = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
@ -64,11 +86,18 @@ HIDE_IN_BODY_DOCS = YES
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = NO
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = YES
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = NO
GENERATE_TESTLIST = NO
GENERATE_BUGLIST = NO
@ -76,21 +105,29 @@ GENERATE_DEPRECATEDLIST= NO
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = YES
WARN_FORMAT = "$file:$line: $text "
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LINE_FORMAT = "at line $line of file $file"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = . ${FIND_VERSION_BINARY_DIR}/script/api
INPUT = . \
${FIND_VERSION_BINARY_DIR}/script/api
INPUT_ENCODING = UTF-8
FILE_PATTERNS = script_*.hpp \
ai_*.hpp
@ -98,7 +135,9 @@ RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = ai_includes.hpp
EXCLUDE_SYMBOLS = GetClassName DECLARE_ENUM_AS_BIT_SET DECLARE_POSTFIX_INCREMENT
EXCLUDE_SYMBOLS = GetClassName \
DECLARE_ENUM_AS_BIT_SET \
DECLARE_POSTFIX_INCREMENT
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
@ -106,8 +145,10 @@ IMAGE_PATH =
INPUT_FILTER = "./doxygen_filter.sh AI"
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# configuration options related to source browsing
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
@ -115,15 +156,20 @@ STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
CLANG_ASSISTED_PARSING = NO
CLANG_ADD_INC_PATHS = YES
CLANG_OPTIONS =
CLANG_DATABASE_PATH =
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
@ -131,34 +177,86 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
GENERATE_HTMLHELP = NO
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 1
GENERATE_TREEVIEW = NO
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 1
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH =
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# configuration options related to the RTF output
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
@ -167,24 +265,31 @@ RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
@ -203,22 +308,30 @@ PREDEFINED = DOXYGEN_API
EXPAND_AS_DEFINED = DEF_COMMAND
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = ${CPACK_BINARY_DIR}/docs/openttd_ai_api.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
@ -226,16 +339,19 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@ -3,7 +3,7 @@
# 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/>.
# Doxyfile 1.5.4
# Doxyfile 1.9.4
#---------------------------------------------------------------------------
# Project related configuration options
@ -11,14 +11,18 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "OpenTTD GameScript API"
PROJECT_NUMBER = ${REV_VERSION}
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ${CPACK_BINARY_DIR}/docs/gs-api/
CREATE_SUBDIRS = NO
CREATE_SUBDIRS_LEVEL = 8
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class " \
"The $name widget " \
"The $name file " \
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
@ -34,29 +38,47 @@ STRIP_FROM_PATH = ./
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
PYTHON_DOCSTRING = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
@ -64,11 +86,18 @@ HIDE_IN_BODY_DOCS = YES
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = NO
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = NO
GENERATE_TESTLIST = NO
GENERATE_BUGLIST = NO
@ -76,21 +105,29 @@ GENERATE_DEPRECATEDLIST= NO
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = YES
WARN_FORMAT = "$file:$line: $text "
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LINE_FORMAT = "at line $line of file $file"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = . ${FIND_VERSION_BINARY_DIR}/script/api
INPUT = . \
${FIND_VERSION_BINARY_DIR}/script/api
INPUT_ENCODING = UTF-8
FILE_PATTERNS = script_*.hpp \
game_*.hpp
@ -98,7 +135,9 @@ RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = game_includes.hpp
EXCLUDE_SYMBOLS = GetClassName DECLARE_ENUM_AS_BIT_SET DECLARE_POSTFIX_INCREMENT
EXCLUDE_SYMBOLS = GetClassName \
DECLARE_ENUM_AS_BIT_SET \
DECLARE_POSTFIX_INCREMENT
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
@ -106,8 +145,10 @@ IMAGE_PATH =
INPUT_FILTER = "./doxygen_filter.sh GS"
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# configuration options related to source browsing
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
@ -115,15 +156,20 @@ STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
CLANG_ASSISTED_PARSING = NO
CLANG_ADD_INC_PATHS = YES
CLANG_OPTIONS =
CLANG_DATABASE_PATH =
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
@ -131,34 +177,86 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
GENERATE_HTMLHELP = NO
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 1
GENERATE_TREEVIEW = NO
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 1
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH =
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# configuration options related to the RTF output
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
@ -167,24 +265,31 @@ RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
@ -203,22 +308,30 @@ PREDEFINED = DOXYGEN_API
EXPAND_AS_DEFINED = DEF_COMMAND
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = ${CPACK_BINARY_DIR}/docs/openttd_gs_api.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
@ -226,16 +339,19 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@ -6,7 +6,7 @@
*/
/**
* @file ai_changelog.hpp Lists all changes / additions to the API.
* @page ai_changelog Lists all changes / additions to the API.
*
* Only new / renamed / deleted api functions will be listed here. A list of
* bug fixes can be found in the normal changelog. Note that removed API
@ -457,3 +457,17 @@
* \b 0.7.0
* \li First stable release with the NoAI framework.
*/
/**
* @mainpage
*
* What's new?
* \li \ref ai_changelog
*
* Main classes:
* \li \ref AIInfo
* \li \ref AIController
*
* Detail topics:
* \li \ref script_ids
*/

View File

@ -24,7 +24,10 @@ BEGIN {
}
{
# replace Script with AI/GS, except for ScriptErrorType
gsub(/Script/, api)
gsub(/AIErrorType/, "ScriptErrorType")
gsub(/GSErrorType/, "ScriptErrorType")
}
{
@ -133,6 +136,16 @@ BEGIN {
next
}
# Convert/unify type names
{
gsub(/\<SQInteger\>/, "int")
gsub(/\<SquirrelTable\>/, "table")
gsub(/\<u?int[0-9]*(_t)?\>/, "int")
gsub(/\<HSQOBJECT\>/, "object")
gsub(/std::optional<std::string>/, "string")
gsub(/(const )?std::string *[*&]?/, "string ")
}
# Store comments
/\/\*\*.*\*\// { comment_buffer = $0; comment = "false"; next; }
/\/\*.*\*\// { comment_buffer = ""; comment = "false"; next; }
@ -245,7 +258,7 @@ BEGIN {
}
# Add a const (non-enum) value
/^[ ]*static const \w+ \w+ = -?\(?\w*\)?\w+;/ {
/^[ ]*static const \w+ \w+ = [^;]+;/ {
if (api_selected == "") api_selected = cls_in_api
if (api_selected == "false") {
api_selected = ""

View File

@ -21,6 +21,7 @@ fi
case $2 in
*ai_changelog.hpp) cat $2; exit 0;;
*game_changelog.hpp) cat $2; exit 0;;
*script_types.hpp) cat $2; exit 0;;
esac
${AWK} -v api=$1 -f doxygen_filter.awk $2

View File

@ -6,7 +6,7 @@
*/
/**
* @file game_changelog.hpp Lists all changes / additions to the API.
* @page game_changelog Lists all changes / additions to the API.
*
* Only new / renamed / deleted api functions will be listed here. A list of
* bug fixes can be found in the normal changelog. Note that removed API
@ -301,3 +301,17 @@
* \b 1.2.0
* \li First stable release with the NoGo framework.
*/
/**
* @mainpage
*
* What's new?
* \li \ref game_changelog
*
* Main classes:
* \li \ref GSInfo
* \li \ref GSController
*
* Detail topics:
* \li \ref script_ids
*/

View File

@ -27,13 +27,13 @@ public:
/**
* Send information to the AdminPort. The information can be anything
* as long as it isn't a class or instance thereof.
* @param table The information to send, in a table. For example: { param = "param" }.
* @param data The information to send, in a table. For example: { param = "param" }.
* @return True if and only if the data was successfully converted to JSON
* and send to the AdminPort.
* @note If the resulting JSON of your table is larger than 1450 bytes,
* nothing will be sent (and false will be returned).
*/
static bool Send(void *table);
static bool Send(table data);
#endif /* DOXYGEN_API */
};

View File

@ -204,7 +204,8 @@ public:
* Get the monthly maintenance cost of an airport type.
* @param type The airport type to get the monthly maintenance cost of.
* @pre IsAirportInformationAvailable(type)
* @return Monthly maintenance cost of the airport type.
* @return Maintenance cost of the airport type per economy-month.
* @see \ref ScriptEconomyTime
*/
static Money GetMonthlyMaintenanceCost(AirportType type);

View File

@ -68,9 +68,10 @@ public:
static TileIndex GetLocation(StationID station_id);
/**
* Get the last date a station part was added to this station.
* Get the last calendar-date a station part was added to this station.
* @param station_id The station to look at.
* @return The last date some part of this station was build.
* @return The last calendar-date some part of this station was build.
* @see \ref ScriptCalendarTime
*/
static ScriptDate::Date GetConstructionDate(StationID station_id);
};

View File

@ -20,6 +20,8 @@ class ScriptBridge : public ScriptObject {
public:
/**
* All bridge related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for bridge related errors */

View File

@ -56,10 +56,11 @@ public:
static ScriptCompany::CompanyID GetCompany(ClientID client);
/**
* Get the game date when the given client has joined.
* Get the economy-date when the given client has joined.
* @param client The client to get joining date for.
* @pre ResolveClientID(client) != CLIENT_INVALID.
* @return The date when client has joined.
* @return The economy-date when client has joined.
* @see \ref ScriptEconomyTime
*/
static ScriptDate::Date GetJoinDate(ClientID client);
};

View File

@ -281,59 +281,64 @@ public:
static bool ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type, TileIndex tile);
/**
* Get the income of the company in the given quarter.
* Get the income of the company in the given economy-quarter.
* Note that this function only considers recurring income from vehicles;
* it does not include one-time income from selling stuff.
* @param company The company to get the quarterly income of.
* @param quarter The quarter to get the income of.
* @param quarter The economy-quarter to get the income of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @pre quarter <= EARLIEST_QUARTER.
* @return The gross income of the company in the given quarter.
* @return The gross income of the company in the given economy-quarter.
* @see \ref ScriptEconomyTime
*/
static Money GetQuarterlyIncome(CompanyID company, SQInteger quarter);
/**
* Get the expenses of the company in the given quarter.
* Get the expenses of the company in the given economy-quarter.
* Note that this function only considers recurring expenses from vehicle
* running cost, maintenance and interests; it does not include one-time
* expenses from construction and buying stuff.
* @param company The company to get the quarterly expenses of.
* @param quarter The quarter to get the expenses of.
* @param quarter The economy-quarter to get the expenses of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @pre quarter <= EARLIEST_QUARTER.
* @return The expenses of the company in the given quarter.
* @return The expenses of the company in the given economy-quarter.
* @see \ref ScriptEconomyTime
*/
static Money GetQuarterlyExpenses(CompanyID company, SQInteger quarter);
/**
* Get the amount of cargo delivered by the given company in the given quarter.
* Get the amount of cargo delivered by the given company in the given economy-quarter.
* @param company The company to get the amount of delivered cargo of.
* @param quarter The quarter to get the amount of delivered cargo of.
* @param quarter The economy-quarter to get the amount of delivered cargo of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @pre quarter <= EARLIEST_QUARTER.
* @return The amount of cargo delivered by the given company in the given quarter.
* @return The amount of cargo delivered by the given company in the given economy-quarter.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetQuarterlyCargoDelivered(CompanyID company, SQInteger quarter);
/**
* Get the performance rating of the given company in the given quarter.
* Get the performance rating of the given company in the given economy-quarter.
* @param company The company to get the performance rating of.
* @param quarter The quarter to get the performance rating of.
* @param quarter The economy-quarter to get the performance rating of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @pre quarter <= EARLIEST_QUARTER.
* @pre quarter != CURRENT_QUARTER.
* @note The performance rating is calculated after every quarter, so the value for CURRENT_QUARTER is undefined.
* @return The performance rating of the given company in the given quarter.
* @note The performance rating is calculated after every economy-quarter, so the value for CURRENT_QUARTER is undefined.
* @return The performance rating of the given company in the given economy-quarter.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetQuarterlyPerformanceRating(CompanyID company, SQInteger quarter);
/**
* Get the value of the company in the given quarter.
* Get the value of the company in the given economy-quarter.
* @param company The company to get the value of.
* @param quarter The quarter to get the value of.
* @param quarter The economy-quarter to get the value of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @pre quarter <= EARLIEST_QUARTER.
* @return The value of the company in the given quarter.
* @return The value of the company in the given economy-quarter.
* @see \ref ScriptEconomyTime
*/
static Money GetQuarterlyCompanyValue(CompanyID company, SQInteger quarter);
@ -377,10 +382,11 @@ public:
/**
* Set the number of months before/after max age to autorenew an engine for your company.
* @param months The new months between autorenew.
* @param months The number of calendar-months before/after max age of engine.
* The value will be clamped to MIN(int16_t) .. MAX(int16_t).
* @game @pre ScriptCompanyMode::IsValid().
* @return True if autorenew months has been modified.
* @see \ref ScriptCalendarTime
*/
static bool SetAutoRenewMonths(SQInteger months);
@ -388,7 +394,8 @@ public:
* Return the number of months before/after max age to autorenew an engine for a company.
* @param company The company to get the autorenew months of.
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
* @return The months before/after max age of engine.
* @return The number of calendar-months before/after max age of engine.
* @see \ref ScriptCalendarTime
*/
static SQInteger GetAutoRenewMonths(CompanyID company);

View File

@ -52,7 +52,7 @@ public:
* Check whether a company mode is valid. In other words, are commands
* being executed under some company and does the company still exist?
* @return true When a company mode is valid.
* @post !ScriptCompanyMode::IsDeity().
* @post If IsValid() is true, then IsDeity() is false.
*/
static bool IsValid();
@ -60,7 +60,7 @@ public:
* Check whether the company mode is not active, i.e. whether we are a deity.
* In other words, are commands are not being executed under some company.
* @return true When we are a deity, i.e. company mode is not active.
* @post !ScriptCompanyMode::IsValid().
* @post if IsDeity() is true, then IsValid() is false.
*/
static bool IsDeity();
};

View File

@ -92,7 +92,7 @@ public:
*
* @return Data of the script that should be stored in the save game.
*/
SquirrelTable Save();
table Save();
/**
* Load saved data just before calling #Start.
@ -100,7 +100,7 @@ public:
* @param version Version number of the script that created the \a data.
* @param data Data that was saved (return value of #Save).
*/
void Load(int version, SquirrelTable data);
void Load(int version, table data);
#endif /* DOXYGEN_API */
/**

View File

@ -23,6 +23,30 @@
* @note Dates can be used to determine the number of days between
* two different moments in time because they count the number
* of days since the year 0.
*
* \anchor ScriptCalendarTime
* \b Calendar-Time
*
* Calendar time measures the technological progression in the game.
* \li The calendar date is shown in the status bar.
* \li The calendar date affects engine model introduction and expiration.
* \li Progression of calendar time can be slowed or even halted via game settings.
*
* Calendar time uses the Gregorian calendar with 365 or 366 days per year.
*
* \anchor ScriptEconomyTime
* \b Economy-Time
*
* Economy time measures the in-game time progression, while the game is not paused.
* \li Cargo production and consumption follows economy time.
* \li Recurring income and expenses follow economy time.
* \li Production and income statistics and balances are created per economy month/quarter/year.
*
* Depending on game settings economy time is represented differently:
* \li Calendar-based timekeeping: Economy- and calendar-time use the identical Gregorian calendar.
* \li Wallclock-based timekeeping: Economy- and calendar-time are separate.
* Economy-time will use a 360 day calendar (12 months with 30 days each), which runs at a constant speed of one economy-month per realtime-minute.
* Calendar-time will use a Gregorian calendar, which can be slowed to stopped via game settings.
*/
class ScriptDate : public ScriptObject {
public:

View File

@ -125,8 +125,8 @@ public:
* Get the maximum age of a brand new engine.
* @param engine_id The engine to get the maximum age of.
* @pre IsValidEngine(engine_id).
* @returns The maximum age of a new engine in days.
* @note Age is in days; divide by 366 to get per year.
* @returns The maximum age of a new engine in calendar-days.
* @see \ref ScriptCalendarTime
*/
static SQInteger GetMaxAge(EngineID engine_id);
@ -134,8 +134,8 @@ public:
* Get the running cost of an engine.
* @param engine_id The engine to get the running cost of.
* @pre IsValidEngine(engine_id).
* @return The running cost of a vehicle per year.
* @note Cost is per year; divide by 365 to get per day.
* @return The running cost of a vehicle per economy-year.
* @see \ref ScriptEconomyTime
*/
static Money GetRunningCost(EngineID engine_id);
@ -167,10 +167,11 @@ public:
static SQInteger GetMaxTractiveEffort(EngineID engine_id);
/**
* Get the date this engine was designed.
* Get the calendar-date this engine was designed.
* @param engine_id The engine to get the design date of.
* @pre IsValidEngine(engine_id).
* @return The date this engine was designed.
* @return The calendar-date this engine was designed.
* @see \ref ScriptCalendarTime
*/
static ScriptDate::Date GetDesignDate(EngineID engine_id);

View File

@ -120,6 +120,8 @@ public:
/**
* All general related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Initial error value */

View File

@ -272,8 +272,8 @@ public:
/**
* Get the running cost of the offered engine.
* @return The running cost of the vehicle per year.
* @note Cost is per year; divide by 365 to get per day.
* @return The running cost of the vehicle per economy-year.
* @see \ref ScriptEconomyTime
*/
Money GetRunningCost();

View File

@ -222,7 +222,8 @@ public:
* Get the current profit of a group.
* @param group_id The group to get the profit of.
* @pre IsValidGroup(group_id).
* @return The current profit the group has.
* @return The profit the vehicles in this group have made this economy-year so far.
* @see \ref ScriptEconomyTime
*/
static Money GetProfitThisYear(GroupID group_id);
@ -230,7 +231,8 @@ public:
* Get the profit of last year of a group.
* @param group_id The group to get the profit of.
* @pre IsValidGroup(group_id).
* @return The current profit the group had last year.
* @return The profit the vehicles in this group made in the previous economy-year.
* @see \ref ScriptEconomyTime
*/
static Money GetProfitLastYear(GroupID group_id);

View File

@ -29,20 +29,22 @@ public:
/**
* Apply a filter when building the list.
* @param filter_function The function which will be doing the filtering.
* @param params The params to give to the filters (minus the first param,
* @param ... The params to give to the filters (minus the first param,
* which is always the index-value).
* @game @pre ScriptCompanyMode::IsValid().
* @note You can write your own filters and use them. Just remember that
* the first parameter should be the index-value, and it should return
* a bool.
* @note Example:
* @code
* function IsType(group_id, type)
* {
* return ScriptGroup.GetVehicleType(group_id) == type;
* }
* ScriptGroupList(IsType, ScriptVehicle.VT_ROAD);
* local rv_groups = ScriptGroupList(IsType, ScriptVehicle.VT_ROAD);
* @endcode
*/
ScriptGroupList(void *filter_function, int params, ...);
ScriptGroupList(function filter_function, ...);
#else
/**
* The constructor wrapper from Squirrel.

View File

@ -86,10 +86,11 @@ public:
static std::optional<std::string> GetName(IndustryID industry_id);
/**
* Get the construction date of an industry.
* Get the construction calendar-date of an industry.
* @param industry_id The index of the industry.
* @pre IsValidIndustry(industry_id).
* @return Date the industry was constructed.
* @return Calendar-date the industry was constructed.
* @see \ref ScriptCalendarTime
* @api -ai
*/
static ScriptDate::Date GetConstructionDate(IndustryID industry_id);
@ -126,32 +127,35 @@ public:
static SQInteger GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id);
/**
* Get the total last month's production of the given cargo at an industry.
* Get the total last economy-month's production of the given cargo at an industry.
* @param industry_id The index of the industry.
* @param cargo_id The index of the cargo.
* @pre IsValidIndustry(industry_id).
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The last month's production of the given cargo for this industry.
* @return The last economy-month's production of the given cargo for this industry.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id);
/**
* Get the total amount of cargo transported from an industry last month.
* Get the total amount of cargo transported from an industry last economy-month.
* @param industry_id The index of the industry.
* @param cargo_id The index of the cargo.
* @pre IsValidIndustry(industry_id).
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The amount of given cargo transported from this industry last month.
* @return The amount of given cargo transported from this industry last economy-month.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id);
/**
* Get the percentage of cargo transported from an industry last month.
* Get the percentage of cargo transported from an industry last economy-month.
* @param industry_id The index of the industry.
* @param cargo_id The index of the cargo.
* @pre IsValidIndustry(industry_id).
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The percentage of given cargo transported from this industry last month.
* @return The percentage of given cargo transported from this industry last economy-month.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id);
@ -246,21 +250,23 @@ public:
static IndustryType GetIndustryType(IndustryID industry_id);
/**
* Get the last year this industry had any production output.
* Get the last economy-year this industry had any production output.
* @param industry_id The index of the industry.
* @pre IsValidIndustry(industry_id).
* @return Year the industry last had production, 0 if error.
* @return Economy-year the industry last had production, 0 if error.
* @see \ref ScriptEconomyTime
* @api -ai
*/
static SQInteger GetLastProductionYear(IndustryID industry_id);
/**
* Get the last date this industry accepted any cargo delivery.
* Get the last economy-date this industry accepted any cargo delivery.
* @param industry_id The index of the industry.
* @param cargo_type The cargo to query, or INVALID_CARGO to query latest of all accepted cargoes.
* @pre IsValidIndustry(industry_id).
* @pre IsValidCargo(cargo_type) || cargo_type == INVALID_CARGO.
* @return Date the industry last received cargo from a delivery, or ScriptDate::DATE_INVALID on error.
* @return Economy-date the industry last received cargo from a delivery, or ScriptDate::DATE_INVALID on error.
* @see \ref ScriptEconomyTime
* @api -ai
*/
static ScriptDate::Date GetCargoLastAcceptedDate(IndustryID industry_id, CargoID cargo_type);

View File

@ -25,20 +25,23 @@ public:
/**
* Apply a filter when building the list.
* @param filter_function The function which will be doing the filtering.
* @param params The params to give to the filters (minus the first param,
* @param ... The params to give to the filters (minus the first param,
* which is always the index-value).
* @note You can write your own filters and use them. Just remember that
* the first parameter should be the index-value, and it should return
* a bool.
* @note Example:
* ScriptIndustryList(ScriptIndustry.HasDock);
* @code
* local water_industries = ScriptIndustryList(ScriptIndustry.HasDock);
*
* function IsType(industry_id, type)
* {
* return ScriptIndustry.GetIndustryType(industry_id) == type;
* }
* ScriptIndustryList(IsType, 0);
* local industries = ScriptIndustryList(IsType, 0);
* @endcode
*/
ScriptIndustryList(void *filter_function, int params, ...);
ScriptIndustryList(function filter_function, ...);
#else
/**
* The constructor wrapper from Squirrel.

View File

@ -252,5 +252,5 @@ public:
* @note This is a function provided by OpenTTD, you don't have to
* include it in your Script but should just call it from GetSettings.
*/
void AddLabels(const char *setting_name, table value_names);
void AddLabels(string setting_name, table value_names);
};

View File

@ -58,7 +58,8 @@ public:
* Return the monthly maintenance costs of a specific rail type for a company.
* @param company The company to get the monthly cost for.
* @param railtype Rail type to get the cost of.
* @return Monthly maintenance cost for the rail type.
* @return Maintenance cost for the rail type per economy-month.
* @see \ref ScriptEconomyTime
*/
static Money GetMonthlyRailCosts(ScriptCompany::CompanyID company, ScriptRail::RailType railtype);
@ -66,7 +67,8 @@ public:
* Return the monthly maintenance costs of a specific road type for a company.
* @param company The company to get the monthly cost for.
* @param roadtype Road type to get the cost of.
* @return Monthly maintenance cost for the road type.
* @return Maintenance cost for the road type per economy-month.
* @see \ref ScriptEconomyTime
*/
static Money GetMonthlyRoadCosts(ScriptCompany::CompanyID company, ScriptRoad::RoadType roadtype);
@ -74,8 +76,9 @@ public:
* Return the monthly maintenance costs of an infrastructure category for a company.
* @param company The company to get the monthly cost for.
* @param infra_type Infrastructure category to get the cost of.
* @return Monthly maintenance cost for the wanted category.
* @return Maintenance cost for the wanted category per economy-month.
* @note #INFRASTRUCTURE_RAIL and #INFRASTRUCTURE_ROAD return the total cost for all rail/road types.
* @see \ref ScriptEconomyTime
*/
static Money GetMonthlyInfrastructureCosts(ScriptCompany::CompanyID company, Infrastructure infra_type);
};

View File

@ -49,7 +49,7 @@
return ::LeagueTableElement::IsValidID(element_id);
}
/* static */ ScriptLeagueTable::LeagueTableElementID ScriptLeagueTable::NewElement(ScriptLeagueTable::LeagueTableID table, SQInteger rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, LinkTargetID link_target)
/* static */ ScriptLeagueTable::LeagueTableElementID ScriptLeagueTable::NewElement(ScriptLeagueTable::LeagueTableID table, SQInteger rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, SQInteger link_target)
{
CCountedPtr<Text> text_counter(text);
CCountedPtr<Text> score_counter(score);
@ -78,7 +78,7 @@
return (ScriptLeagueTable::LeagueTableElementID)0;
}
/* static */ bool ScriptLeagueTable::UpdateElementData(LeagueTableElementID element, ScriptCompany::CompanyID company, Text *text, LinkType link_type, LinkTargetID link_target)
/* static */ bool ScriptLeagueTable::UpdateElementData(LeagueTableElementID element, ScriptCompany::CompanyID company, Text *text, LinkType link_type, SQInteger link_target)
{
CCountedPtr<Text> text_counter(text);

View File

@ -92,7 +92,7 @@ public:
* @pre score != null && len(score) != 0.
* @pre IsValidLink(Link(link_type, link_target)).
*/
static LeagueTableElementID NewElement(LeagueTableID table, SQInteger rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, LinkTargetID link_target);
static LeagueTableElementID NewElement(LeagueTableID table, SQInteger rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, SQInteger link_target);
/**
* Update the attributes of a league table element.
@ -107,7 +107,7 @@ public:
* @pre text != null && len(text) != 0.
* @pre IsValidLink(Link(link_type, link_target)).
*/
static bool UpdateElementData(LeagueTableElementID element, ScriptCompany::CompanyID company, Text *text, LinkType link_type, LinkTargetID link_target);
static bool UpdateElementData(LeagueTableElementID element, ScriptCompany::CompanyID company, Text *text, LinkType link_type, SQInteger link_target);
/**
* Create a new league table element.

View File

@ -370,7 +370,7 @@ public:
/**
* Give all items a value defined by the valuator you give.
* @param valuator_function The function which will be doing the valuation.
* @param params The params to give to the valuators (minus the first param,
* @param ... The params to give to the valuators (minus the first param,
* which is always the index-value we are valuating).
* @note You may not add, remove or change (setting the value of) items while
* valuating. You may also not (re)sort while valuating.
@ -378,6 +378,7 @@ public:
* the first parameter should be the index-value, and it should return
* an integer.
* @note Example:
* @code
* list.Valuate(ScriptBridge.GetPrice, 5);
* list.Valuate(ScriptBridge.GetMaxLength);
* function MyVal(bridge_id, myparam)
@ -385,8 +386,9 @@ public:
* return myparam * bridge_id; // This is silly
* }
* list.Valuate(MyVal, 12);
* @endcode
*/
void Valuate(void *valuator_function, int params, ...);
void Valuate(function valuator_function, ...);
#endif /* DOXYGEN_API */
};

View File

@ -20,6 +20,8 @@ class ScriptMarine : public ScriptObject {
public:
/**
* All marine related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for marine related errors */

View File

@ -21,6 +21,8 @@ class ScriptOrder : public ScriptObject {
public:
/**
* All order related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for all order related errors */
@ -91,10 +93,10 @@ public:
OC_RELIABILITY = ::OCV_RELIABILITY, ///< Skip based on the reliability, value is percent (0..100).
OC_MAX_RELIABILITY = ::OCV_MAX_RELIABILITY, ///< Skip based on the maximum reliability. Value in percent
OC_MAX_SPEED = ::OCV_MAX_SPEED, ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see ScriptEngine::GetMaxSpeed.
OC_AGE = ::OCV_AGE, ///< Skip based on the age, value is in years.
OC_AGE = ::OCV_AGE, ///< Skip based on the age, value is in calender-years. @see \ref ScriptCalendarTime
OC_REQUIRES_SERVICE = ::OCV_REQUIRES_SERVICE, ///< Skip when the vehicle requires service, no value.
OC_UNCONDITIONALLY = ::OCV_UNCONDITIONALLY, ///< Always skip, no compare function, no value.
OC_REMAINING_LIFETIME = ::OCV_REMAINING_LIFETIME, ///< Skip based on the remaining lifetime
OC_REMAINING_LIFETIME = ::OCV_REMAINING_LIFETIME, ///< Skip based on the remaining lifetime in calendar-years. @see \ref ScriptCalendarTime
/* Custom added value, only valid for this API */
OC_INVALID = -1, ///< An invalid condition, do not use.

View File

@ -42,21 +42,21 @@ public:
* @param priority The priority to assign the item.
* @return True if the item was inserted, false if it was already in the queue.
*/
bool Insert(void *item, SQInteger priority);
bool Insert(object item, SQInteger priority);
/**
* Remove and return the item with the lowest priority.
* @return The item with the lowest priority, removed from the queue. Returns null on an empty queue.
* @pre !IsEmpty()
*/
void *Pop();
object Pop();
/**
* Get the item with the lowest priority, keeping it in the queue.
* @return The item with the lowest priority. Returns null on an empty queue.
* @pre !IsEmpty()
*/
void *Peek();
object Peek();
/**
* Check if an items is already included in the queue.
@ -64,7 +64,7 @@ public:
* @return true if the items is already in the queue.
* @note Performance is O(n), use only when absolutely required.
*/
bool Exists(void *item);
bool Exists(object item);
/**
* Clear the queue, making Count() returning 0 and IsEmpty() returning true.

View File

@ -22,6 +22,8 @@ class ScriptRail : public ScriptObject {
public:
/**
* All rail related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for rail building / maintaining errors */

View File

@ -22,6 +22,8 @@ class ScriptRoad : public ScriptObject {
public:
/**
* All road related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for road building / maintaining errors */

View File

@ -21,6 +21,8 @@ class ScriptSign : public ScriptObject {
public:
/**
* All sign related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {

View File

@ -25,20 +25,22 @@ public:
/**
* Apply a filter when building the list.
* @param filter_function The function which will be doing the filtering.
* @param params The params to give to the filters (minus the first param,
* @param ... The params to give to the filters (minus the first param,
* which is always the index-value).
* @note You can write your own filters and use them. Just remember that
* the first parameter should be the index-value, and it should return
* a bool.
* @note Example:
* @code
* function Contains(sign_id, str)
* {
* local name = ScriptSign.GetName(sign_id);
* return name != null && name.find(str) != null;
* }
* ScriptSignList(Contains, "something");
* local signs = ScriptSignList(Contains, "something");
* @endcode
*/
ScriptSignList(void *filter_function, int params, ...);
ScriptSignList(function filter_function, ...);
#else
ScriptSignList(HSQUIRRELVM);
#endif /* DOXYGEN_API */

View File

@ -22,6 +22,8 @@ class ScriptStation : public ScriptBaseStation {
public:
/**
* All station related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for station related errors */

View File

@ -203,8 +203,8 @@ public:
* @param reference A reference value to the object that is referred to by some page element types.
* When type is SPET_GOAL, this is the goal ID.
* When type is SPET_LOCATION, this is the TileIndex.
* When type is a button, this is additional parameters for the button,
* use the #BuildPushButtonReference, #BuildTileButtonReference, or #BuildVehicleButtonReference functions to make the values.
* When type is a button, this is the ID returned by
* #MakePushButtonReference, #MakeTileButtonReference, or #MakeVehicleButtonReference.
* @param text The body text of page elements that allow custom text. (SPET_TEXT and SPET_LOCATION)
* @return The new StoryPageElementID, or STORY_PAGE_ELEMENT_INVALID if it failed.
* @pre ScriptCompanyMode::IsDeity().
@ -265,18 +265,20 @@ public:
/**
* Get the page date which is displayed at the top of each page.
* @param story_page_id The story page to get the date of.
* @return The date
* @return The calendar-date
* @pre IsValidStoryPage(story_page_id).
* @see \ref ScriptCalendarTime
*/
static ScriptDate::Date GetDate(StoryPageID story_page_id);
/**
* Update date of a story page. The date is shown in the top left of the page
* @param story_page_id The story page to set the date for.
* @param date Date to display at the top of story page or ScriptDate::DATE_INVALID to disable showing date on this page. (also, @see ScriptDate)
* @param date Calendar-date to display at the top of story page or ScriptDate::DATE_INVALID to disable showing date on this page. (also, @see ScriptDate)
* @return True if the action succeeded.
* @pre ScriptCompanyMode::IsDeity().
* @pre IsValidStoryPage(story_page_id).
* @see \ref ScriptCalendarTime
*/
static bool SetDate(StoryPageID story_page_id, ScriptDate::Date date);
@ -329,14 +331,14 @@ public:
/**
* Check whether this is a valid story page button flag.
* @param colour The StoryPageButtonFlags to check.
* @param flags The StoryPageButtonFlags to check.
* @return True if and only if this story page button flag is valid.
*/
static bool IsValidStoryPageButtonFlags(StoryPageButtonFlags flags);
/**
* Check whether this is a valid story page button cursor.
* @param colour The StoryPageButtonCursor to check.
* @param cursor The StoryPageButtonCursor to check.
* @return True if and only if this story page button cursor is valid.
*/
static bool IsValidStoryPageButtonCursor(StoryPageButtonCursor cursor);

View File

@ -74,14 +74,15 @@ public:
static ScriptCompany::CompanyID GetAwardedTo(SubsidyID subsidy_id);
/**
* Get the date this subsidy expires. In case the subsidy is already
* awarded, return the date the subsidy expires, else, return the date the
* Get the economy-date this subsidy expires. In case the subsidy is already
* awarded, return the economy-date the subsidy expires, else, return the economy-date the
* offer expires.
* @param subsidy_id The SubsidyID to check.
* @pre IsValidSubsidy(subsidy_id).
* @return The last valid date of this subsidy.
* @return The last valid economy-date of this subsidy.
* @note The return value of this function will change if the subsidy is
* awarded.
* @see \ref ScriptEconomyTime
*/
static ScriptDate::Date GetExpireDate(SubsidyID subsidy_id);

View File

@ -25,19 +25,21 @@ public:
/**
* Apply a filter when building the list.
* @param filter_function The function which will be doing the filtering.
* @param params The params to give to the filters (minus the first param,
* @param ... The params to give to the filters (minus the first param,
* which is always the index-value).
* @note You can write your own filters and use them. Just remember that
* the first parameter should be the index-value, and it should return
* a bool.
* @note Example:
* @code
* function IsType(subsidy_id, type)
* {
* return ScriptSubsidy.GetSourceType(subsidy_id) == type;
* }
* ScriptSubsidyList(IsType, ScriptSubsidy.SPT_TOWN);
* local town_subs = ScriptSubsidyList(IsType, ScriptSubsidy.SPT_TOWN);
* @endcode
*/
ScriptSubsidyList(void *filter_function, int params, ...);
ScriptSubsidyList(function filter_function, ...);
#else
ScriptSubsidyList(HSQUIRRELVM vm);
#endif /* DOXYGEN_API */

View File

@ -112,14 +112,14 @@ public:
* @param parameter Which parameter to set.
* @param value The value of the parameter. Has to be string, integer or an instance of the class ScriptText.
*/
void SetParam(int parameter, Object value);
void SetParam(int parameter, object value);
/**
* Add a value as parameter (appending it).
* @param value The value of the parameter. Has to be string, integer or an instance of the class ScriptText.
* @return The same object as on which this is called, so you can chain.
*/
ScriptText *AddParam(Object value);
ScriptText *AddParam(object value);
#endif /* DOXYGEN_API */
/**

View File

@ -23,6 +23,8 @@ class ScriptTile : public ScriptObject {
public:
/**
* Error messages related to modifying tiles.
*
* @see ScriptErrorType
*/
enum ErrorMessages {

View File

@ -48,7 +48,8 @@ public:
TOWN_ACTION_ADVERTISE_LARGE = 2,
/**
* Rebuild the roads of this town for 6 months.
* Rebuild the roads of this town for 6 economy-months.
* @see \ref ScriptEconomyTime
*/
TOWN_ACTION_ROAD_REBUILD = 3,
@ -58,12 +59,14 @@ public:
TOWN_ACTION_BUILD_STATUE = 4,
/**
* Fund the creation of extra buildings for 3 months.
* Fund the creation of extra buildings for 3 economy-months.
* @see \ref ScriptEconomyTime
*/
TOWN_ACTION_FUND_BUILDINGS = 5,
/**
* Buy exclusive rights for this town for 12 months.
* Buy exclusive rights for this town for 12 economy-months.
* @see \ref ScriptEconomyTime
*/
TOWN_ACTION_BUY_RIGHTS = 6,
@ -191,92 +194,100 @@ public:
static TileIndex GetLocation(TownID town_id);
/**
* Get the total last month's production of the given cargo at a town.
* Get the total last economy-month's production of the given cargo at a town.
* @param town_id The index of the town.
* @param cargo_id The index of the cargo.
* @pre IsValidTown(town_id).
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The last month's production of the given cargo for this town.
* @return The last economy-month's production of the given cargo for this town.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthProduction(TownID town_id, CargoID cargo_id);
/**
* Get the total amount of cargo supplied from a town last month.
* Get the total amount of cargo supplied from a town last economy-month.
* @param town_id The index of the town.
* @param cargo_id The index of the cargo.
* @pre IsValidTown(town_id).
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The amount of cargo supplied for transport from this town last month.
* @return The amount of cargo supplied for transport from this town last economy-month.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthSupplied(TownID town_id, CargoID cargo_id);
/**
* Get the percentage of transported production of the given cargo at a town.
* Get the percentage of transported production of the given cargo at a town last economy-month.
* @param town_id The index of the town.
* @param cargo_id The index of the cargo.
* @pre IsValidTown(town_id).
* @pre ScriptCargo::IsValidCargo(cargo_id).
* @return The percentage of given cargo transported from this town last month.
* @return The percentage of given cargo transported from this town last economy-month.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
/**
* Get the total amount of cargo effects received by a town last month.
* Get the total amount of cargo effects received by a town last economy-month.
* @param town_id The index of the town.
* @param towneffect_id The index of the cargo.
* @pre IsValidTown(town_id).
* @pre ScriptCargo::IsValidTownEffect(cargo_id).
* @return The amount of cargo received by this town last month for this cargo effect.
* @return The amount of cargo received by this town last economy-month for this cargo effect.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id);
/**
* Set the goal of a cargo for this town.
* Set the goal of a cargo per economy-month for this town.
* @param town_id The index of the town.
* @param towneffect_id The index of the towneffect.
* @param goal The new goal.
* @param goal The new goal amount for cargo delivered per economy-month.
* The value will be clamped to 0 .. MAX(uint32_t).
* @pre IsValidTown(town_id).
* @pre ScriptCargo::IsValidTownEffect(towneffect_id).
* @pre ScriptCompanyMode::IsDeity().
* @return True if the action succeeded.
* @see \ref ScriptEconomyTime
* @api -ai
*/
static bool SetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id, SQInteger goal);
/**
* Get the amount of cargo that needs to be delivered (per TownEffect) for a
* Get the amount of cargo per economy-month that needs to be delivered (per TownEffect) for a
* town to grow. All goals need to be reached before a town will grow.
* @param town_id The index of the town.
* @param towneffect_id The index of the towneffect.
* @pre IsValidTown(town_id).
* @pre ScriptCargo::IsValidTownEffect(towneffect_id).
* @return The goal of the cargo.
* @return The goal of the cargo (amount per economy-month).
* @note Goals can change over time. For example with a changing snowline, or
* with a growing town.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id);
/**
* Set the amount of days between town growth.
* Set the amount of economy-days between town growth.
* @param town_id The index of the town.
* @param days_between_town_growth The amount of days between town growth, TOWN_GROWTH_NONE or TOWN_GROWTH_NORMAL.
* @param days_between_town_growth The amount of economy-days between town growth, TOWN_GROWTH_NONE or TOWN_GROWTH_NORMAL.
* @pre IsValidTown(town_id).
* @pre days_between_town_growth <= 880 || days_between_town_growth == TOWN_GROWTH_NONE || days_between_town_growth == TOWN_GROWTH_NORMAL.
* @return True if the action succeeded.
* @note Even when setting a growth rate, towns only grow when the conditions for growth (SetCargoCoal) are met,
* and the game settings (economy.town_growth_rate) allow town growth at all.
* @note When changing the growth rate, the relative progress is preserved and scaled to the new rate.
* @see \ref ScriptEconomyTime
* @api -ai
*/
static bool SetGrowthRate(TownID town_id, SQInteger days_between_town_growth);
/**
* Get the amount of days between town growth.
* Get the amount of economy-days between town growth.
* @param town_id The index of the town.
* @pre IsValidTown(town_id).
* @return Amount of days between town growth, or TOWN_GROWTH_NONE.
* @return Amount of economy-days between town growth, or TOWN_GROWTH_NONE.
* @note This function does not indicate when it will grow next. It only tells you the time between growths.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetGrowthRate(TownID town_id);
@ -332,8 +343,9 @@ public:
* Find out how long the town is undergoing road reconstructions.
* @param town_id The town to check.
* @pre IsValidTown(town_id).
* @return The number of months the road reworks are still going to take.
* @return The number of economy-months the road reworks are still going to take.
* The value 0 means that there are currently no road reworks.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetRoadReworkDuration(TownID town_id);
@ -341,8 +353,9 @@ public:
* Find out how long new buildings are still being funded in a town.
* @param town_id The town to check.
* @pre IsValidTown(town_id).
* @return The number of months building construction is still funded.
* @return The number of economy-months building construction is still funded.
* The value 0 means that there is currently no funding.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetFundBuildingsDuration(TownID town_id);
@ -361,9 +374,10 @@ public:
* Find out how long the town is under influence of the exclusive rights.
* @param town_id The town to check.
* @pre IsValidTown(town_id).
* @return The number of months the exclusive rights hold.
* @return The number of economy-months the exclusive rights hold.
* The value 0 means that there are currently no exclusive rights
* given out to anyone.
* @see \ref ScriptEconomyTime
*/
static SQInteger GetExclusiveRightsDuration(TownID town_id);

View File

@ -25,20 +25,23 @@ public:
/**
* Apply a filter when building the list.
* @param filter_function The function which will be doing the filtering.
* @param params The params to give to the filters (minus the first param,
* @param ... The params to give to the filters (minus the first param,
* which is always the index-value).
* @note You can write your own filters and use them. Just remember that
* the first parameter should be the index-value, and it should return
* a bool.
* @note Example:
* ScriptTownList(ScriptTown.IsActionAvailable, ScriptTown.TOWN_ACTION_BRIBE);
* @code
* local bribeable_towns = ScriptTownList(ScriptTown.IsActionAvailable, ScriptTown.TOWN_ACTION_BRIBE);
*
* function MinPopulation(town_id, pop)
* {
* return ScriptTown.GetPopulation(town_id) >= pop;
* }
* ScriptTownList(MinPopulation, 1000);
* local proper_towns = ScriptTownList(MinPopulation, 1000);
* @endcode
*/
ScriptTownList(void *filter_function, int params, ...);
ScriptTownList(function filter_function, ...);
#else
ScriptTownList(HSQUIRRELVM vm);
#endif /* DOXYGEN_API */

View File

@ -20,6 +20,8 @@ class ScriptTunnel : public ScriptObject {
public:
/**
* All tunnel related errors.
*
* @see ScriptErrorType
*/
enum ErrorMessages {

View File

@ -7,7 +7,10 @@
/**
* @file script_types.hpp Defines all the types of the game, like IDs of various objects.
*
*/
/**
* @page script_ids Identifying game object
* IDs are used to identify certain objects. They are only unique within the object type, so for example a vehicle may have VehicleID 2009,
* while a station has StationID 2009 at the same time. Also IDs are assigned arbitrary, you cannot assume them to be consecutive.
* Also note that some IDs are static and never change, while others are allocated dynamically and might be
@ -46,6 +49,14 @@
* <td> game start \ref newgrf_changes "(1)" </td>
* <td> never \ref newgrf_changes "(1)" </td>
* <td> no </td></tr>
* <tr><td>#ObjectType </td><td> NewGRF object type </td>
* <td> game start \ref newgrf_changes "(1)" </td>
* <td> never \ref newgrf_changes "(1)" </td>
* <td> no </td></tr>
* <tr><td>#ScriptErrorType</td><td> error message </td>
* <td> OpenTTD start \ref transient_id "(3)" </td>
* <td> OpenTTD exit </td>
* <td> no </td></tr>
* <tr><td>#SignID </td><td> sign </td>
* <td> construction </td>
* <td> deletion </td>
@ -54,10 +65,22 @@
* <td> construction </td>
* <td> expiration of 'grey' station sign after deletion </td>
* <td> yes </td></tr>
* <tr><td>#StringID </td><td> translatable text </td>
* <td> OpenTTD start \ref transient_id "(3)" </td>
* <td> OpenTTD exit </td>
* <td> no </td></tr>
* <tr><td>#SubsidyID </td><td> subsidy </td>
* <td> offer announcement </td>
* <td> (offer) expiration </td>
* <td> yes </td></tr>
* <tr><td>#StoryPageID </td><td> story page </td>
* <td> creation </td>
* <td> deletion </td>
* <td> yes </td></tr>
* <tr><td>#StoryPageElementID</td><td> story page element </td>
* <td> creation </td>
* <td> deletion </td>
* <td> yes </td></tr>
* <tr><td>#TileIndex </td><td> tile on map </td>
* <td> game start </td>
* <td> never </td>
@ -75,6 +98,7 @@
* @remarks
* \li \anchor newgrf_changes (1) in-game changes of newgrfs may reassign/invalidate IDs (will also cause other trouble though).
* \li \anchor dynamic_engines (2) engine IDs are reassigned/invalidated on changing 'allow multiple newgrf engine sets' (only allowed as long as no vehicles are built).
* \li \anchor transient_id (3) string/error IDs are only valid during a session, and may be reassigned/invalidated when loading savegames (so you cannot store them).
*/
#ifndef SCRIPT_TYPES_HPP
@ -85,27 +109,37 @@
#include "../../tile_type.h"
#include <squirrel.h>
/* Define all types here, so we don't have to include the whole _type.h maze */
typedef uint BridgeType; ///< Internal name, not of any use for you.
typedef uint8_t CargoID; ///< The ID of a cargo.
class CommandCost; ///< The cost of a command.
/* Define all types here, so they are added to the API docs. */
typedef uint BridgeID; ///< The ID of a bridge type.
typedef uint8_t CargoID; ///< The ID of a cargo.
typedef uint16_t EngineID; ///< The ID of an engine.
typedef uint16_t GoalID; ///< The ID of a goal.
typedef uint16_t GroupID; ///< The ID of a group.
typedef uint16_t IndustryID; ///< The ID of an industry.
typedef uint8_t IndustryType; ///< The ID of an industry-type.
typedef OverflowSafeInt64 Money; ///< Money, stored in a 32bit/64bit safe way. For scripts money is always in pounds.
#ifdef DOXYGEN_API
typedef int64_t Money; ///< Money, stored in a 32bit/64bit safe way. For scripts money is always in pounds.
#else
typedef OverflowSafeInt64 Money;
#endif /* DOXYGEN_API */
typedef uint16_t ObjectType; ///< The ID of an object-type.
typedef uint16_t SignID; ///< The ID of a sign.
typedef uint16_t StationID; ///< The ID of a station.
typedef uint32_t StringID; ///< The ID of a string.
typedef uint16_t SubsidyID; ///< The ID of a subsidy.
typedef uint16_t StoryPageID; ///< The ID of a story page.
typedef uint16_t StoryPageElementID; ///< The ID of a story page element.
#ifdef DOXYGEN_API
typedef uint32_t TileIndex; ///< The ID of a map location.
#endif /* DOXYGEN_API */
typedef uint16_t TownID; ///< The ID of a town.
typedef uint32_t VehicleID; ///< The ID of a vehicle.
/* Types we defined ourself, as the OpenTTD core doesn't have them (yet) */
typedef uint ScriptErrorType;///< The types of errors inside the script framework.
typedef BridgeType BridgeID; ///< The ID of a bridge.
/**
* The types of errors inside the script framework.
*
* Possible value are defined inside each API class in an ErrorMessages enum.
*/
typedef uint ScriptErrorType;
#endif /* SCRIPT_TYPES_HPP */

View File

@ -20,6 +20,8 @@ class ScriptVehicle : public ScriptObject {
public:
/**
* All vehicle related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for vehicle related errors */
@ -186,8 +188,8 @@ public:
* Get the current age of a vehicle.
* @param vehicle_id The vehicle to get the age of.
* @pre IsValidVehicle(vehicle_id).
* @return The current age the vehicle has.
* @note The age is in days.
* @return The current age of the vehicle in calendar-days.
* @see \ref ScriptCalendarTime
*/
static SQInteger GetAge(VehicleID vehicle_id);
@ -197,8 +199,8 @@ public:
* @param wagon The wagon in the vehicle to get the age of.
* @pre IsValidVehicle(vehicle_id).
* @pre wagon < GetNumWagons(vehicle_id).
* @return The current age the vehicle has.
* @note The age is in days.
* @return The current age of the vehicle in calendar-days.
* @see \ref ScriptCalendarTime
*/
static SQInteger GetWagonAge(VehicleID vehicle_id, SQInteger wagon);
@ -206,8 +208,8 @@ public:
* Get the maximum age of a vehicle.
* @param vehicle_id The vehicle to get the age of.
* @pre IsPrimaryVehicle(vehicle_id).
* @return The maximum age the vehicle has.
* @note The age is in days.
* @return The maximum age for the vehicle in calendar-days.
* @see \ref ScriptCalendarTime
*/
static SQInteger GetMaxAge(VehicleID vehicle_id);
@ -215,8 +217,8 @@ public:
* Get the age a vehicle has left (maximum - current).
* @param vehicle_id The vehicle to get the age of.
* @pre IsPrimaryVehicle(vehicle_id).
* @return The age the vehicle has left.
* @note The age is in days.
* @return The remaining age of the vehicle in calendar-days.
* @see \ref ScriptCalendarTime
*/
static SQInteger GetAgeLeft(VehicleID vehicle_id);
@ -243,10 +245,10 @@ public:
* Get the running cost of this vehicle.
* @param vehicle_id The vehicle to get the running cost of.
* @pre IsPrimaryVehicle(vehicle_id).
* @return The running cost of the vehicle per year.
* @note Cost is per year; divide by 365 to get per day.
* @return The running cost of the vehicle per economy-year.
* @note This is not equal to ScriptEngine::GetRunningCost for Trains, because
* wagons and second engines can add up in the calculation too.
* @see \ref ScriptEconomyTime
*/
static Money GetRunningCost(VehicleID vehicle_id);
@ -254,7 +256,8 @@ public:
* Get the current profit of a vehicle.
* @param vehicle_id The vehicle to get the profit of.
* @pre IsPrimaryVehicle(vehicle_id).
* @return The current profit the vehicle has.
* @return The profit the vehicle has made this economy-year so far.
* @see \ref ScriptEconomyTime
*/
static Money GetProfitThisYear(VehicleID vehicle_id);
@ -262,7 +265,8 @@ public:
* Get the profit of last year of a vehicle.
* @param vehicle_id The vehicle to get the profit of.
* @pre IsPrimaryVehicle(vehicle_id).
* @return The profit the vehicle had last year.
* @return The profit the vehicle made in the previous economy-year.
* @see \ref ScriptEconomyTime
*/
static Money GetProfitLastYear(VehicleID vehicle_id);

View File

@ -26,20 +26,23 @@ public:
/**
* Apply a filter when building the list.
* @param filter_function The function which will be doing the filtering.
* @param params The params to give to the filters (minus the first param,
* @param ... The params to give to the filters (minus the first param,
* which is always the index-value).
* @note You can write your own filters and use them. Just remember that
* the first parameter should be the index-value, and it should return
* a bool.
* @note Example:
* ScriptVehicleList(ScriptVehicle.IsInDepot);
* @code
* local vehs_in_depot = ScriptVehicleList(ScriptVehicle.IsInDepot);
*
* function IsType(vehicle_id, type)
* {
* return ScriptVehicle.GetVehicleType(vehicle_id) == type;
* }
* ScriptVehicleList(IsType, ScriptVehicle.VT_ROAD);
* local road_vehs = ScriptVehicleList(IsType, ScriptVehicle.VT_ROAD);
* @endcode
*/
ScriptVehicleList(void *filter_function, int params, ...);
ScriptVehicleList(function filter_function, ...);
#else
/**
* The constructor wrapper from Squirrel.

View File

@ -22,6 +22,8 @@ class ScriptWaypoint : public ScriptBaseStation {
public:
/**
* All waypoint related error messages.
*
* @see ScriptErrorType
*/
enum ErrorMessages {
/** Base for waypoint related errors */

View File

@ -1790,6 +1790,11 @@ void SyncCompanySettings()
const SettingDesc *sd = GetSettingDesc(desc);
uint32_t old_value = (uint32_t)sd->AsIntSetting()->Read(old_object);
uint32_t new_value = (uint32_t)sd->AsIntSetting()->Read(new_object);
/*
* This is called from a command, and since it contains local configuration information
* that the rest of the clients do not know about, we need to circumvent the normal ::Post
* local command validation and immediately send the command to the server.
*/
if (old_value != new_value) Command<CMD_CHANGE_COMPANY_SETTING>::SendNet(STR_NULL, _local_company, sd->GetName(), new_value);
}
}

View File

@ -2129,12 +2129,9 @@ static SettingsContainer &GetSettingsTree()
SettingsPage *routing = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ROUTING));
{
routing->Add(new SettingEntry("vehicle.road_side"));
routing->Add(new SettingEntry("pf.pathfinder_for_trains"));
routing->Add(new SettingEntry("difficulty.line_reverse_mode"));
routing->Add(new SettingEntry("pf.reverse_at_signals"));
routing->Add(new SettingEntry("pf.forbid_90_deg"));
routing->Add(new SettingEntry("pf.pathfinder_for_roadvehs"));
routing->Add(new SettingEntry("pf.pathfinder_for_ships"));
}
SettingsPage *orders = vehicles->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES_ORDERS));

View File

@ -555,13 +555,6 @@ static void MaxVehiclesChanged(int32_t)
MarkWholeScreenDirty();
}
static void InvalidateShipPathCache(int32_t)
{
for (Ship *s : Ship::Iterate()) {
s->path.clear();
}
}
/**
* Replace a passwords that are a literal asterisk with an empty string.
* @param newval The new string value for this password field.

View File

@ -409,42 +409,11 @@ struct ScriptSettings {
uint32_t script_max_memory_megabytes; ///< limit on memory a single script instance may have allocated
};
/** Settings related to the new pathfinder. */
struct NPFSettings {
/**
* The maximum amount of search nodes a single NPF run should take. This
* limit should make sure performance stays at acceptable levels at the cost
* of not being perfect anymore.
*/
uint32_t npf_max_search_nodes;
uint32_t maximum_go_to_depot_penalty; ///< What is the maximum penalty that may be endured for going to a depot
uint32_t npf_rail_firstred_penalty; ///< the penalty for when the first signal is red (and it is not an exit or combo signal)
uint32_t npf_rail_firstred_exit_penalty; ///< the penalty for when the first signal is red (and it is an exit or combo signal)
uint32_t npf_rail_lastred_penalty; ///< the penalty for when the last signal is red
uint32_t npf_rail_station_penalty; ///< the penalty for station tiles
uint32_t npf_rail_slope_penalty; ///< the penalty for sloping upwards
uint32_t npf_rail_curve_penalty; ///< the penalty for curves
uint32_t npf_rail_depot_reverse_penalty; ///< the penalty for reversing in depots
uint32_t npf_rail_pbs_cross_penalty; ///< the penalty for crossing a reserved rail track
uint32_t npf_rail_pbs_signal_back_penalty; ///< the penalty for passing a pbs signal from the backside
uint32_t npf_buoy_penalty; ///< the penalty for going over (through) a buoy
uint32_t npf_water_curve_penalty; ///< the penalty for curves
uint32_t npf_road_curve_penalty; ///< the penalty for curves
uint32_t npf_crossing_penalty; ///< the penalty for level crossings
uint32_t npf_road_drive_through_penalty; ///< the penalty for going through a drive-through road stop
uint32_t npf_road_dt_occupied_penalty; ///< the penalty multiplied by the fill percentage of a drive-through road stop
uint32_t npf_road_bay_occupied_penalty; ///< the penalty multiplied by the fill percentage of a road bay
};
/** Settings related to the yet another pathfinder. */
struct YAPFSettings {
bool disable_node_optimization; ///< whether to use exit-dir instead of trackdir in node key
uint32_t max_search_nodes; ///< stop path-finding when this number of nodes visited
uint32_t maximum_go_to_depot_penalty; ///< What is the maximum penalty that may be endured for going to a depot
bool ship_use_yapf; ///< use YAPF for ships
bool road_use_yapf; ///< use YAPF for road
bool rail_use_yapf; ///< use YAPF for rail
uint32_t road_slope_penalty; ///< penalty for up-hill slope
uint32_t road_curve_penalty; ///< penalty for curves
uint32_t road_crossing_penalty; ///< penalty for level crossing
@ -481,11 +450,6 @@ struct YAPFSettings {
/** Settings related to all pathfinders. */
struct PathfinderSettings {
uint8_t pathfinder_for_trains; ///< the pathfinder to use for trains
uint8_t pathfinder_for_roadvehs; ///< the pathfinder to use for roadvehicles
uint8_t pathfinder_for_ships; ///< the pathfinder to use for ships
bool new_pathfinding_all; ///< use the newest pathfinding algorithm for all
bool roadveh_queue; ///< buggy road vehicle queueing
bool forbid_90_deg; ///< forbid trains to make 90 deg turns
@ -497,7 +461,6 @@ struct PathfinderSettings {
uint8_t wait_for_pbs_path; ///< how long to wait for a path reservation.
uint8_t path_backoff_interval; ///< ticks between checks for a free path.
NPFSettings npf; ///< pathfinder settings for the new pathfinder
YAPFSettings yapf; ///< pathfinder settings for the yet another pathfinder
};

View File

@ -13,7 +13,6 @@
#include "timetable.h"
#include "news_func.h"
#include "company_func.h"
#include "pathfinder/npf/npf_func.h"
#include "depot_base.h"
#include "station_base.h"
#include "newgrf_engine.h"
@ -210,12 +209,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
return;
}
uint max_distance;
switch (_settings_game.pf.pathfinder_for_ships) {
case VPF_NPF: max_distance = _settings_game.pf.npf.maximum_go_to_depot_penalty / NPF_TILE_LENGTH; break;
case VPF_YAPF: max_distance = _settings_game.pf.yapf.maximum_go_to_depot_penalty / YAPF_TILE_LENGTH; break;
default: NOT_REACHED();
}
uint max_distance = _settings_game.pf.yapf.maximum_go_to_depot_penalty / YAPF_TILE_LENGTH;
const Depot *depot = FindClosestShipDepot(v, max_distance);
@ -376,13 +370,7 @@ static Vehicle *EnsureNoMovingShipProc(Vehicle *v, void *)
static bool CheckReverseShip(const Ship *v, Trackdir *trackdir = nullptr)
{
/* Ask pathfinder for best direction */
bool reverse = false;
switch (_settings_game.pf.pathfinder_for_ships) {
case VPF_NPF: reverse = NPFShipCheckReverse(v, trackdir); break;
case VPF_YAPF: reverse = YapfShipCheckReverse(v, trackdir); break;
default: NOT_REACHED();
}
return reverse;
return YapfShipCheckReverse(v, trackdir);
}
static bool CheckShipLeaveDepot(Ship *v)
@ -530,11 +518,7 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, TrackBits tracks)
v->path.clear();
}
switch (_settings_game.pf.pathfinder_for_ships) {
case VPF_NPF: track = NPFShipChooseTrack(v, path_found); break;
case VPF_YAPF: track = YapfShipChooseTrack(v, tile, path_found, v->path); break;
default: NOT_REACHED();
}
track = YapfShipChooseTrack(v, tile, path_found, v->path);
}
v->HandlePathfindingResult(path_found);

View File

@ -8,8 +8,6 @@
; and in the savegame PATS chunk.
[pre-amble]
static void InvalidateShipPathCache(int32_t new_value);
static const SettingVariant _pathfinding_settings_table[] = {
[post-amble]
};
@ -52,76 +50,6 @@ var = pf.roadveh_queue
def = true
cat = SC_EXPERT
[SDT_BOOL]
var = pf.new_pathfinding_all
to = SLV_87
def = false
cat = SC_EXPERT
[SDT_BOOL]
var = pf.yapf.ship_use_yapf
from = SLV_28
to = SLV_87
def = false
cat = SC_EXPERT
[SDT_BOOL]
var = pf.yapf.road_use_yapf
from = SLV_28
to = SLV_87
def = true
cat = SC_EXPERT
[SDT_BOOL]
var = pf.yapf.rail_use_yapf
from = SLV_28
to = SLV_87
def = true
cat = SC_EXPERT
[SDT_VAR]
var = pf.pathfinder_for_trains
type = SLE_UINT8
from = SLV_87
flags = SF_GUI_DROPDOWN
def = 2
min = 1
max = 2
interval = 1
str = STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS
strhelp = STR_CONFIG_SETTING_PATHFINDER_FOR_TRAINS_HELPTEXT
strval = STR_CONFIG_SETTING_PATHFINDER_NPF
cat = SC_EXPERT
[SDT_VAR]
var = pf.pathfinder_for_roadvehs
type = SLE_UINT8
from = SLV_87
flags = SF_GUI_DROPDOWN
def = 2
min = 1
max = 2
interval = 1
str = STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES
strhelp = STR_CONFIG_SETTING_PATHFINDER_FOR_ROAD_VEHICLES_HELPTEXT
strval = STR_CONFIG_SETTING_PATHFINDER_NPF
cat = SC_EXPERT
[SDT_VAR]
var = pf.pathfinder_for_ships
type = SLE_UINT8
from = SLV_87
flags = SF_GUI_DROPDOWN
def = 2
min = 1
max = 2
interval = 1
str = STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS
strhelp = STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS_HELPTEXT
strval = STR_CONFIG_SETTING_PATHFINDER_NPF
post_cb = InvalidateShipPathCache
cat = SC_EXPERT
[SDT_BOOL]
var = pf.reverse_at_signals
from = SLV_159
@ -169,156 +97,6 @@ min = 1
max = 255
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_max_search_nodes
type = SLE_UINT
def = AYSTAR_DEF_MAX_SEARCH_NODES
min = 500
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_firstred_penalty
type = SLE_UINT
def = 10 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_firstred_exit_penalty
type = SLE_UINT
def = 100 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_lastred_penalty
type = SLE_UINT
def = 10 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_station_penalty
type = SLE_UINT
def = 1 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_slope_penalty
type = SLE_UINT
def = 1 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_curve_penalty
type = SLE_UINT
def = 1 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_depot_reverse_penalty
type = SLE_UINT
def = 50 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_pbs_cross_penalty
type = SLE_UINT
from = SLV_100
def = 3 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_rail_pbs_signal_back_penalty
type = SLE_UINT
from = SLV_100
def = 15 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_buoy_penalty
type = SLE_UINT
def = 2 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_water_curve_penalty
type = SLE_UINT
def = 1 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_road_curve_penalty
type = SLE_UINT
def = 1 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_crossing_penalty
type = SLE_UINT
def = 3 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_road_drive_through_penalty
type = SLE_UINT
from = SLV_47
def = 8 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_road_dt_occupied_penalty
type = SLE_UINT
from = SLV_130
def = 8 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_road_bay_occupied_penalty
type = SLE_UINT
from = SLV_130
def = 15 * NPF_TILE_LENGTH
min = 0
max = 100000
cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.maximum_go_to_depot_penalty
type = SLE_UINT
from = SLV_131
def = 20 * NPF_TILE_LENGTH
min = 0
max = 1000000
cat = SC_EXPERT
[SDT_BOOL]
var = pf.yapf.disable_node_optimization
from = SLV_28

View File

@ -12,7 +12,6 @@
#include "articulated_vehicles.h"
#include "command_func.h"
#include "error_func.h"
#include "pathfinder/npf/npf_func.h"
#include "pathfinder/yapf/yapf.hpp"
#include "news_func.h"
#include "company_func.h"
@ -2171,12 +2170,7 @@ static FindDepotData FindClosestTrainDepot(Train *v, int max_distance)
PBSTileInfo origin = FollowTrainReservation(v);
if (IsRailDepotTile(origin.tile)) return FindDepotData(origin.tile, 0);
switch (_settings_game.pf.pathfinder_for_trains) {
case VPF_NPF: return NPFTrainFindNearestDepot(v, max_distance);
case VPF_YAPF: return YapfTrainFindNearestDepot(v, max_distance);
default: NOT_REACHED();
}
return YapfTrainFindNearestDepot(v, max_distance);
}
ClosestDepot Train::FindClosestDepot()
@ -2473,13 +2467,7 @@ static const uint8_t _initial_tile_subcoord[6][4][3] = {
static Track DoTrainPathfind(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool do_track_reservation, PBSTileInfo *dest, TileIndex *final_dest)
{
if (final_dest != nullptr) *final_dest = INVALID_TILE;
switch (_settings_game.pf.pathfinder_for_trains) {
case VPF_NPF: return NPFTrainChooseTrack(v, path_found, do_track_reservation, dest);
case VPF_YAPF: return YapfTrainChooseTrack(v, tile, enterdir, tracks, path_found, do_track_reservation, dest, final_dest);
default: NOT_REACHED();
}
return YapfTrainChooseTrack(v, tile, enterdir, tracks, path_found, do_track_reservation, dest, final_dest);
}
/**
@ -2581,12 +2569,7 @@ static PBSTileInfo ExtendTrainReservation(const Train *v, TrackBits *new_tracks,
*/
static bool TryReserveSafeTrack(const Train *v, TileIndex tile, Trackdir td, bool override_railtype)
{
switch (_settings_game.pf.pathfinder_for_trains) {
case VPF_NPF: return NPFTrainFindNearestSafeTile(v, tile, td, override_railtype);
case VPF_YAPF: return YapfTrainFindNearestSafeTile(v, tile, td, override_railtype);
default: NOT_REACHED();
}
return YapfTrainFindNearestSafeTile(v, tile, td, override_railtype);
}
/** This class will save the current order of a vehicle and restore it on destruction. */
@ -2934,12 +2917,7 @@ static bool CheckReverseTrain(const Train *v)
assert(v->track != TRACK_BIT_NONE);
switch (_settings_game.pf.pathfinder_for_trains) {
case VPF_NPF: return NPFTrainCheckReverse(v);
case VPF_YAPF: return YapfTrainCheckReverse(v);
default: NOT_REACHED();
}
return YapfTrainCheckReverse(v);
}
/**
@ -4142,12 +4120,7 @@ static void CheckIfTrainNeedsService(Train *v)
return;
}
uint max_penalty;
switch (_settings_game.pf.pathfinder_for_trains) {
case VPF_NPF: max_penalty = _settings_game.pf.npf.maximum_go_to_depot_penalty; break;
case VPF_YAPF: max_penalty = _settings_game.pf.yapf.maximum_go_to_depot_penalty; break;
default: NOT_REACHED();
}
uint max_penalty = _settings_game.pf.yapf.maximum_go_to_depot_penalty;
FindDepotData tfdd = FindClosestTrainDepot(v, max_penalty);
/* Only go to the depot if it is not too far out of our way. */

View File

@ -53,13 +53,6 @@ struct BaseVehicle
static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
/** Pathfinding option states */
enum VehiclePathFinders {
// Original PathFinder (OPF) used to be 0
VPF_NPF = 1, ///< New PathFinder
VPF_YAPF = 2, ///< Yet Another PathFinder
};
/** Flags for goto depot commands. */
enum class DepotCommand : uint8_t {
None = 0, ///< No special flags.