Merge branch 'master' into jgrpp

# Conflicts:
#	src/clear_cmd.cpp
#	src/main_gui.cpp
#	src/saveload/newgrf_sl.cpp
#	src/water_cmd.cpp
pull/480/head
Jonathan G Rennison 1 year ago
commit 32fe84cfdd

@ -41,7 +41,6 @@ INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
@ -155,7 +154,6 @@ VERBATIM_HEADERS = YES
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@ -224,7 +222,7 @@ LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =

@ -342,7 +342,7 @@ foreach(LINE IN LISTS SOURCE_LINES)
else()
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PreRegister(engine, \"${API_SUPER_CLS}\");")
endif()
if(NOT "${SUPER_CLS}" STREQUAL "ScriptEvent")
if(NOT "${SUPER_CLS}" MATCHES "^ScriptEvent")
if("${CLS_PARAM_2}" STREQUAL "v")
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.AddSQAdvancedConstructor(engine);")
else()

@ -13,7 +13,6 @@
#include "landscape.h"
#include "genworld.h"
#include "viewport_func.h"
#include "water.h"
#include "core/random_func.hpp"
#include "newgrf_generic.h"
#include "newgrf_newlandscape.h"
@ -330,14 +329,6 @@ static void TileLoopClearDesert(TileIndex tile)
static void TileLoop_Clear(TileIndex tile)
{
/* If the tile is at any edge flood it to prevent maps without water. */
if (_settings_game.construction.freeform_edges && DistanceFromEdge(tile) == 1) {
int z;
if (IsTileFlat(tile, &z) && z == 0) {
DoFloodTile(tile);
return;
}
}
AmbientSoundEffect(tile);
switch (_settings_game.game_creation.landscape) {

@ -3619,6 +3619,10 @@ STR_ERROR_INVALID_SIGNAL :{WHITE}유효
STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}철교 선택
STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}다리 종류를 선택하세요
STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}다리 건설 - 원하는 다리 종류를 선택하세요
STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING}
STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY}
STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{0:STRING},{} {WHITE}{2:CURRENCY_LONG}
STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG}
STR_BRIDGE_NAME_SUSPENSION_STEEL :강철 현수교
STR_BRIDGE_NAME_GIRDER_STEEL :강철 거더교
STR_BRIDGE_NAME_CANTILEVER_STEEL :강철 캔틸레버교

@ -254,7 +254,7 @@ struct MainWindow : Window
nvp->InitializeViewport(this, TileXY(32, 32), ScaleZoomGUI(ZOOM_LVL_VIEWPORT));
this->viewport->map_type = (ViewportMapType) _settings_client.gui.default_viewport_map_mode;
this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 3);
this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 2);
this->refresh.SetInterval(LINKGRAPH_DELAY);
}

@ -175,7 +175,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
{
byte airport_id = this->AddEntityID(as->grf_prop.local_id, as->grf_prop.grffile->grfid, as->grf_prop.subst_id);
if (airport_id == invalid_ID) {
if (airport_id == this->invalid_id) {
grfmsg(1, "Airport.SetEntitySpec: Too many airports allocated. Ignoring.");
return;
}
@ -183,15 +183,15 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as)
memcpy(AirportSpec::GetWithoutOverride(airport_id), as, sizeof(*as));
/* Now add the overrides. */
for (int i = 0; i < max_offset; i++) {
for (int i = 0; i < this->max_offset; i++) {
AirportSpec *overridden_as = AirportSpec::GetWithoutOverride(i);
if (entity_overrides[i] != as->grf_prop.local_id || grfid_overrides[i] != as->grf_prop.grffile->grfid) continue;
if (this->entity_overrides[i] != as->grf_prop.local_id || this->grfid_overrides[i] != as->grf_prop.grffile->grfid) continue;
overridden_as->grf_prop.override = airport_id;
overridden_as->enabled = false;
entity_overrides[i] = invalid_ID;
grfid_overrides[i] = 0;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;
}
}

@ -67,7 +67,7 @@ void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts)
{
StationGfx airpt_id = this->AddEntityID(airpts->grf_prop.local_id, airpts->grf_prop.grffile->grfid, airpts->grf_prop.subst_id);
if (airpt_id == invalid_ID) {
if (airpt_id == this->invalid_id) {
grfmsg(1, "AirportTile.SetEntitySpec: Too many airport tiles allocated. Ignoring.");
return;
}
@ -75,15 +75,15 @@ void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts)
memcpy(&AirportTileSpec::tiles[airpt_id], airpts, sizeof(*airpts));
/* Now add the overrides. */
for (int i = 0; i < max_offset; i++) {
for (int i = 0; i < this->max_offset; i++) {
AirportTileSpec *overridden_airpts = &AirportTileSpec::tiles[i];
if (entity_overrides[i] != airpts->grf_prop.local_id || grfid_overrides[i] != airpts->grf_prop.grffile->grfid) continue;
if (this->entity_overrides[i] != airpts->grf_prop.local_id || this->grfid_overrides[i] != airpts->grf_prop.grffile->grfid) continue;
overridden_airpts->grf_prop.override = airpt_id;
overridden_airpts->enabled = false;
entity_overrides[i] = invalid_ID;
grfid_overrides[i] = 0;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;
}
}

@ -41,25 +41,14 @@
*/
OverrideManagerBase::OverrideManagerBase(uint16 offset, uint16 maximum, uint16 invalid)
{
max_offset = offset;
max_new_entities = maximum;
invalid_ID = invalid;
mapping_ID = CallocT<EntityIDMapping>(max_new_entities);
entity_overrides = MallocT<uint16>(max_offset);
for (size_t i = 0; i < max_offset; i++) entity_overrides[i] = invalid;
grfid_overrides = CallocT<uint32>(max_offset);
}
/**
* Destructor of the generic class.
* Frees allocated memory of constructor
*/
OverrideManagerBase::~OverrideManagerBase()
{
free(mapping_ID);
free(entity_overrides);
free(grfid_overrides);
this->max_offset = offset;
this->max_entities = maximum;
this->invalid_id = invalid;
this->mappings.resize(this->max_entities);
this->entity_overrides.resize(this->max_offset);
std::fill(this->entity_overrides.begin(), this->entity_overrides.end(), this->invalid_id);
this->grfid_overrides.resize(this->max_offset);
}
/**
@ -72,26 +61,24 @@ OverrideManagerBase::~OverrideManagerBase()
*/
void OverrideManagerBase::Add(uint8 local_id, uint32 grfid, uint entity_type)
{
assert(entity_type < max_offset);
assert(entity_type < this->max_offset);
/* An override can be set only once */
if (entity_overrides[entity_type] != invalid_ID) return;
entity_overrides[entity_type] = local_id;
grfid_overrides[entity_type] = grfid;
if (this->entity_overrides[entity_type] != this->invalid_id) return;
this->entity_overrides[entity_type] = local_id;
this->grfid_overrides[entity_type] = grfid;
}
/** Resets the mapping, which is used while initializing game */
void OverrideManagerBase::ResetMapping()
{
memset(mapping_ID, 0, (max_new_entities - 1) * sizeof(EntityIDMapping));
std::fill(this->mappings.begin(), this->mappings.end(), EntityIDMapping{});
}
/** Resets the override, which is used while initializing game */
void OverrideManagerBase::ResetOverride()
{
for (uint16 i = 0; i < max_offset; i++) {
entity_overrides[i] = invalid_ID;
grfid_overrides[i] = 0;
}
std::fill(this->entity_overrides.begin(), this->entity_overrides.end(), this->invalid_id);
std::fill(this->grfid_overrides.begin(), this->grfid_overrides.end(), uint32());
}
/**
@ -102,16 +89,14 @@ void OverrideManagerBase::ResetOverride()
*/
uint16 OverrideManagerBase::GetID(uint8 grf_local_id, uint32 grfid) const
{
const EntityIDMapping *map;
for (uint16 id = 0; id < max_new_entities; id++) {
map = &mapping_ID[id];
for (uint16 id = 0; id < this->max_entities; id++) {
const EntityIDMapping *map = &this->mappings[id];
if (map->entity_id == grf_local_id && map->grfid == grfid) {
return id;
}
}
return invalid_ID;
return this->invalid_id;
}
/**
@ -124,19 +109,16 @@ uint16 OverrideManagerBase::GetID(uint8 grf_local_id, uint32 grfid) const
uint16 OverrideManagerBase::AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id)
{
uint16 id = this->GetID(grf_local_id, grfid);
EntityIDMapping *map;
/* Look to see if this entity has already been added. This is done
* separately from the loop below in case a GRF has been deleted, and there
* are any gaps in the array.
*/
if (id != invalid_ID) {
return id;
}
if (id != this->invalid_id) return id;
/* This entity hasn't been defined before, so give it an ID now. */
for (id = max_offset; id < max_new_entities; id++) {
map = &mapping_ID[id];
for (id = this->max_offset; id < this->max_entities; id++) {
EntityIDMapping *map = &this->mappings[id];
if (CheckValidNewID(id) && map->entity_id == 0 && map->grfid == 0) {
map->entity_id = grf_local_id;
@ -146,7 +128,7 @@ uint16 OverrideManagerBase::AddEntityID(byte grf_local_id, uint32 grfid, byte su
}
}
return invalid_ID;
return this->invalid_id;
}
/**
@ -156,7 +138,7 @@ uint16 OverrideManagerBase::AddEntityID(byte grf_local_id, uint32 grfid, byte su
*/
uint32 OverrideManagerBase::GetGRFID(uint16 entity_id) const
{
return mapping_ID[entity_id].grfid;
return this->mappings[entity_id].grfid;
}
/**
@ -166,7 +148,7 @@ uint32 OverrideManagerBase::GetGRFID(uint16 entity_id) const
*/
uint16 OverrideManagerBase::GetSubstituteID(uint16 entity_id) const
{
return mapping_ID[entity_id].substitute_id;
return this->mappings[entity_id].substitute_id;
}
/**
@ -178,7 +160,7 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs)
{
HouseID house_id = this->AddEntityID(hs->grf_prop.local_id, hs->grf_prop.grffile->grfid, hs->grf_prop.subst_id);
if (house_id == invalid_ID) {
if (house_id == this->invalid_id) {
grfmsg(1, "House.SetEntitySpec: Too many houses allocated. Ignoring.");
return;
}
@ -186,14 +168,14 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs)
MemCpyT(HouseSpec::Get(house_id), hs);
/* Now add the overrides. */
for (int i = 0; i != max_offset; i++) {
for (int i = 0; i < this->max_offset; i++) {
HouseSpec *overridden_hs = HouseSpec::Get(i);
if (entity_overrides[i] != hs->grf_prop.local_id || grfid_overrides[i] != hs->grf_prop.grffile->grfid) continue;
if (this->entity_overrides[i] != hs->grf_prop.local_id || this->grfid_overrides[i] != hs->grf_prop.grffile->grfid) continue;
overridden_hs->grf_prop.override = house_id;
entity_overrides[i] = invalid_ID;
grfid_overrides[i] = 0;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;
}
}
@ -206,14 +188,14 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs)
uint16 IndustryOverrideManager::GetID(uint8 grf_local_id, uint32 grfid) const
{
uint16 id = OverrideManagerBase::GetID(grf_local_id, grfid);
if (id != invalid_ID) return id;
if (id != this->invalid_id) return id;
/* No mapping found, try the overrides */
for (id = 0; id < max_offset; id++) {
if (entity_overrides[id] == grf_local_id && grfid_overrides[id] == grfid) return id;
for (id = 0; id < this->max_offset; id++) {
if (this->entity_overrides[id] == grf_local_id && this->grfid_overrides[id] == grfid) return id;
}
return invalid_ID;
return this->invalid_id;
}
/**
@ -226,9 +208,9 @@ uint16 IndustryOverrideManager::GetID(uint8 grf_local_id, uint32 grfid) const
uint16 IndustryOverrideManager::AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id)
{
/* This entity hasn't been defined before, so give it an ID now. */
for (uint16 id = 0; id < max_new_entities; id++) {
for (uint16 id = 0; id < this->max_entities; id++) {
/* Skip overridden industries */
if (id < max_offset && entity_overrides[id] != invalid_ID) continue;
if (id < this->max_offset && this->entity_overrides[id] != this->invalid_id) continue;
/* Get the real live industry */
const IndustrySpec *inds = GetIndustrySpec(id);
@ -237,7 +219,7 @@ uint16 IndustryOverrideManager::AddEntityID(byte grf_local_id, uint32 grfid, byt
* And it must not already be used by a grf (grffile == nullptr).
* So reserve this slot here, as it is the chosen one */
if (!inds->enabled && inds->grf_prop.grffile == nullptr) {
EntityIDMapping *map = &mapping_ID[id];
EntityIDMapping *map = &this->mappings[id];
if (map->entity_id == 0 && map->grfid == 0) {
/* winning slot, mark it as been used */
@ -249,7 +231,7 @@ uint16 IndustryOverrideManager::AddEntityID(byte grf_local_id, uint32 grfid, byt
}
}
return invalid_ID;
return this->invalid_id;
}
/**
@ -263,16 +245,16 @@ void IndustryOverrideManager::SetEntitySpec(IndustrySpec *inds)
/* First step : We need to find if this industry is already specified in the savegame data. */
IndustryType ind_id = this->GetID(inds->grf_prop.local_id, inds->grf_prop.grffile->grfid);
if (ind_id == invalid_ID) {
if (ind_id == this->invalid_id) {
/* Not found.
* Or it has already been overridden, so you've lost your place.
* Or it is a simple substitute.
* We need to find a free available slot */
ind_id = this->AddEntityID(inds->grf_prop.local_id, inds->grf_prop.grffile->grfid, inds->grf_prop.subst_id);
inds->grf_prop.override = invalid_ID; // make sure it will not be detected as overridden
inds->grf_prop.override = this->invalid_id; // make sure it will not be detected as overridden
}
if (ind_id == invalid_ID) {
if (ind_id == this->invalid_id) {
grfmsg(1, "Industry.SetEntitySpec: Too many industries allocated. Ignoring.");
return;
}
@ -287,7 +269,7 @@ void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its)
{
IndustryGfx indt_id = this->AddEntityID(its->grf_prop.local_id, its->grf_prop.grffile->grfid, its->grf_prop.subst_id);
if (indt_id == invalid_ID) {
if (indt_id == this->invalid_id) {
grfmsg(1, "IndustryTile.SetEntitySpec: Too many industry tiles allocated. Ignoring.");
return;
}
@ -295,15 +277,15 @@ void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its)
memcpy(&_industry_tile_specs[indt_id], its, sizeof(*its));
/* Now add the overrides. */
for (int i = 0; i < max_offset; i++) {
for (int i = 0; i < this->max_offset; i++) {
IndustryTileSpec *overridden_its = &_industry_tile_specs[i];
if (entity_overrides[i] != its->grf_prop.local_id || grfid_overrides[i] != its->grf_prop.grffile->grfid) continue;
if (this->entity_overrides[i] != its->grf_prop.local_id || this->grfid_overrides[i] != its->grf_prop.grffile->grfid) continue;
overridden_its->grf_prop.override = indt_id;
overridden_its->enabled = false;
entity_overrides[i] = invalid_ID;
grfid_overrides[i] = 0;
this->entity_overrides[i] = this->invalid_id;
this->grfid_overrides[i] = 0;
}
}
@ -318,7 +300,7 @@ void ObjectOverrideManager::SetEntitySpec(ObjectSpec *spec)
/* First step : We need to find if this object is already specified in the savegame data. */
ObjectType type = this->GetID(spec->grf_prop.local_id, spec->grf_prop.grffile->grfid);
if (type == invalid_ID) {
if (type == this->invalid_id) {
/* Not found.
* Or it has already been overridden, so you've lost your place.
* Or it is a simple substitute.
@ -326,7 +308,7 @@ void ObjectOverrideManager::SetEntitySpec(ObjectSpec *spec)
type = this->AddEntityID(spec->grf_prop.local_id, spec->grf_prop.grffile->grfid, OBJECT_TRANSMITTER);
}
if (type == invalid_ID) {
if (type == this->invalid_id) {
grfmsg(1, "Object.SetEntitySpec: Too many objects allocated. Ignoring.");
return;
}

@ -191,20 +191,20 @@ struct EntityIDMapping {
class OverrideManagerBase {
protected:
uint16 *entity_overrides;
uint32 *grfid_overrides;
std::vector<uint16> entity_overrides;
std::vector<uint32> grfid_overrides;
uint16 max_offset; ///< what is the length of the original entity's array of specs
uint16 max_new_entities; ///< what is the amount of entities, old and new summed
uint16 max_offset; ///< what is the length of the original entity's array of specs
uint16 max_entities; ///< what is the amount of entities, old and new summed
uint16 invalid_ID; ///< ID used to detected invalid entities;
uint16 invalid_id; ///< ID used to detected invalid entities;
virtual bool CheckValidNewID(uint16 testid) { return true; }
public:
EntityIDMapping *mapping_ID; ///< mapping of ids from grf files. Public out of convenience
std::vector<EntityIDMapping> mappings; ///< mapping of ids from grf files. Public out of convenience
OverrideManagerBase(uint16 offset, uint16 maximum, uint16 invalid);
virtual ~OverrideManagerBase();
virtual ~OverrideManagerBase() {}
void ResetOverride();
void ResetMapping();
@ -216,8 +216,8 @@ public:
uint16 GetSubstituteID(uint16 entity_id) const;
virtual uint16 GetID(uint8 grf_local_id, uint32 grfid) const;
inline uint16 GetMaxMapping() const { return max_new_entities; }
inline uint16 GetMaxOffset() const { return max_offset; }
inline uint16 GetMaxMapping() const { return this->max_entities; }
inline uint16 GetMaxOffset() const { return this->max_offset; }
};
@ -267,7 +267,7 @@ public:
struct AirportTileSpec;
class AirportTileOverrideManager : public OverrideManagerBase {
protected:
virtual bool CheckValidNewID(uint16 testid) { return testid != 0xFF; }
virtual bool CheckValidNewID(uint16 testid) override { return testid != 0xFF; }
public:
AirportTileOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) :
OverrideManagerBase(offset, maximum, invalid) {}
@ -278,7 +278,7 @@ public:
struct ObjectSpec;
class ObjectOverrideManager : public OverrideManagerBase {
protected:
virtual bool CheckValidNewID(uint16 testid) { return testid != 0xFF; }
virtual bool CheckValidNewID(uint16 testid) override { return testid != 0xFF; }
public:
ObjectOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) :
OverrideManagerBase(offset, maximum, invalid) {}

@ -30,11 +30,11 @@ static const SaveLoad _newgrf_mapping_desc[] = {
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
{
for (uint i = 0; i < mapping.GetMaxMapping(); i++) {
if (mapping.mapping_ID[i].grfid == 0 &&
mapping.mapping_ID[i].entity_id == 0) continue;
if (mapping.mappings[i].grfid == 0 &&
mapping.mappings[i].entity_id == 0) continue;
SlSetArrayIndex(i);
SlSetLength(4 + 1 + 1);
SlObjectSaveFiltered(&mapping.mapping_ID[i], _newgrf_mapping_desc); // _newgrf_mapping_desc has no conditionals
SlObjectSaveFiltered(const_cast<EntityIDMapping *>(&mapping.mappings[i]), _newgrf_mapping_desc); // _newgrf_mapping_desc has no conditionals
}
}
@ -53,7 +53,7 @@ void Load_NewGRFMapping(OverrideManagerBase &mapping)
int index;
while ((index = SlIterateArray()) != -1) {
if (unlikely((uint)index >= max_id)) SlErrorCorrupt("Too many NewGRF entity mappings");
SlObjectLoadFiltered(&mapping.mapping_ID[index], _newgrf_mapping_desc); // _newgrf_mapping_desc has no conditionals
SlObjectLoadFiltered(&mapping.mappings[index], _newgrf_mapping_desc); // _newgrf_mapping_desc has no conditionals
}
}

@ -34,10 +34,10 @@ void NewGRFMappingChunkHandler::Save() const
SlTableHeader(_newgrf_mapping_desc);
for (uint i = 0; i < this->mapping.GetMaxMapping(); i++) {
if (this->mapping.mapping_ID[i].grfid == 0 &&
this->mapping.mapping_ID[i].entity_id == 0) continue;
if (this->mapping.mappings[i].grfid == 0 &&
this->mapping.mappings[i].entity_id == 0) continue;
SlSetArrayIndex(i);
SlObject(&this->mapping.mapping_ID[i], _newgrf_mapping_desc);
SlObject(&this->mapping.mappings[i], _newgrf_mapping_desc);
}
}
@ -57,7 +57,7 @@ void NewGRFMappingChunkHandler::Load() const
int index;
while ((index = SlIterateArray()) != -1) {
if ((uint)index >= max_id) SlErrorCorrupt("Too many NewGRF entity mappings");
SlObject(&this->mapping.mapping_ID[index], slt);
SlObject(&this->mapping.mappings[index], slt);
}
}

@ -121,7 +121,6 @@ VERBATIM_HEADERS = NO
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
@ -151,7 +150,7 @@ LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO

@ -121,7 +121,6 @@ VERBATIM_HEADERS = NO
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
@ -151,7 +150,7 @@ LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO

@ -50,7 +50,7 @@ public:
* @param station_id The basestation to set the name of.
* @param name The new name of the station (can be either a raw string, or a ScriptText object).
* @pre IsValidBaseStation(station_id).
* @pre name != nullptr && len(name) != 0.
* @pre name != null && len(name) != 0.
* @game @pre Valid ScriptCompanyMode active in scope.
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
* @return True if the name was changed.

@ -5,7 +5,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file script_clientlist.hpp List all the TODO. */
/** @file script_clientlist.hpp List all the clients in a game or in a company. */
#ifndef SCRIPT_CLIENTLIST_HPP
#define SCRIPT_CLIENTLIST_HPP
@ -32,7 +32,7 @@ public:
class ScriptClientList_Company : public ScriptList {
public:
/**
* @param company_id The company to list clients for.
* @param company The company to list clients for.
*/
ScriptClientList_Company(ScriptCompany::CompanyID company);
};

@ -138,7 +138,7 @@ public:
/**
* Set the name of your company.
* @param name The new name of the company (can be either a raw string, or a ScriptText object).
* @pre name != nullptr && len(name) != 0.
* @pre name != null && len(name) != 0.
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
* @return True if the name was changed.
*/
@ -155,7 +155,7 @@ public:
/**
* Set the name of your president.
* @param name The new name of the president (can be either a raw string, or a ScriptText object).
* @pre name != nullptr && len(name) != 0.
* @pre name != null && len(name) != 0.
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
* @return True if the name was changed.
*/

@ -61,6 +61,7 @@ public:
/**
* Constructor of ScriptEvent, to get the type of event.
* @param type The type of event to construct.
*/
ScriptEvent(ScriptEvent::ScriptEventType type) :
type(type)

@ -33,6 +33,7 @@ public:
CRASH_FLOODED, ///< Vehicle was flooded
};
#ifndef DOXYGEN_API
/**
* @param vehicle The vehicle that crashed.
* @param crash_site Where the vehicle crashed.
@ -44,6 +45,7 @@ public:
vehicle(vehicle),
crash_reason(crash_reason)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -82,6 +84,7 @@ private:
*/
class ScriptEventSubsidyOffer : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param subsidy_id The index of this subsidy in the _subsidies array.
*/
@ -89,6 +92,7 @@ public:
ScriptEvent(ET_SUBSIDY_OFFER),
subsidy_id(subsidy_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -113,6 +117,7 @@ private:
*/
class ScriptEventSubsidyOfferExpired : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param subsidy_id The index of this subsidy in the _subsidies array.
*/
@ -120,6 +125,7 @@ public:
ScriptEvent(ET_SUBSIDY_OFFER_EXPIRED),
subsidy_id(subsidy_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -144,6 +150,7 @@ private:
*/
class ScriptEventSubsidyAwarded : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param subsidy_id The index of this subsidy in the _subsidies array.
*/
@ -151,6 +158,7 @@ public:
ScriptEvent(ET_SUBSIDY_AWARDED),
subsidy_id(subsidy_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -175,6 +183,7 @@ private:
*/
class ScriptEventSubsidyExpired : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param subsidy_id The index of this subsidy in the _subsidies array.
*/
@ -182,6 +191,7 @@ public:
ScriptEvent(ET_SUBSIDY_EXPIRED),
subsidy_id(subsidy_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -208,6 +218,7 @@ private:
*/
class ScriptEventEnginePreview : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param engine The engine offered to test.
*/
@ -215,6 +226,7 @@ public:
ScriptEvent(ET_ENGINE_PREVIEW),
engine(engine)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -297,6 +309,7 @@ private:
*/
class ScriptEventCompanyNew : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param owner The new company.
*/
@ -304,6 +317,7 @@ public:
ScriptEvent(ET_COMPANY_NEW),
owner((ScriptCompany::CompanyID)owner)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -329,6 +343,7 @@ private:
*/
class ScriptEventCompanyInTrouble : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param owner The company that is in trouble.
*/
@ -336,6 +351,7 @@ public:
ScriptEvent(ET_COMPANY_IN_TROUBLE),
owner((ScriptCompany::CompanyID)owner)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -360,6 +376,7 @@ private:
*/
class ScriptEventCompanyAskMerger : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param owner The company that can be bought.
* @param value The value/costs of buying the company.
@ -369,6 +386,7 @@ public:
owner((ScriptCompany::CompanyID)owner),
value(value)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -408,6 +426,7 @@ private:
*/
class ScriptEventCompanyMerger : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param old_owner The company bought off.
* @param new_owner The company that bought owner.
@ -417,6 +436,7 @@ public:
old_owner((ScriptCompany::CompanyID)old_owner),
new_owner((ScriptCompany::CompanyID)new_owner)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -451,6 +471,7 @@ private:
*/
class ScriptEventCompanyBankrupt : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param owner The company that has gone bankrupt.
*/
@ -458,6 +479,7 @@ public:
ScriptEvent(ET_COMPANY_BANKRUPT),
owner((ScriptCompany::CompanyID)owner)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -482,6 +504,7 @@ private:
*/
class ScriptEventVehicleLost : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param vehicle_id The vehicle that is lost.
*/
@ -489,6 +512,7 @@ public:
ScriptEvent(ET_VEHICLE_LOST),
vehicle_id(vehicle_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -513,6 +537,7 @@ private:
*/
class ScriptEventVehicleWaitingInDepot : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param vehicle_id The vehicle that is waiting in a depot.
*/
@ -520,6 +545,7 @@ public:
ScriptEvent(ET_VEHICLE_WAITING_IN_DEPOT),
vehicle_id(vehicle_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -544,6 +570,7 @@ private:
*/
class ScriptEventVehicleUnprofitable : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param vehicle_id The vehicle that was unprofitable.
*/
@ -551,6 +578,7 @@ public:
ScriptEvent(ET_VEHICLE_UNPROFITABLE),
vehicle_id(vehicle_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -575,6 +603,7 @@ private:
*/
class ScriptEventIndustryOpen : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param industry_id The new industry.
*/
@ -582,6 +611,7 @@ public:
ScriptEvent(ET_INDUSTRY_OPEN),
industry_id(industry_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -606,6 +636,7 @@ private:
*/
class ScriptEventIndustryClose : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param industry_id The new industry.
*/
@ -613,6 +644,7 @@ public:
ScriptEvent(ET_INDUSTRY_CLOSE),
industry_id(industry_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -637,6 +669,7 @@ private:
*/
class ScriptEventEngineAvailable : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param engine The engine that is available.
*/
@ -644,6 +677,7 @@ public:
ScriptEvent(ET_ENGINE_AVAILABLE),
engine(engine)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -668,6 +702,7 @@ private:
*/
class ScriptEventStationFirstVehicle : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param station The station visited for the first time.
* @param vehicle The vehicle visiting the station.
@ -677,6 +712,7 @@ public:
station(station),
vehicle(vehicle)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -708,6 +744,7 @@ private:
*/
class ScriptEventDisasterZeppelinerCrashed : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param station The station containing the affected airport
*/
@ -715,6 +752,7 @@ public:
ScriptEvent(ET_DISASTER_ZEPPELINER_CRASHED),
station(station)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -739,6 +777,7 @@ private:
*/
class ScriptEventDisasterZeppelinerCleared : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param station The station containing the affected airport
*/
@ -746,6 +785,7 @@ public:
ScriptEvent(ET_DISASTER_ZEPPELINER_CLEARED),
station(station)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -770,6 +810,7 @@ private:
*/
class ScriptEventTownFounded : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param town The town that was created.
*/
@ -777,6 +818,7 @@ public:
ScriptEvent(ET_TOWN_FOUNDED),
town(town)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -803,6 +845,7 @@ private:
*/
class ScriptEventAircraftDestTooFar : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param vehicle_id The aircraft whose destination is too far away.
*/
@ -810,6 +853,7 @@ public:
ScriptEvent(ET_AIRCRAFT_DEST_TOO_FAR),
vehicle_id(vehicle_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -834,10 +878,12 @@ private:
*/
class ScriptEventAdminPort : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param json The JSON string which got sent.
*/
ScriptEventAdminPort(const std::string &json);
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -846,10 +892,19 @@ public:
*/
static ScriptEventAdminPort *Convert(ScriptEvent *instance) { return (ScriptEventAdminPort *)instance; }
#ifndef DOXYGEN_API
/**
* Get the information that was sent to you back as Squirrel object.
* The GetObject() wrapper from Squirrel.
*/
SQInteger GetObject(HSQUIRRELVM vm);
#else
/**
* Get the information that was sent to you back as Squirrel object.
* @return The object.
*/
SQObject GetObject();
#endif /* DOXYGEN_API */
private:
std::string json; ///< The JSON string.
@ -882,6 +937,7 @@ private:
*/
class ScriptEventWindowWidgetClick : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param window The windowclass that was clicked.
* @param number The windownumber that was clicked.
@ -893,6 +949,7 @@ public:
number(number),
widget(widget)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -903,16 +960,19 @@ public:
/**
* Get the class of the window that was clicked.
* @return The clicked window class.
*/
ScriptWindow::WindowClass GetWindowClass() { return this->window; }
/**
* Get the number of the window that was clicked.
* @return The clicked identifying number of the widget within the class.
*/
uint32 GetWindowNumber() { return this->number; }
/**
* Get the number of the widget that was clicked.
* @return The number of the clicked widget.
*/
uint8 GetWidgetNumber() { return this->widget; }
@ -930,6 +990,7 @@ private:
*/
class ScriptEventGoalQuestionAnswer : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param uniqueid The uniqueID you have given this question.
* @param company The company that is replying.
@ -941,6 +1002,7 @@ public:
company(company),
button(button)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -951,16 +1013,19 @@ public:
/**
* Get the unique id of the question.
* @return The unique id.
*/
uint16 GetUniqueID() { return this->uniqueid; }
/**
* Get the company that pressed a button.
* @return The company.
*/
ScriptCompany::CompanyID GetCompany() { return this->company; }
/**
* Get the button that got pressed.
* @return The button.
*/
ScriptGoal::QuestionButton GetButton() { return this->button; }
@ -976,6 +1041,7 @@ private:
*/
class ScriptEventCompanyTown : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param event The eventtype.
* @param company The company.
@ -986,6 +1052,7 @@ public:
company(company),
town(town)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1018,6 +1085,7 @@ private:
*/
class ScriptEventExclusiveTransportRights : public ScriptEventCompanyTown {
public:
#ifndef DOXYGEN_API
/**
* @param company The company.
* @param town The town.
@ -1025,6 +1093,7 @@ public:
ScriptEventExclusiveTransportRights(ScriptCompany::CompanyID company, TownID town) :
ScriptEventCompanyTown(ET_EXCLUSIVE_TRANSPORT_RIGHTS, company, town)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1041,6 +1110,7 @@ public:
*/
class ScriptEventRoadReconstruction : public ScriptEventCompanyTown {
public:
#ifndef DOXYGEN_API
/**
* @param company The company.
* @param town The town.
@ -1048,6 +1118,7 @@ public:
ScriptEventRoadReconstruction(ScriptCompany::CompanyID company, TownID town) :
ScriptEventCompanyTown(ET_ROAD_RECONSTRUCTION, company, town)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1063,6 +1134,7 @@ public:
*/
class ScriptEventVehicleAutoReplaced : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param old_id The vehicle that has been replaced.
* @param new_id The vehicle that has been created in replacement.
@ -1072,6 +1144,7 @@ public:
old_id(old_id),
new_id(new_id)
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1103,6 +1176,7 @@ private:
*/
class ScriptEventStoryPageButtonClick : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param company_id Which company triggered the event.
* @param page_id Which page was the clicked button on.
@ -1113,7 +1187,8 @@ public:
company_id((ScriptCompany::CompanyID)company_id),
page_id(page_id),
element_id(element_id)
{ }
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1122,13 +1197,22 @@ public:
*/
static ScriptEventStoryPageButtonClick *Convert(ScriptEvent *instance) { return (ScriptEventStoryPageButtonClick *)instance; }
/** Get the CompanyID of the player that selected a tile. */
/**
* Get the CompanyID of the player that selected a tile.
* @return The ID of the company.
*/
ScriptCompany::CompanyID GetCompanyID() { return this->company_id; }
/** Get the StoryPageID of the storybook page the clicked button is located on. */
/**
* Get the StoryPageID of the storybook page the clicked button is located on.
* @return The ID of the page in the story book the click was on.
*/
StoryPageID GetStoryPageID() { return this->page_id; }
/** Get the StoryPageElementID of the button element that was clicked. */
/**
* Get the StoryPageElementID of the button element that was clicked.
* @return The ID of the element that was clicked.
*/
StoryPageElementID GetElementID() { return this->element_id; }
private:
@ -1143,6 +1227,7 @@ private:
*/
class ScriptEventStoryPageTileSelect : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param company_id Which company triggered the event.
* @param page_id Which page is the used selection button on.
@ -1155,7 +1240,8 @@ public:
page_id(page_id),
element_id(element_id),
tile_index(tile_index)
{ }
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1164,16 +1250,28 @@ public:
*/
static ScriptEventStoryPageTileSelect *Convert(ScriptEvent *instance) { return (ScriptEventStoryPageTileSelect *)instance; }
/** Get the CompanyID of the player that selected a tile. */
/**
* Get the CompanyID of the player that selected a tile.
* @return The company that selected the tile.
*/
ScriptCompany::CompanyID GetCompanyID() { return this->company_id; }
/** Get the StoryPageID of the storybook page the used selection button is located on. */
/**
* Get the StoryPageID of the storybook page the used selection button is located on.
* @return The ID of the story page selection was done from.
*/
StoryPageID GetStoryPageID() { return this->page_id; }
/** Get the StoryPageElementID of the selection button used to select the tile. */
/**
* Get the StoryPageElementID of the selection button used to select the tile.
* @return The ID of the element that was used to select the tile.
*/
StoryPageElementID GetElementID() { return this->element_id; }
/** Get the TileIndex of the tile the player selected */
/**
* Get the TileIndex of the tile the player selected.
* @return The selected tile.
*/
TileIndex GetTile() { return this->tile_index; }
private:
@ -1189,6 +1287,7 @@ private:
*/
class ScriptEventStoryPageVehicleSelect : public ScriptEvent {
public:
#ifndef DOXYGEN_API
/**
* @param company_id Which company triggered the event.
* @param page_id Which page is the used selection button on.
@ -1201,7 +1300,8 @@ public:
page_id(page_id),
element_id(element_id),
vehicle_id(vehicle_id)
{ }
{}
#endif /* DOXYGEN_API */
/**
* Convert an ScriptEvent to the real instance.
@ -1210,16 +1310,28 @@ public:
*/
static ScriptEventStoryPageVehicleSelect *Convert(ScriptEvent *instance) { return (ScriptEventStoryPageVehicleSelect *)instance; }
/** Get the CompanyID of the player that selected a tile. */
/**
* Get the CompanyID of the player that selected a tile.
* @return The company's ID.
*/
ScriptCompany::CompanyID GetCompanyID() { return this->company_id; }
/** Get the StoryPageID of the storybook page the used selection button is located on. */
/**
* Get the StoryPageID of the storybook page the used selection button is located on.
* @return The ID of the storybook page the selected element is on.
*/
StoryPageID GetStoryPageID() { return this->page_id; }
/** Get the StoryPageElementID of the selection button used to select the vehicle. */
/**
* Get the StoryPageElementID of the selection button used to select the vehicle.
* @return The ID of the selected element of the story page.
*/
StoryPageElementID GetElementID() { return this->element_id; }
/** Get the VehicleID of the vehicle the player selected */
/**
* Get the VehicleID of the vehicle the player selected.
* @return The ID of the vehicle.
*/
VehicleID GetVehicleID() { return this->vehicle_id; }
private:

@ -53,6 +53,7 @@ public:
/**
* Get the current landscape.
* @return The type of landscape.
*/
static LandscapeType GetLandscape();

@ -97,7 +97,7 @@ public:
* @param destination The destination of the \a type type.
* @return The new GoalID, or GOAL_INVALID if it failed.
* @pre No ScriptCompanyMode may be in scope.
* @pre goal != nullptr && len(goal) != 0.
* @pre goal != null && len(goal) != 0.
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
* @pre if type is GT_STORY_PAGE, the company of the goal and the company of the story page need to match:
* \li Global goals can only reference global story pages.
@ -120,7 +120,7 @@ public:
* @param goal The new goal text (can be either a raw string, or a ScriptText object).
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
* @pre goal != nullptr && len(goal) != 0.
* @pre goal != null && len(goal) != 0.
* @pre IsValidGoal(goal_id).
*/
static bool SetText(GoalID goal_id, Text *goal);
@ -131,7 +131,7 @@ public:
* the progress string short.
* @param goal_id The goal to update.
* @param progress The new progress text for the goal (can be either a raw string,
* or a ScriptText object). To clear the progress string you can pass nullptr or an
* or a ScriptText object). To clear the progress string you can pass null or an
* empty string.
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
@ -167,7 +167,7 @@ public:
* @param buttons Any combinations (at least 1, up to 3) of buttons defined in QuestionButton. Like BUTTON_YES + BUTTON_NO.
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
* @pre question != nullptr && len(question) != 0.
* @pre question != null && len(question) != 0.
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
* @pre CountBits(buttons) >= 1 && CountBits(buttons) <= 3.
* @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer.
@ -185,7 +185,7 @@ public:
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
* @pre ScriptGame::IsMultiplayer()
* @pre question != nullptr && len(question) != 0.
* @pre question != null && len(question) != 0.
* @pre ResolveClientID(client) != CLIENT_INVALID.
* @pre CountBits(buttons) >= 1 && CountBits(buttons) <= 3.
* @note Replies to the question are given by you via the event ScriptEvent_GoalQuestionAnswer.

@ -69,7 +69,7 @@ public:
* @param group_id The group to set the name for.
* @param name The name for the group (can be either a raw string, or a ScriptText object).
* @pre IsValidGroup(group_id).
* @pre name != nullptr && len(name) != 0
* @pre name != null && len(name) != 0
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
* @return True if and only if the name was changed.
*/
@ -232,6 +232,7 @@ public:
* @param group_id The group id to set the colour of.
* @param colour Colour to set.
* @pre IsValidGroup(group_id).
* @return True iff the colour was set successfully.
*/
static bool SetPrimaryColour(GroupID group_id, ScriptCompany::Colours colour);
@ -240,6 +241,7 @@ public:
* @param group_id The group id to set the colour of.
* @param colour Colour to set.
* @pre IsValidGroup(group_id).
* @return True iff the colour was set successfully.
*/
static bool SetSecondaryColour(GroupID group_id, ScriptCompany::Colours colour);
@ -247,6 +249,7 @@ public:
* Get primary colour of a group.
* @param group_id The group id to get the colour of.
* @pre IsValidGroup(group_id).
* @return The primary colour of the group.
*/
static ScriptCompany::Colours GetPrimaryColour(GroupID group_id);
@ -254,6 +257,7 @@ public:
* Get secondary colour for a group.
* @param group_id The group id to get the colour of.
* @pre IsValidGroup(group_id).
* @return The secondary colour of the group.
*/
static ScriptCompany::Colours GetSecondaryColour(GroupID group_id);
};

@ -184,7 +184,7 @@ public:
/**
* Get a specific industry-type from a grf.
* @param grf_id The ID of the NewGRF.
* @param grfid The ID of the NewGRF.
* @param grf_local_id The ID of the industry, local to the NewGRF.
* @pre 0x00 <= grf_local_id < NUM_INDUSTRYTYPES_PER_GRF.
* @return the industry-type ID, local to the current game (this diverges from the grf_local_id).

@ -68,9 +68,11 @@ public:
/**
* Create a new league table.
* @param title League table title (can be either a raw string, or ScriptText object).
* @param header The optional header text for the table (null is allowed).
* @param footer The optional footer text for the table (null is allowed).
* @return The new LeagueTableID, or LEAGUE_TABLE_INVALID if it failed.
* @pre No ScriptCompanyMode may be in scope.
* @pre title != nullptr && len(title) != 0.
* @pre title != null && len(title) != 0.
*/
static LeagueTableID New(Text *title, Text *header, Text *footer);
@ -86,8 +88,8 @@ public:
* @return The new LeagueTableElementID, or LEAGUE_TABLE_ELEMENT_INVALID if it failed.
* @pre No ScriptCompanyMode may be in scope.
* @pre IsValidLeagueTable(table).
* @pre text != nullptr && len(text) != 0.
* @pre score != nullptr && len(score) != 0.
* @pre text != null && len(text) != 0.
* @pre score != null && len(score) != 0.
* @pre IsValidLink(Link(link_type, link_target)).
*/
static LeagueTableElementID NewElement(LeagueTableID table, int64 rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, LinkTargetID link_target);
@ -102,7 +104,7 @@ public:
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
* @pre IsValidLeagueTableElement(element).
* @pre text != nullptr && len(text) != 0.
* @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);
@ -115,7 +117,7 @@ public:
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
* @pre IsValidLeagueTableElement(element).
* @pre score != nullptr && len(score) != 0.
* @pre score != null && len(score) != 0.
*/
static bool UpdateElementScore(LeagueTableElementID element, int64 rating, Text *score);

@ -196,7 +196,7 @@ public:
/**
* Remove everything that is in the given list from this list (same item index that is).
* @param list the list of items to remove.
* @pre list != nullptr
* @pre list != null
*/
void RemoveList(ScriptList *list);
@ -240,7 +240,7 @@ public:
/**
* Keeps everything that is in the given list from this list (same item index that is).
* @param list the list of items to keep.
* @pre list != nullptr
* @pre list != null
*/
void KeepList(ScriptList *list);

@ -48,7 +48,7 @@ public:
* Get the name of a loaded NewGRF.
* @param grfid The NewGRF to query.
* @pre ScriptNewGRF::IsLoaded(grfid).
* @return The name of the NewGRF or nullptr if no name is defined.
* @return The name of the NewGRF or null if no name is defined.
*/
static char *GetName(uint32 grfid);
};

@ -59,7 +59,7 @@ public:
* - For #NR_TOWN this parameter should be a valid townID (ScriptTown::IsValidTown).
* @return True if the action succeeded.
* @pre type must be #NT_ECONOMY, #NT_SUBSIDIES, or #NT_GENERAL.
* @pre text != nullptr.
* @pre text != null.
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
* @pre The \a reference condition must be fulfilled.
*/

@ -55,7 +55,7 @@ public:
/**
* Get a specific object-type from a grf.
* @param grf_id The ID of the NewGRF.
* @param grfid The ID of the NewGRF.
* @param grf_local_id The ID of the object, local to the NewGRF.
* @pre 0x00 <= grf_local_id < NUM_OBJECTS_PER_GRF.
* @return the object-type ID, local to the current game (this diverges from the grf_local_id).

@ -61,6 +61,7 @@ public:
/**
* Check if an items is already included in the queue.
* @param item The item to check whether it's already in this queue.
* @return true if the items is already in the queue.
* @note Performance is O(n), use only when absolutely required.
*/

@ -160,7 +160,7 @@ public:
/**
* Check if a road vehicle built for a road type can run on another road type.
* @param engine_road_type The road type the road vehicle is built for.
* @param track_road_type The road type you want to check.
* @param road_road_type The road type you want to check.
* @pre ScriptRoad::IsRoadTypeAvailable(engine_road_type).
* @pre ScriptRoad::IsRoadTypeAvailable(road_road_type).
* @return Whether a road vehicle built for 'engine_road_type' can run on 'road_road_type'.
@ -405,7 +405,6 @@ public:
* one-way in the other direction, it's made a 'no'-way road (it's
* forbidden to enter the tile from any direction).
* @param start The start tile of the road.
* @param start The start tile of the road.
* @param end The end tile of the road.
* @pre 'start' is not equal to 'end'.
* @pre ScriptMap::IsValidTile(start).

@ -43,7 +43,7 @@ public:
* @param sign_id The sign to set the name for.
* @param name The name for the sign (can be either a raw string, or a ScriptText object).
* @pre IsValidSign(sign_id).
* @pre name != nullptr && len(name) != 0.
* @pre name != null && len(name) != 0.
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
* @return True if and only if the name was changed.
*/
@ -79,7 +79,7 @@ public:
* @param location The place to build the sign.
* @param name The text to place on the sign (can be either a raw string, or a ScriptText object).
* @pre ScriptMap::IsValidTile(location).
* @pre name != nullptr && len(name) != 0.
* @pre name != null && len(name) != 0.
* @exception ScriptSign::ERR_SIGN_TOO_MANY_SIGNS
* @return The SignID of the build sign (use IsValidSign() to check for validity).
* In test-mode it returns 0 if successful, or any other value to indicate

@ -202,7 +202,7 @@ public:
* @return The new StoryPageElementID, or STORY_PAGE_ELEMENT_INVALID if it failed.
* @pre No ScriptCompanyMode may be in scope.
* @pre IsValidStoryPage(story_page).
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != nullptr && len(text) != 0).
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != null && len(text) != 0).
* @pre type != SPET_LOCATION || ScriptMap::IsValidTile(reference).
* @pre type != SPET_GOAL || ScriptGoal::IsValidGoal(reference).
* @pre if type is SPET_GOAL and story_page is a global page, then referenced goal must be global.
@ -217,7 +217,7 @@ public:
* @return True if the action succeeded.
* @pre No ScriptCompanyMode may be in scope.
* @pre IsValidStoryPage(story_page).
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != nullptr && len(text) != 0).
* @pre (type != SPET_TEXT && type != SPET_LOCATION) || (text != null && len(text) != 0).
* @pre type != SPET_LOCATION || ScriptMap::IsValidTile(reference).
* @pre type != SPET_GOAL || ScriptGoal::IsValidGoal(reference).
* @pre if type is SPET_GOAL and story_page is a global page, then referenced goal must be global.
@ -315,6 +315,7 @@ public:
/**
* Create a reference value for SPET_BUTTON_PUSH element parameters.
* @param colour The colour for the face of the button.
* @param flags The formatting and layout flags for the button.
* @return A reference value usable with the #NewElement and #UpdateElement functions.
*/
static StoryPageButtonFormatting MakePushButtonReference(StoryPageButtonColour colour, StoryPageButtonFlags flags);
@ -322,6 +323,7 @@ public:
/**
* Create a reference value for SPET_BUTTON_TILE element parameters.
* @param colour The colour for the face of the button.
* @param flags The formatting and layout flags for the button.
* @param cursor The mouse cursor to use when the player clicks the button and the game is ready for the player to select a tile.
* @return A reference value usable with the #NewElement and #UpdateElement functions.
*/
@ -330,6 +332,7 @@ public:
/**
* Create a reference value for SPET_BUTTON_VEHICLE element parameters.
* @param colour The colour for the face of the button.
* @param flags The formatting and layout flags for the button.
* @param cursor The mouse cursor to use when the player clicks the button and the game is ready for the player to select a vehicle.
* @param vehtype The type of vehicle that will be selectable, or \c VT_INVALID to allow all types.
* @return A reference value usable with the #NewElement and #UpdateElement functions.

@ -400,7 +400,7 @@ public:
* @param size The town size of the new town.
* @param city True if the new town should be a city.
* @param layout The town layout of the new town.
* @param name The name of the new town. Pass nullptr to use a random town name.
* @param name The name of the new town. Pass null to use a random town name.
* @game @pre no company mode in scope || ScriptSettings.GetValue("economy.found_town") != 0.
* @ai @pre ScriptSettings.GetValue("economy.found_town") != 0.
* @game @pre no company mode in scope || size != TOWN_SIZE_LARGE.

@ -113,7 +113,7 @@ public:
* @param vehicle_id The vehicle to set the name for.
* @param name The name for the vehicle (can be either a raw string, or a ScriptText object).
* @pre IsValidVehicle(vehicle_id).
* @pre name != nullptr && len(name) != 0.
* @pre name != null && len(name) != 0.
* @game @pre Valid ScriptCompanyMode active in scope.
* @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
* @return True if and only if the name was changed.

@ -35,6 +35,7 @@ public:
* @param tile The tile to put in the center of the screen.
* @pre ScriptObject::GetCompany() == OWNER_DEITY
* @pre ScriptMap::IsValidTile(tile)
* @return True iff the command was executed successfully.
*/
static bool ScrollEveryoneTo(TileIndex tile);
@ -46,6 +47,7 @@ public:
* @pre ScriptObject::GetCompany() == OWNER_DEITY
* @pre ScriptMap::IsValidTile(tile)
* @pre ResolveCompanyID(company) != COMPANY_INVALID
* @return True iff the command was executed successfully.
*/
static bool ScrollCompanyClientsTo(ScriptCompany::CompanyID company, TileIndex tile);
@ -58,6 +60,7 @@ public:
* @pre ScriptObject::GetCompany() == OWNER_DEITY
* @pre ScriptMap::IsValidTile(tile)
* @pre ResolveClientID(client) != CLIENT_INVALID
* @return True iff the command was executed successfully.
*/
static bool ScrollClientTo(ScriptClient::ClientID client, TileIndex tile);
};

@ -468,13 +468,9 @@ void VideoDriver_Allegro::InputLoop()
_ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG) != _invert_ctrl;
_shift_pressed = !!(key_shifts & KB_SHIFT_FLAG) != _invert_shift;
#if defined(_DEBUG)
this->fast_forward_key_pressed = _shift_pressed;
#else
/* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */
this->fast_forward_key_pressed = key[KEY_TAB] && (key_shifts & KB_ALT_FLAG) == 0;
#endif
/* Determine which directional keys are down. */
_dirkeys =

@ -484,11 +484,7 @@ void VideoDriver_Cocoa::InputLoop()
_ctrl_pressed = ((cur_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSEventModifierFlagControl : NSEventModifierFlagCommand)) != 0) != _invert_ctrl;
_shift_pressed = ((cur_mods & NSEventModifierFlagShift) != 0) != _invert_shift;
#if defined(_DEBUG)
this->fast_forward_key_pressed = _shift_pressed;
#else
this->fast_forward_key_pressed = _tab_is_down;
#endif
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
if (old_shift_pressed != _shift_pressed) HandleShiftChanged();

@ -916,13 +916,9 @@ void VideoDriver_SDL_Base::InputLoop()
_ctrl_pressed = !!(mod & KMOD_CTRL) != _invert_ctrl;
_shift_pressed = !!(mod & KMOD_SHIFT) != _invert_shift;
#if defined(_DEBUG)
this->fast_forward_key_pressed = _shift_pressed;
#else
/* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */
this->fast_forward_key_pressed = keys[SDL_SCANCODE_TAB] && (mod & KMOD_ALT) == 0;
#endif /* defined(_DEBUG) */
/* Determine which directional keys are down. */
_dirkeys =

@ -632,13 +632,9 @@ void VideoDriver_SDL::InputLoop()
_ctrl_pressed = !!(mod & KMOD_CTRL) != _invert_ctrl;
_shift_pressed = !!(mod & KMOD_SHIFT) != _invert_shift;
#if defined(_DEBUG)
this->fast_forward_key_pressed = _shift_pressed;
#else
/* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */
this->fast_forward_key_pressed = keys[SDLK_TAB] && (mod & KMOD_ALT) == 0;
#endif /* defined(_DEBUG) */
/* Determine which directional keys are down. */
_dirkeys =

@ -850,13 +850,9 @@ void VideoDriver_Win32Base::InputLoop()
_ctrl_pressed = (this->has_focus && GetAsyncKeyState(VK_CONTROL) < 0) != _invert_ctrl;
_shift_pressed = (this->has_focus && GetAsyncKeyState(VK_SHIFT) < 0) != _invert_shift;
#if defined(_DEBUG)
this->fast_forward_key_pressed = _shift_pressed;
#else
/* Speedup when pressing tab, except when using ALT+TAB
* to switch to another application. */
this->fast_forward_key_pressed = this->has_focus && GetAsyncKeyState(VK_TAB) < 0 && GetAsyncKeyState(VK_MENU) >= 0;
#endif
/* Determine which directional keys are down. */
if (this->has_focus) {

@ -12,6 +12,7 @@
#include "command_func.h"
#include "viewport_func.h"
#include "slope_func.h"
#include "water.h"
#include "table/strings.h"
#include "table/sprites.h"
@ -53,7 +54,8 @@ static void GetTileDesc_Void(TileIndex tile, TileDesc *td)
static void TileLoop_Void(TileIndex tile)
{
/* not used */
/* Floods adjacent edge tile to prevent maps without water. */
TileLoop_Water(tile);
}
static void ChangeTileOwner_Void(TileIndex tile, Owner old_owner, Owner new_owner)

@ -1164,6 +1164,9 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
case MP_OBJECT:
return (GetObjectGroundType(tile) == OBJECT_GROUND_SHORE ? FLOOD_DRYUP : ((GetWaterClass(tile) == WATER_CLASS_SEA) ? FLOOD_ACTIVE : FLOOD_NONE));
case MP_VOID:
return FLOOD_ACTIVE;
default:
return FLOOD_NONE;
}
@ -1353,7 +1356,7 @@ void TileLoop_Water(TileIndex tile)
Slope slope_here = GetFoundationSlope(tile) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
for (uint dir : SetBitIterator(_flood_from_dirs[slope_here])) {
TileIndex dest = tile + TileOffsByDir((Direction)dir);
if (!IsValidTile(dest)) continue;
if (dest >= MapSize()) continue;
FloodingBehaviour dest_behaviour = GetFloodingBehaviour(dest);
if ((dest_behaviour == FLOOD_ACTIVE) || (dest_behaviour == FLOOD_PASSIVE)) return;
@ -1392,7 +1395,7 @@ void ConvertGroundTilesIntoWaterTiles()
for (uint dir : SetBitIterator(_flood_from_dirs[slope & ~SLOPE_STEEP])) {
TileIndex dest = TileAddByDir(tile, (Direction)dir);
Slope slope_dest = GetTileSlope(dest) & ~SLOPE_STEEP;
if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) {
if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest) || IsTileType(dest, MP_VOID)) {
MakeShore(tile);
break;
}

Loading…
Cancel
Save