mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-07 06:39:08 +00:00
(svn r19623) [1.0] -Backport from trunk:
- Fix: Company related graphs were not updated correctly after changing the company colour [FS#3763] (r19615) - Fix: Crash when opening a savegame with a waypoint from around 0.4.0 [FS#3756] (r19612) - Fix: Presence of online content was not properly updated after download due to duplicate slashes in the path (r19600) - Fix: [NewGRF] Setting industry prop 0x24 to 0 caused empty station names (r19590)
This commit is contained in:
parent
9ed75d3ab7
commit
ba8422354b
@ -1027,6 +1027,7 @@ function Regression::RailTypeList()
|
|||||||
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
|
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
|
||||||
print(" RailType: " + i);
|
print(" RailType: " + i);
|
||||||
print(" IsRailTypeAvailable(): " + AIRail.IsRailTypeAvailable(i));
|
print(" IsRailTypeAvailable(): " + AIRail.IsRailTypeAvailable(i));
|
||||||
|
print(" GetMaxSpeed(): " + AIRail.GetMaxSpeed(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7208,6 +7208,7 @@ ERROR: HasNext() is invalid as Begin() is never called
|
|||||||
ListDump:
|
ListDump:
|
||||||
RailType: 0
|
RailType: 0
|
||||||
IsRailTypeAvailable(): true
|
IsRailTypeAvailable(): true
|
||||||
|
GetMaxSpeed(): 0
|
||||||
|
|
||||||
--Road--
|
--Road--
|
||||||
Road
|
Road
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
* functions may still be available if you return an older API version
|
* functions may still be available if you return an older API version
|
||||||
* in GetAPIVersion() in info.nut.
|
* in GetAPIVersion() in info.nut.
|
||||||
*
|
*
|
||||||
|
* \b 1.0.1
|
||||||
|
*
|
||||||
|
* API additions:
|
||||||
|
* \li AIRail::GetMaxSpeed
|
||||||
|
*
|
||||||
* \b 1.0.0
|
* \b 1.0.0
|
||||||
*
|
*
|
||||||
* API additions:
|
* API additions:
|
||||||
|
@ -469,3 +469,10 @@ static bool IsValidSignalType(int signal_type)
|
|||||||
default: return -1;
|
default: return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ int32 AIRail::GetMaxSpeed(RailType railtype)
|
||||||
|
{
|
||||||
|
if (!AIRail::IsRailTypeAvailable(railtype)) return -1;
|
||||||
|
|
||||||
|
return ::GetRailTypeInfo((::RailType)railtype)->max_speed;
|
||||||
|
}
|
||||||
|
@ -440,6 +440,18 @@ public:
|
|||||||
* @return The baseprice of building the given object.
|
* @return The baseprice of building the given object.
|
||||||
*/
|
*/
|
||||||
static Money GetBuildCost(RailType railtype, BuildType build_type);
|
static Money GetBuildCost(RailType railtype, BuildType build_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the maximum speed of trains running on this railtype.
|
||||||
|
* @param railtype The railtype to get the maximum speed of.
|
||||||
|
* @pre IsRailTypeAvailable(railtype)
|
||||||
|
* @return The maximum speed trains can run on this railtype
|
||||||
|
* or 0 if there is no limit.
|
||||||
|
* @note The speed is in OpenTTD's internal speed unit.
|
||||||
|
* This is mph / 1.6, which is roughly km/h.
|
||||||
|
* To get km/h multiply this number by 1.00584.
|
||||||
|
*/
|
||||||
|
static int32 GetMaxSpeed(RailType railtype);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AI_RAIL_HPP */
|
#endif /* AI_RAIL_HPP */
|
||||||
|
@ -106,6 +106,7 @@ void SQAIRail_Register(Squirrel *engine)
|
|||||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal, "BuildSignal", 4, ".iii");
|
SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal, "BuildSignal", 4, ".iii");
|
||||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal, "RemoveSignal", 3, ".ii");
|
SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal, "RemoveSignal", 3, ".ii");
|
||||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetBuildCost, "GetBuildCost", 3, ".ii");
|
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetBuildCost, "GetBuildCost", 3, ".ii");
|
||||||
|
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
|
||||||
|
|
||||||
SQAIRail.PostRegister(engine);
|
SQAIRail.PostRegister(engine);
|
||||||
}
|
}
|
||||||
|
@ -965,6 +965,13 @@ CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
|||||||
ResetVehicleColourMap();
|
ResetVehicleColourMap();
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
|
|
||||||
|
/* All graph related to companies use the company colour. */
|
||||||
|
InvalidateWindowData(WC_INCOME_GRAPH, 0);
|
||||||
|
InvalidateWindowData(WC_OPERATING_PROFIT, 0);
|
||||||
|
InvalidateWindowData(WC_DELIVERED_CARGO, 0);
|
||||||
|
InvalidateWindowData(WC_PERFORMANCE_HISTORY, 0);
|
||||||
|
InvalidateWindowData(WC_COMPANY_VALUE, 0);
|
||||||
|
|
||||||
/* Company colour data is indirectly cached. */
|
/* Company colour data is indirectly cached. */
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -528,7 +528,7 @@ public:
|
|||||||
|
|
||||||
virtual void OnInvalidateData(int data)
|
virtual void OnInvalidateData(int data)
|
||||||
{
|
{
|
||||||
this->OnTick();
|
this->UpdateStatistics(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -604,6 +604,7 @@ void ClientNetworkContentSocketHandler::OnReceiveData(const char *data, size_t l
|
|||||||
|
|
||||||
p = strrchr(str, '/');
|
p = strrchr(str, '/');
|
||||||
check_not_null(p);
|
check_not_null(p);
|
||||||
|
p++; // Start after the '/'
|
||||||
|
|
||||||
char tmp[MAX_PATH];
|
char tmp[MAX_PATH];
|
||||||
if (strecpy(tmp, p, lastof(tmp)) == lastof(tmp)) {
|
if (strecpy(tmp, p, lastof(tmp)) == lastof(tmp)) {
|
||||||
|
@ -2636,7 +2636,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
|
|||||||
|
|
||||||
case 0x24: // name for nearby station
|
case 0x24: // name for nearby station
|
||||||
indsp->station_name = buf->ReadWord();
|
indsp->station_name = buf->ReadWord();
|
||||||
_string_to_grf_mapping[&indsp->station_name] = _cur_grffile->grfid;
|
if (indsp->station_name != STR_NULL) _string_to_grf_mapping[&indsp->station_name] = _cur_grffile->grfid;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -70,7 +70,12 @@ void MoveWaypointsToBaseStations()
|
|||||||
* waypoint struct. */
|
* waypoint struct. */
|
||||||
if (CheckSavegameVersion(17)) {
|
if (CheckSavegameVersion(17)) {
|
||||||
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
|
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
|
||||||
if (wp->delete_ctr == 0 && HasBit(_m[wp->xy].m3, 4)) {
|
if (wp->delete_ctr != 0) continue; // The waypoint was deleted
|
||||||
|
|
||||||
|
/* Waypoint indices were not added to the map prior to this. */
|
||||||
|
_m[wp->xy].m2 = wp->index;
|
||||||
|
|
||||||
|
if (HasBit(_m[wp->xy].m3, 4)) {
|
||||||
wp->spec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
|
wp->spec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user