(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:
rubidium 2010-04-13 21:32:29 +00:00
parent 9ed75d3ab7
commit ba8422354b
11 changed files with 43 additions and 3 deletions

View File

@ -1027,6 +1027,7 @@ function Regression::RailTypeList()
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
print(" RailType: " + i);
print(" IsRailTypeAvailable(): " + AIRail.IsRailTypeAvailable(i));
print(" GetMaxSpeed(): " + AIRail.GetMaxSpeed(i));
}
}

View File

@ -7208,6 +7208,7 @@ ERROR: HasNext() is invalid as Begin() is never called
ListDump:
RailType: 0
IsRailTypeAvailable(): true
GetMaxSpeed(): 0
--Road--
Road

View File

@ -14,6 +14,11 @@
* functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut.
*
* \b 1.0.1
*
* API additions:
* \li AIRail::GetMaxSpeed
*
* \b 1.0.0
*
* API additions:

View File

@ -469,3 +469,10 @@ static bool IsValidSignalType(int signal_type)
default: return -1;
}
}
/* static */ int32 AIRail::GetMaxSpeed(RailType railtype)
{
if (!AIRail::IsRailTypeAvailable(railtype)) return -1;
return ::GetRailTypeInfo((::RailType)railtype)->max_speed;
}

View File

@ -440,6 +440,18 @@ public:
* @return The baseprice of building the given object.
*/
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 */

View File

@ -106,6 +106,7 @@ void SQAIRail_Register(Squirrel *engine)
SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal, "BuildSignal", 4, ".iii");
SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal, "RemoveSignal", 3, ".ii");
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetBuildCost, "GetBuildCost", 3, ".ii");
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
SQAIRail.PostRegister(engine);
}

View File

@ -965,6 +965,13 @@ CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1,
ResetVehicleColourMap();
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. */
Vehicle *v;
FOR_ALL_VEHICLES(v) {

View File

@ -528,7 +528,7 @@ public:
virtual void OnInvalidateData(int data)
{
this->OnTick();
this->UpdateStatistics(true);
}
/**

View File

@ -604,6 +604,7 @@ void ClientNetworkContentSocketHandler::OnReceiveData(const char *data, size_t l
p = strrchr(str, '/');
check_not_null(p);
p++; // Start after the '/'
char tmp[MAX_PATH];
if (strecpy(tmp, p, lastof(tmp)) == lastof(tmp)) {

View File

@ -2636,7 +2636,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
case 0x24: // name for nearby station
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;
default:

View File

@ -70,7 +70,12 @@ void MoveWaypointsToBaseStations()
* waypoint struct. */
if (CheckSavegameVersion(17)) {
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);
}
}