Changeset - r28491:779a44bc4e9e
[Not reviewed]
master
0 11 0
Patric Stout - 11 months ago 2024-01-16 19:38:42
truebrain@openttd.org
Codechange: switch our codebase to C++20
11 files changed with 18 insertions and 18 deletions:
0 comments (0 inline, 0 general)
.github/workflows/ci-build.yml
Show inline comments
 
@@ -74,12 +74,12 @@ jobs:
 
      matrix:
 
        include:
 
        - name: Clang - Debug
 
          compiler: clang
 
          cxxcompiler: clang++
 
          compiler: clang-15
 
          cxxcompiler: clang++-15
 
          libraries: libsdl2-dev
 
        - name: Clang - Release
 
          compiler: clang
 
          cxxcompiler: clang++
 
          compiler: clang-15
 
          cxxcompiler: clang++-15
 
          libraries: libsdl2-dev
 
          extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
 
        - name: GCC - SDL2
CMakeLists.txt
Show inline comments
 
@@ -42,7 +42,7 @@ set_directory_options()
 
include(Static)
 
set_static_if_needed()
 

	
 
set(CMAKE_CXX_STANDARD 17)
 
set(CMAKE_CXX_STANDARD 20)
 
set(CMAKE_CXX_STANDARD_REQUIRED YES)
 
set(CMAKE_CXX_EXTENSIONS NO)
 

	
src/blitter/32bpp_anim_sse4.cpp
Show inline comments
 
@@ -31,7 +31,7 @@ static FBlitter_32bppSSE4_Anim iFBlitter
 
IGNORE_UNINITIALIZED_WARNING_START
 
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent, bool animated>
 
GNU_TARGET("sse4.1")
 
inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
 
inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom)
 
{
 
	const byte * const remap = bp->remap;
 
	Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
src/direction_func.h
Show inline comments
 
@@ -71,7 +71,7 @@ inline DirDiff DirDifference(Direction d
 
	assert(IsValidDirection(d1));
 
	/* Cast to uint so compiler can use bitmask. If the difference is negative
 
	 * and we used int instead of uint, further "+ 8" would have to be added. */
 
	return (DirDiff)((uint)(d0 - d1) % 8);
 
	return static_cast<DirDiff>(static_cast<uint>(d0) - static_cast<uint>(d1) % 8);
 
}
 

	
 
/**
 
@@ -88,7 +88,7 @@ inline DirDiff DirDifference(Direction d
 
inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta)
 
{
 
	/* Cast to uint so compiler can use bitmask. Result can never be negative. */
 
	return (DirDiff)((uint)(d + delta) % 8);
 
	return static_cast<DirDiff>((static_cast<uint>(d) + static_cast<uint>(delta)) % 8);
 
}
 

	
 
/**
 
@@ -105,7 +105,7 @@ inline Direction ChangeDir(Direction d, 
 
{
 
	assert(IsValidDirection(d));
 
	/* Cast to uint so compiler can use bitmask. Result can never be negative. */
 
	return (Direction)((uint)(d + delta) % 8);
 
	return static_cast<Direction>((static_cast<uint>(d) + static_cast<uint>(delta)) % 8);
 
}
 

	
 

	
 
@@ -150,7 +150,7 @@ inline DiagDirection ChangeDiagDir(DiagD
 
{
 
	assert(IsValidDiagDirection(d));
 
	/* Cast to uint so compiler can use bitmask. Result can never be negative. */
 
	return (DiagDirection)((uint)(d + delta) % 4);
 
	return static_cast<DiagDirection>((static_cast<uint>(d) + static_cast<uint>(delta)) % 4);
 
}
 

	
 
/**
src/fileio_type.h
Show inline comments
 
@@ -89,7 +89,7 @@ enum FiosType {
 
 */
 
inline AbstractFileType GetAbstractFileType(FiosType fios_type)
 
{
 
	return static_cast<AbstractFileType>(fios_type & FT_MASK);
 
	return static_cast<AbstractFileType>(static_cast<uint>(fios_type) & FT_MASK);
 
}
 

	
 
/**
src/script/api/script_rail.cpp
Show inline comments
 
@@ -250,7 +250,7 @@
 
	EnforceCompanyModeValid(false);
 
	EnforcePrecondition(false, ::IsValidTile(tile));
 
	EnforcePrecondition(false, rail_track != 0);
 
	EnforcePrecondition(false, (rail_track & ~::TRACK_BIT_ALL) == 0);
 
	EnforcePrecondition(false, (static_cast<uint>(rail_track) & ~static_cast<uint>(::TRACK_BIT_ALL)) == 0);
 
	EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
 
	EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
 

	
src/script/api/script_station.cpp
Show inline comments
 
@@ -203,7 +203,7 @@ template<bool Tfrom, bool Tvia>
 
	if (!IsValidStation(station_id)) return false;
 
	if (!HasExactlyOneBit(station_type)) return false;
 

	
 
	return (::Station::Get(station_id)->facilities & station_type) != 0;
 
	return (::Station::Get(station_id)->facilities & static_cast<StationFacility>(station_type)) != 0;
 
}
 

	
 
/* static */ bool ScriptStation::HasRoadType(StationID station_id, ScriptRoad::RoadType road_type)
src/script/api/script_stationlist.cpp
Show inline comments
 
@@ -23,7 +23,7 @@ ScriptStationList::ScriptStationList(Scr
 
	CompanyID owner = ScriptObject::GetCompany();
 
	ScriptList::FillList<Station>(this,
 
		[is_deity, owner, station_type](const Station *st) {
 
			return (is_deity || st->owner == owner) && (st->facilities & station_type) != 0;
 
			return (is_deity || st->owner == owner) && (st->facilities & static_cast<StationFacility>(station_type)) != 0;
 
		}
 
	);
 
}
src/script/api/script_waypoint.cpp
Show inline comments
 
@@ -34,5 +34,5 @@
 
	if (!IsValidWaypoint(waypoint_id)) return false;
 
	if (!HasExactlyOneBit(waypoint_type)) return false;
 

	
 
	return (::Waypoint::Get(waypoint_id)->facilities & waypoint_type) != 0;
 
	return (::Waypoint::Get(waypoint_id)->facilities & static_cast<StationFacility>(waypoint_type)) != 0;
 
}
src/script/api/script_waypointlist.cpp
Show inline comments
 
@@ -23,7 +23,7 @@ ScriptWaypointList::ScriptWaypointList(S
 
	CompanyID owner = ScriptObject::GetCompany();
 
	ScriptList::FillList<Waypoint>(this,
 
		[is_deity, owner, waypoint_type](const Waypoint *wp) {
 
			return (is_deity || wp->owner == owner || wp->owner == OWNER_NONE) && (wp->facilities & waypoint_type) != 0;
 
			return (is_deity || wp->owner == owner || wp->owner == OWNER_NONE) && (wp->facilities & static_cast<StationFacility>(waypoint_type)) != 0;
 
		}
 
	);
 
}
src/slope_func.h
Show inline comments
 
@@ -391,7 +391,7 @@ inline Foundation InclinedFoundation(Axi
 
inline Foundation HalftileFoundation(Corner corner)
 
{
 
	assert(IsValidCorner(corner));
 
	return (Foundation)(FOUNDATION_HALFTILE_W + corner);
 
	return static_cast<Foundation>(static_cast<uint>(FOUNDATION_HALFTILE_W) + static_cast<uint>(corner));
 
}
 

	
 
/**
 
@@ -403,7 +403,7 @@ inline Foundation HalftileFoundation(Cor
 
inline Foundation SpecialRailFoundation(Corner corner)
 
{
 
	assert(IsValidCorner(corner));
 
	return (Foundation)(FOUNDATION_RAIL_W + corner);
 
	return static_cast<Foundation>(static_cast<uint>(FOUNDATION_RAIL_W) + static_cast<uint>(corner));
 
}
 

	
 
/**
0 comments (0 inline, 0 general)