mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
(svn r14135) -Codechange: Add owner to waypoints. Previously, it was guessed from rail underneath it.
This commit is contained in:
parent
f625ecbeba
commit
7dc212edeb
@ -131,101 +131,6 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
|
|
||||||
IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="MASM AMD64"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/openttd.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="..\objs\langs"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
AssemblerListingLocation="$(IntDir)/"
|
|
||||||
ObjectFile="$(IntDir)/"
|
|
||||||
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
|
|
||||||
WarningLevel="3"
|
|
||||||
WarnAsError="false"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
Detect64BitPortabilityProblems="false"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
CallingConvention="1"
|
|
||||||
CompileAs="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1053"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
|
|
||||||
LinkIncremental="0"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
IgnoreDefaultLibraryNames="LIBCMT.lib"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="2"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
|
||||||
@ -338,6 +243,101 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
|
||||||
|
IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="MASM AMD64"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TypeLibraryName=".\Debug/openttd.tlb"
|
||||||
|
HeaderFileName=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\objs\langs"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
AssemblerListingLocation="$(IntDir)/"
|
||||||
|
ObjectFile="$(IntDir)/"
|
||||||
|
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
|
||||||
|
WarningLevel="3"
|
||||||
|
WarnAsError="false"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CallingConvention="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1053"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
|
||||||
|
LinkIncremental="0"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
IgnoreDefaultLibraryNames="LIBCMT.lib;LIBC.lib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
|
||||||
@ -539,6 +539,10 @@
|
|||||||
RelativePath=".\..\src\engine.cpp"
|
RelativePath=".\..\src\engine.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\..\src\fiber_win32.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\fileio.cpp"
|
RelativePath=".\..\src\fileio.cpp"
|
||||||
>
|
>
|
||||||
@ -735,10 +739,6 @@
|
|||||||
RelativePath=".\..\src\thread_win32.cpp"
|
RelativePath=".\..\src\thread_win32.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\..\src\fiber_win32.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\..\src\tile_map.cpp"
|
RelativePath=".\..\src\tile_map.cpp"
|
||||||
>
|
>
|
||||||
@ -2623,14 +2623,6 @@
|
|||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
ExcludedFromBuild="true"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
>
|
>
|
||||||
@ -2640,6 +2632,14 @@
|
|||||||
PreservePublicAndExternSymbolCase="true"
|
PreservePublicAndExternSymbolCase="true"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
>
|
>
|
||||||
|
@ -2516,6 +2516,15 @@ bool AfterLoadGame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Give owners to waypoints, based on rail tracks it is sitting on.
|
||||||
|
* If none is available, specify OWNER_NONE */
|
||||||
|
Waypoint *wp;
|
||||||
|
Owner owner;
|
||||||
|
FOR_ALL_WAYPOINTS(wp) {
|
||||||
|
owner = GetTileOwner(wp->xy);
|
||||||
|
wp->owner = IsValidPlayerID(owner) ? owner : OWNER_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GamelogPrintDebug(1);
|
GamelogPrintDebug(1);
|
||||||
|
@ -442,7 +442,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
if (!IsValidWaypointID(new_order.GetDestination())) return CMD_ERROR;
|
if (!IsValidWaypointID(new_order.GetDestination())) return CMD_ERROR;
|
||||||
const Waypoint *wp = GetWaypoint(new_order.GetDestination());
|
const Waypoint *wp = GetWaypoint(new_order.GetDestination());
|
||||||
|
|
||||||
if (!CheckOwnership(GetTileOwner(wp->xy))) return CMD_ERROR;
|
if (!CheckOwnership(wp->owner)) return CMD_ERROR;
|
||||||
|
|
||||||
/* Order flags can be any of the following for waypoints:
|
/* Order flags can be any of the following for waypoints:
|
||||||
* [non-stop]
|
* [non-stop]
|
||||||
|
@ -1182,7 +1182,7 @@ void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type)
|
|||||||
void ShowVehicleListWindow(const Waypoint *wp)
|
void ShowVehicleListWindow(const Waypoint *wp)
|
||||||
{
|
{
|
||||||
if (wp == NULL) return;
|
if (wp == NULL) return;
|
||||||
ShowVehicleListWindowLocal(GetTileOwner(wp->xy), VLW_WAYPOINT_LIST, VEH_TRAIN, wp->index);
|
ShowVehicleListWindowLocal(wp->owner, VLW_WAYPOINT_LIST, VEH_TRAIN, wp->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowVehicleListWindow(const Vehicle *v)
|
void ShowVehicleListWindow(const Vehicle *v)
|
||||||
|
@ -207,7 +207,8 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
|
|||||||
return_cmd_error(STR_1005_NO_SUITABLE_RAILROAD_TRACK);
|
return_cmd_error(STR_1005_NO_SUITABLE_RAILROAD_TRACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CheckTileOwnership(tile)) return CMD_ERROR;
|
Owner owner = GetTileOwner(tile);
|
||||||
|
if (!CheckOwnership(owner)) return CMD_ERROR;
|
||||||
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
|
||||||
|
|
||||||
tileh = GetTileSlope(tile, NULL);
|
tileh = GetTileSlope(tile, NULL);
|
||||||
@ -230,6 +231,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
|
|||||||
wp->town_index = INVALID_TOWN;
|
wp->town_index = INVALID_TOWN;
|
||||||
wp->name = NULL;
|
wp->name = NULL;
|
||||||
wp->town_cn = 0;
|
wp->town_cn = 0;
|
||||||
|
wp->owner = owner;
|
||||||
} else {
|
} else {
|
||||||
/* Move existing (recently deleted) waypoint to the new location */
|
/* Move existing (recently deleted) waypoint to the new location */
|
||||||
|
|
||||||
@ -252,7 +254,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
|
|||||||
const StationSpec* statspec;
|
const StationSpec* statspec;
|
||||||
|
|
||||||
bool reserved = HasBit(GetTrackReservation(tile), AxisToTrack(axis));
|
bool reserved = HasBit(GetTrackReservation(tile), AxisToTrack(axis));
|
||||||
MakeRailWaypoint(tile, GetTileOwner(tile), axis, GetRailType(tile), wp->index);
|
MakeRailWaypoint(tile, owner, axis, GetRailType(tile), wp->index);
|
||||||
SetDepotWaypointReservation(tile, reserved);
|
SetDepotWaypointReservation(tile, reserved);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
|
|
||||||
@ -316,7 +318,6 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
|
|||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
Track track = GetRailWaypointTrack(tile);
|
Track track = GetRailWaypointTrack(tile);
|
||||||
Owner owner = GetTileOwner(tile); // cannot use _current_player because of possible floods
|
|
||||||
wp = GetWaypointByTile(tile);
|
wp = GetWaypointByTile(tile);
|
||||||
|
|
||||||
wp->deleted = 30; // let it live for this many days before we do the actual deletion.
|
wp->deleted = 30; // let it live for this many days before we do the actual deletion.
|
||||||
@ -326,7 +327,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
|
|||||||
if (justremove) {
|
if (justremove) {
|
||||||
TrackBits tracks = GetRailWaypointBits(tile);
|
TrackBits tracks = GetRailWaypointBits(tile);
|
||||||
bool reserved = GetDepotWaypointReservation(tile);
|
bool reserved = GetDepotWaypointReservation(tile);
|
||||||
MakeRailNormal(tile, GetTileOwner(tile), tracks, GetRailType(tile));
|
MakeRailNormal(tile, wp->owner, tracks, GetRailType(tile));
|
||||||
if (reserved) SetTrackReservation(tile, tracks);
|
if (reserved) SetTrackReservation(tile, tracks);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
} else {
|
} else {
|
||||||
@ -335,7 +336,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
|
|||||||
if (v != NULL) FreeTrainTrackReservation(v);
|
if (v != NULL) FreeTrainTrackReservation(v);
|
||||||
}
|
}
|
||||||
DoClearSquare(tile);
|
DoClearSquare(tile);
|
||||||
AddTrackToSignalBuffer(tile, track, owner);
|
AddTrackToSignalBuffer(tile, track, wp->owner);
|
||||||
}
|
}
|
||||||
YapfNotifyTrackLayoutChange(tile, track);
|
YapfNotifyTrackLayoutChange(tile, track);
|
||||||
if (v != NULL) TryPathReserve(v, true);
|
if (v != NULL) TryPathReserve(v, true);
|
||||||
@ -505,6 +506,7 @@ static const SaveLoad _waypoint_desc[] = {
|
|||||||
SLE_CONDVAR(Waypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION),
|
SLE_CONDVAR(Waypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Waypoint, localidx, SLE_UINT8, 3, SL_MAX_VERSION),
|
SLE_CONDVAR(Waypoint, localidx, SLE_UINT8, 3, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Waypoint, grfid, SLE_UINT32, 17, SL_MAX_VERSION),
|
SLE_CONDVAR(Waypoint, grfid, SLE_UINT32, 17, SL_MAX_VERSION),
|
||||||
|
SLE_CONDVAR(Waypoint, owner, SLE_UINT8, 101, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,7 @@ struct Waypoint : PoolItem<Waypoint, WaypointID, &_Waypoint_pool> {
|
|||||||
|
|
||||||
ViewportSign sign; ///< Dimensions of sign (not saved)
|
ViewportSign sign; ///< Dimensions of sign (not saved)
|
||||||
Date build_date; ///< Date of construction
|
Date build_date; ///< Date of construction
|
||||||
|
Owner owner; ///< Whom this waypoint belongs to
|
||||||
|
|
||||||
byte stat_id; ///< ID of waypoint within the waypoint class (not saved)
|
byte stat_id; ///< ID of waypoint within the waypoint class (not saved)
|
||||||
uint32 grfid; ///< ID of GRF file
|
uint32 grfid; ///< ID of GRF file
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
WaypointWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
|
WaypointWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
|
||||||
{
|
{
|
||||||
this->wp = GetWaypoint(this->window_number);
|
this->wp = GetWaypoint(this->window_number);
|
||||||
this->caption_color = (byte)GetTileOwner(this->wp->xy);
|
this->caption_color = this->wp->owner;
|
||||||
|
|
||||||
this->flags4 |= WF_DISABLE_VP_SCROLL;
|
this->flags4 |= WF_DISABLE_VP_SCROLL;
|
||||||
InitializeWindowViewport(this, 3, 17, 254, 86, this->wp->xy, ZOOM_LVL_MIN);
|
InitializeWindowViewport(this, 3, 17, 254, 86, this->wp->xy, ZOOM_LVL_MIN);
|
||||||
@ -48,7 +48,7 @@ public:
|
|||||||
virtual void OnPaint()
|
virtual void OnPaint()
|
||||||
{
|
{
|
||||||
/* You can only change your own waypoints */
|
/* You can only change your own waypoints */
|
||||||
this->SetWidgetDisabledState(WAYPVW_RENAME, !CheckTileOwnership(this->wp->xy));
|
this->SetWidgetDisabledState(WAYPVW_RENAME, !CheckOwnership(this->wp->owner));
|
||||||
SetDParam(0, this->wp->index);
|
SetDParam(0, this->wp->index);
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user