summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--projects/openttd_vs80.vcproj112
-rw-r--r--src/openttd.cpp9
-rw-r--r--src/order_cmd.cpp2
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/waypoint.cpp12
-rw-r--r--src/waypoint.h1
-rw-r--r--src/waypoint_gui.cpp4
7 files changed, 77 insertions, 65 deletions
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index 074018085..dece8997e 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -132,14 +132,15 @@
/>
</Configuration>
<Configuration
- Name="Debug|Win32"
- OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
- IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
+ Name="Release|x64"
+ OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
+ WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -158,25 +159,39 @@
/>
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\Debug/openttd.tlb"
+ TargetEnvironment="3"
+ TypeLibraryName=".\Release/openttd.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="2"
+ OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
+ StringPooling="true"
+ ExceptionHandling="1"
+ RuntimeLibrary="0"
+ StructMemberAlignment="0"
+ BufferSecurityCheck="false"
+ EnableFunctionLevelLinking="true"
+ DefaultCharIsUnsigned="true"
UsePrecompiledHeader="0"
+ PrecompiledHeaderThrough=""
+ PrecompiledHeaderFile=""
+ AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
+ BrowseInformation="1"
+ BrowseInformationFile="$(IntDir)/"
WarningLevel="3"
WarnAsError="false"
SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
+ DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"
/>
@@ -185,7 +200,7 @@
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
+ PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
@@ -194,12 +209,14 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
- LinkIncremental="0"
+ LinkIncremental="1"
SuppressStartupBanner="true"
- IgnoreDefaultLibraryNames="LIBCMT.lib"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
- TargetMachine="1"
+ OptimizeReferences="2"
+ OptimizeForWindows98="1"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
@@ -227,15 +244,14 @@
/>
</Configuration>
<Configuration
- Name="Release|x64"
- OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
+ Name="Debug|Win32"
+ OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
+ IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
- WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -254,39 +270,25 @@
/>
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
- TypeLibraryName=".\Release/openttd.tlb"
+ TypeLibraryName=".\Debug/openttd.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="2"
- OmitFramePointers="true"
+ Optimization="0"
AdditionalIncludeDirectories="..\objs\langs"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
- StringPooling="true"
- ExceptionHandling="1"
- RuntimeLibrary="0"
- StructMemberAlignment="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- DefaultCharIsUnsigned="true"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
UsePrecompiledHeader="0"
- PrecompiledHeaderThrough=""
- PrecompiledHeaderFile=""
- AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
- BrowseInformation="1"
- BrowseInformationFile="$(IntDir)/"
WarningLevel="3"
WarnAsError="false"
SuppressStartupBanner="true"
- DebugInformationFormat="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
CallingConvention="1"
CompileAs="0"
/>
@@ -295,7 +297,7 @@
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
+ PreprocessorDefinitions="_DEBUG"
Culture="1053"
/>
<Tool
@@ -304,14 +306,12 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
- LinkIncremental="1"
+ LinkIncremental="0"
SuppressStartupBanner="true"
- IgnoreDefaultLibraryNames=""
+ IgnoreDefaultLibraryNames="LIBCMT.lib;LIBC.lib"
GenerateDebugInformation="true"
SubSystem="2"
- OptimizeReferences="2"
- OptimizeForWindows98="1"
- TargetMachine="17"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
@@ -540,6 +540,10 @@
>
</File>
<File
+ RelativePath=".\..\src\fiber_win32.cpp"
+ >
+ </File>
+ <File
RelativePath=".\..\src\fileio.cpp"
>
</File>
@@ -736,10 +740,6 @@
>
</File>
<File
- RelativePath=".\..\src\fiber_win32.cpp"
- >
- </File>
- <File
RelativePath=".\..\src\tile_map.cpp"
>
</File>
@@ -2624,20 +2624,20 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
+ Name="Release|x64"
>
<Tool
- Name="VCCustomBuildTool"
+ Name="MASM AMD64"
+ PreserveIdentifierCase="true"
+ PreservePublicAndExternSymbolCase="true"
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|x64"
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
>
<Tool
- Name="MASM AMD64"
- PreserveIdentifierCase="true"
- PreservePublicAndExternSymbolCase="true"
+ Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
diff --git a/src/openttd.cpp b/src/openttd.cpp
index dbc1ebaeb..95551dbb5 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -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);
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index b71fbc8c1..814d819b4 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -442,7 +442,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!IsValidWaypointID(new_order.GetDestination())) return CMD_ERROR;
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:
* [non-stop]
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 55f254532..821b15413 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1182,7 +1182,7 @@ void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type)
void ShowVehicleListWindow(const Waypoint *wp)
{
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)
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index 58dd92a9c..7343b9317 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -207,7 +207,8 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
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;
tileh = GetTileSlope(tile, NULL);
@@ -230,6 +231,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
wp->town_index = INVALID_TOWN;
wp->name = NULL;
wp->town_cn = 0;
+ wp->owner = owner;
} else {
/* 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;
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);
MarkTileDirtyByTile(tile);
@@ -316,7 +318,6 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
if (flags & DC_EXEC) {
Track track = GetRailWaypointTrack(tile);
- Owner owner = GetTileOwner(tile); // cannot use _current_player because of possible floods
wp = GetWaypointByTile(tile);
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) {
TrackBits tracks = GetRailWaypointBits(tile);
bool reserved = GetDepotWaypointReservation(tile);
- MakeRailNormal(tile, GetTileOwner(tile), tracks, GetRailType(tile));
+ MakeRailNormal(tile, wp->owner, tracks, GetRailType(tile));
if (reserved) SetTrackReservation(tile, tracks);
MarkTileDirtyByTile(tile);
} else {
@@ -335,7 +336,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove)
if (v != NULL) FreeTrainTrackReservation(v);
}
DoClearSquare(tile);
- AddTrackToSignalBuffer(tile, track, owner);
+ AddTrackToSignalBuffer(tile, track, wp->owner);
}
YapfNotifyTrackLayoutChange(tile, track);
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, localidx, SLE_UINT8, 3, 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()
};
diff --git a/src/waypoint.h b/src/waypoint.h
index ee664e605..1d0e64ca4 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -25,6 +25,7 @@ struct Waypoint : PoolItem<Waypoint, WaypointID, &_Waypoint_pool> {
ViewportSign sign; ///< Dimensions of sign (not saved)
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)
uint32 grfid; ///< ID of GRF file
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index 1f1b81f15..75d9d4798 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -37,7 +37,7 @@ public:
WaypointWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, 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;
InitializeWindowViewport(this, 3, 17, 254, 86, this->wp->xy, ZOOM_LVL_MIN);
@@ -48,7 +48,7 @@ public:
virtual void OnPaint()
{
/* 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);
this->DrawWidgets();