Merge branch 'master' into jgrpp

# Conflicts:
#	src/cargotype.h
#	src/core/CMakeLists.txt
#	src/core/span_type.hpp
#	src/fileio.cpp
#	src/fios.cpp
#	src/misc/endian_buffer.hpp
#	src/misc_gui.cpp
#	src/saveload/saveload.h
#	src/saveload/vehicle_sl.cpp
#	src/screenshot.cpp
#	src/settings.cpp
#	src/settings_internal.h
#	src/stdafx.h
#	src/string_func.h
#	src/strings.cpp
#	src/strings_func.h
#	src/strings_internal.h
This commit is contained in:
Jonathan G Rennison
2024-01-25 18:37:23 +00:00
49 changed files with 127 additions and 472 deletions

View File

@@ -19,6 +19,7 @@
#include "saveload_internal.h"
#include "oldloader.h"
#include <bit>
#include <exception>
#include "../safeguards.h"
@@ -214,7 +215,7 @@ static bool VerifyOldNameChecksum(char *title, uint len)
uint16_t sum = 0;
for (uint i = 0; i < len - 2; i++) {
sum += title[i];
sum = ROL(sum, 1);
sum = std::rotl(sum, 1);
}
sum ^= 0xAAAA; // computed checksum

View File

@@ -230,7 +230,7 @@ struct NullStruct {
};
/** A table of ChunkHandler entries. */
using ChunkHandlerTable = span<const ChunkHandler>;
using ChunkHandlerTable = std::span<const ChunkHandler>;
/** Type of reference (#SLE_REF, #SLE_CONDREF). */
enum SLRefType {
@@ -943,7 +943,7 @@ size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt);
* @return Span of the saved data, in the autolength temp buffer
*/
template <typename F>
span<byte> SlSaveToTempBuffer(F proc)
std::span<byte> SlSaveToTempBuffer(F proc)
{
extern uint8_t SlSaveToTempBufferSetup();
extern std::pair<byte *, size_t> SlSaveToTempBufferRestore(uint8_t state);
@@ -951,7 +951,7 @@ span<byte> SlSaveToTempBuffer(F proc)
uint8_t state = SlSaveToTempBufferSetup();
proc();
auto result = SlSaveToTempBufferRestore(state);
return span<byte>(result.first, result.second);
return std::span<byte>(result.first, result.second);
}
/**
@@ -963,7 +963,7 @@ span<byte> SlSaveToTempBuffer(F proc)
template <typename F>
std::vector<uint8_t> SlSaveToVector(F proc)
{
span<byte> result = SlSaveToTempBuffer(proc);
std::span<byte> result = SlSaveToTempBuffer(proc);
return std::vector<uint8_t>(result.begin(), result.end());
}

View File

@@ -11,18 +11,17 @@
#define SL_SAVELOAD_COMMON_H
#include "../strings_type.h"
#include "../core/span_type.hpp"
struct SaveLoad;
/** A table of SaveLoad entries. */
using SaveLoadTable = span<const SaveLoad>;
using SaveLoadTable = std::span<const SaveLoad>;
namespace upstream_sl {
struct SaveLoad;
/** A table of SaveLoad entries. */
using SaveLoadTable = span<const SaveLoad>;
using SaveLoadTable = std::span<const SaveLoad>;
}
/** SaveLoad versions