Changeset - r27329:1364086648b8
[Not reviewed]
master
0 2 0
Peter Nelson - 15 months ago 2023-03-30 08:34:26
peter1138@openttd.org
Revert 8fa61533: "Fix 30ae072: when a road type is hidden, towns may not build them even when that flag is set"

This reverts commit 8fa61533f041b16497282107afa600e919ba7154.
2 files changed with 10 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/road.cpp
Show inline comments
 
@@ -112,7 +112,14 @@ bool HasRoadTypeAvail(const CompanyID co
 
{
 
	if (company == OWNER_DEITY || company == OWNER_TOWN || _game_mode == GM_EDITOR || _generating_world) {
 
		const RoadTypeInfo *rti = GetRoadTypeInfo(roadtype);
 
		return rti->label != 0 && (rti->flags & ROTFB_HIDDEN) == 0;
 
		if (rti->label == 0) return false;
 

	
 
		/*
 
		 * Do not allow building hidden road types, except when a town may build it.
 
		 * The GS under deity mode, as well as anybody in the editor builds roads that are
 
		 * owned by towns. So if a town may build it, it should be buildable by them too.
 
		 */
 
		return (rti->flags & ROTFB_HIDDEN) == 0 || (rti->flags & ROTFB_TOWN_BUILD) != 0;
 
	} else {
 
		const Company *c = Company::GetIfValid(company);
 
		if (c == nullptr) return false;
src/road.h
Show inline comments
 
@@ -39,14 +39,14 @@ enum RoadTypeFlags {
 
	ROTF_NO_LEVEL_CROSSING,                                ///< Bit number for disabling level crossing
 
	ROTF_NO_HOUSES,                                        ///< Bit number for setting this roadtype as not house friendly
 
	ROTF_HIDDEN,                                           ///< Bit number for hidden from construction.
 
	ROTF_TOWN_BUILD,                                       ///< Bit number for allowing towns to build this roadtype. Does not override ROTF_HIDDEN.
 
	ROTF_TOWN_BUILD,                                       ///< Bit number for allowing towns to build this roadtype.
 

	
 
	ROTFB_NONE = 0,                                        ///< All flags cleared.
 
	ROTFB_CATENARY          = 1 << ROTF_CATENARY,          ///< Value for drawing a catenary.
 
	ROTFB_NO_LEVEL_CROSSING = 1 << ROTF_NO_LEVEL_CROSSING, ///< Value for disabling a level crossing.
 
	ROTFB_NO_HOUSES         = 1 << ROTF_NO_HOUSES,         ///< Value for for setting this roadtype as not house friendly.
 
	ROTFB_HIDDEN            = 1 << ROTF_HIDDEN,            ///< Value for hidden from construction.
 
	ROTFB_TOWN_BUILD        = 1 << ROTF_TOWN_BUILD,        ///< Value for allowing towns to build this roadtype. Does not override ROTFB_HIDDEN.
 
	ROTFB_TOWN_BUILD        = 1 << ROTF_TOWN_BUILD,        ///< Value for allowing towns to build this roadtype.
 
};
 
DECLARE_ENUM_AS_BIT_SET(RoadTypeFlags)
 

	
0 comments (0 inline, 0 general)