mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-30 15:02:24 +00:00
refactor: downgrade to C++20
This commit is contained in:
parent
ff7baaac3b
commit
b0fac9fbc6
|
|
@ -6,7 +6,7 @@ project(
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
meson_version: '>= 1.3',
|
meson_version: '>= 1.3',
|
||||||
default_options: [
|
default_options: [
|
||||||
'cpp_std=c++23',
|
'cpp_std=c++20',
|
||||||
'warning_level=0',
|
'warning_level=0',
|
||||||
'unity=on', # merge source files per target
|
'unity=on', # merge source files per target
|
||||||
'unity_size=8', # TODO: mess around with this
|
'unity_size=8', # TODO: mess around with this
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
project('simdutf',
|
project('simdutf',
|
||||||
'cpp',
|
'cpp',
|
||||||
default_options: ['cpp_std=c++23'],
|
default_options: ['cpp_std=c++20'],
|
||||||
version: '8.2.0',
|
version: '8.2.0',
|
||||||
meson_version: '>= 1.1',
|
meson_version: '>= 1.1',
|
||||||
license: ['MIT'],
|
license: ['MIT'],
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() {
|
||||||
backupTexture = getTextureId(m_skinIndex);
|
backupTexture = getTextureId(m_skinIndex);
|
||||||
|
|
||||||
if (m_skinIndex ==
|
if (m_skinIndex ==
|
||||||
std::to_underlying(EDefaultSkins::ServerSelected)) {
|
static_cast<int>(EDefaultSkins::ServerSelected)) {
|
||||||
skinName = app.GetString(IDS_DEFAULT_SKINS);
|
skinName = app.GetString(IDS_DEFAULT_SKINS);
|
||||||
} else {
|
} else {
|
||||||
skinName = wchDefaultNamesA[m_skinIndex];
|
skinName = wchDefaultNamesA[m_skinIndex];
|
||||||
|
|
@ -908,8 +908,8 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(int sourceIndex) {
|
||||||
++nextSkin;
|
++nextSkin;
|
||||||
|
|
||||||
if (m_packIndex == SKIN_SELECT_PACK_DEFAULT &&
|
if (m_packIndex == SKIN_SELECT_PACK_DEFAULT &&
|
||||||
nextSkin >= std::to_underlying(EDefaultSkins::Count)) {
|
nextSkin >= static_cast<int>(EDefaultSkins::Count)) {
|
||||||
nextSkin = std::to_underlying(EDefaultSkins::ServerSelected);
|
nextSkin = static_cast<int>(EDefaultSkins::ServerSelected);
|
||||||
} else if (m_currentPack != nullptr &&
|
} else if (m_currentPack != nullptr &&
|
||||||
nextSkin >= m_currentPack->getSkinCount()) {
|
nextSkin >= m_currentPack->getSkinCount()) {
|
||||||
nextSkin = 0;
|
nextSkin = 0;
|
||||||
|
|
@ -933,7 +933,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(int sourceIndex) {
|
||||||
default:
|
default:
|
||||||
if (previousSkin == 0) {
|
if (previousSkin == 0) {
|
||||||
if (m_packIndex == SKIN_SELECT_PACK_DEFAULT) {
|
if (m_packIndex == SKIN_SELECT_PACK_DEFAULT) {
|
||||||
previousSkin = std::to_underlying(EDefaultSkins::Count) - 1;
|
previousSkin = static_cast<int>(EDefaultSkins::Count) - 1;
|
||||||
} else if (m_currentPack != nullptr) {
|
} else if (m_currentPack != nullptr) {
|
||||||
previousSkin = m_currentPack->getSkinCount() - 1;
|
previousSkin = m_currentPack->getSkinCount() - 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class UILayer;
|
||||||
class UIScene_SkinSelectMenu : public UIScene {
|
class UIScene_SkinSelectMenu : public UIScene {
|
||||||
private:
|
private:
|
||||||
static const char*
|
static const char*
|
||||||
wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)];
|
wchDefaultNamesA[static_cast<size_t>(EDefaultSkins::Count)];
|
||||||
|
|
||||||
// 4J Stu - How many to show on each side of the main control
|
// 4J Stu - How many to show on each side of the main control
|
||||||
static const int sidePreviewControls = 4;
|
static const int sidePreviewControls = 4;
|
||||||
|
|
|
||||||
|
|
@ -1268,7 +1268,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void* initData,
|
||||||
setFullscreenMenuDisplayed(true);
|
setFullscreenMenuDisplayed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::println(stderr, "TIMER: Navigate to scene: Elapsed time {:.6f}",
|
fprintf(stderr, "TIMER: Navigate to scene: Elapsed time %.6f",
|
||||||
timer.elapsed_seconds());
|
timer.elapsed_seconds());
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,7 @@ void Player::ride(std::shared_ptr<Entity> e) {
|
||||||
void Player::setPlayerDefaultSkin(EDefaultSkins skin) {
|
void Player::setPlayerDefaultSkin(EDefaultSkins skin) {
|
||||||
#if !defined(_CONTENT_PACKAGE)
|
#if !defined(_CONTENT_PACKAGE)
|
||||||
printf("Setting default skin to %d for player %s\n",
|
printf("Setting default skin to %d for player %s\n",
|
||||||
std::to_underlying(skin), name.c_str());
|
static_cast<int>(skin), name.c_str());
|
||||||
#endif
|
#endif
|
||||||
m_skinIndex = skin;
|
m_skinIndex = skin;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ void setPriorityPlatform(std::thread& threadHandle, bool isSelf,
|
||||||
handle = ::GetCurrentThread();
|
handle = ::GetCurrentThread();
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
(void)::SetThreadPriority(handle, std::to_underlying(priority));
|
(void)::SetThreadPriority(handle, static_cast<int>(priority));
|
||||||
|
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
std::int64_t tid = 0;
|
std::int64_t tid = 0;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] static constexpr std::size_t BucketIndex(
|
[[nodiscard]] static constexpr std::size_t BucketIndex(
|
||||||
Bucket bucket) noexcept {
|
Bucket bucket) noexcept {
|
||||||
return static_cast<std::size_t>(std::to_underlying(bucket));
|
return static_cast<size_t>(bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] static constexpr std::size_t BucketCount() noexcept {
|
[[nodiscard]] static constexpr std::size_t BucketCount() noexcept {
|
||||||
|
|
|
||||||
|
|
@ -81,11 +81,12 @@ public:
|
||||||
std::chrono::duration<double, std::milli>(elapsed).count();
|
std::chrono::duration<double, std::milli>(elapsed).count();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
name_.empty()
|
const auto log =
|
||||||
? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", ms, file_,
|
name_.empty() ? std::format("[TIMER] {:.3f} ms ({}:{})\n", ms,
|
||||||
line_)
|
file_, line_)
|
||||||
: std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", name_,
|
: std::format("[TIMER] {} - {:.3f} ms ({}:{})\n",
|
||||||
ms, file_, line_);
|
name_, ms, file_, line_);
|
||||||
|
std::fputs(log.c_str(), stderr);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::fprintf(stderr, "[TIMER] %.3f ms\n", ms);
|
std::fprintf(stderr, "[TIMER] %.3f ms\n", ms);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue