Merge branch 'master' into jgrpp

# Conflicts:
#	src/aircraft_cmd.cpp
#	src/autoreplace_cmd.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_rail.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.cpp
#	src/script/api/ai/ai_station.hpp.sq
#	src/script/api/game/game_station.hpp.sq
#	src/script/api/script_station.hpp
#	src/track_func.h
#	src/vehicle_base.h
This commit is contained in:
Jonathan G Rennison
2018-11-05 12:53:36 +00:00
208 changed files with 1329 additions and 686 deletions

View File

@@ -91,25 +91,25 @@ bool IsHangar(TileIndex t)
}
/**
* Look for a station around the given tile area.
* Look for a station owned by the given company around the given tile area.
* @param ta the area to search over
* @param closest_station the closest station found so far
* @param closest_station the closest owned station found so far
* @param company the company whose stations to look for
* @param st to 'return' the found station
* @return Succeeded command (if zero or one station found) or failed command (for two or more stations found).
*/
template <class T>
CommandCost GetStationAround(TileArea ta, StationID closest_station, T **st)
CommandCost GetStationAround(TileArea ta, StationID closest_station, CompanyID company, T **st)
{
ta.tile -= TileDiffXY(1, 1);
ta.w += 2;
ta.h += 2;
/* check around to see if there's any stations there */
/* check around to see if there are any stations there owned by the company */
TILE_AREA_LOOP(tile_cur, ta) {
if (IsTileType(tile_cur, MP_STATION)) {
StationID t = GetStationIndex(tile_cur);
if (!T::IsValidID(t)) continue;
if (!T::IsValidID(t) || Station::Get(t)->owner != company) continue;
if (closest_station == INVALID_STATION) {
closest_station = t;
} else if (closest_station != t) {
@@ -664,7 +664,7 @@ static void UpdateStationSignCoord(BaseStation *st)
/**
* Common part of building various station parts and possibly attaching them to an existing one.
* @param [in,out] st Station to attach to
* @param[in,out] st Station to attach to
* @param flags Command flags
* @param reuse Whether to try to reuse a deleted station (gray sign) if possible
* @param area Area occupied by the new part
@@ -678,7 +678,7 @@ static CommandCost BuildStationPart(Station **st, DoCommandFlag flags, bool reus
if (*st != NULL) {
if ((*st)->owner != _current_company) {
return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION);
return_cmd_error(CMD_ERROR);
}
CommandCost ret = (*st)->rect.BeforeAddRect(area.tile, area.w, area.h, StationRect::ADD_TEST);
@@ -1139,8 +1139,8 @@ CommandCost FindJoiningBaseStation(StationID existing_station, StationID station
}
if (check_surrounding) {
/* Make sure there are no similar stations around us. */
CommandCost ret = GetStationAround(ta, existing_station, st);
/* Make sure there is no more than one other station around us that is owned by us. */
CommandCost ret = GetStationAround(ta, existing_station, _current_company, st);
if (ret.Failed()) return ret;
}
@@ -2789,9 +2789,9 @@ const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx)
* Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a rail overlay.
* If the ground sprite is suitable, \a ground is replaced with the new non-track ground sprite, and \a overlay_offset
* is set to the overlay to draw.
* @param ti Positional info for the tile to decide snowyness etc. May be NULL.
* @param [in,out] ground Groundsprite to draw.
* @param [out] overlay_offset Overlay to draw.
* @param ti Positional info for the tile to decide snowyness etc. May be NULL.
* @param[in,out] ground Groundsprite to draw.
* @param[out] overlay_offset Overlay to draw.
* @return true if overlay can be drawn.
*/
bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset)