manuals tidy tier 2: empty-catch, enum-size, trivially-destructible
This commit is contained in:
@@ -26,14 +26,14 @@ struct SDLFreeDeleter {
|
||||
};
|
||||
|
||||
// --- Public Enums ---
|
||||
enum JA_Channel_state {
|
||||
enum JA_Channel_state : std::uint8_t {
|
||||
JA_CHANNEL_INVALID,
|
||||
JA_CHANNEL_FREE,
|
||||
JA_CHANNEL_PLAYING,
|
||||
JA_CHANNEL_PAUSED,
|
||||
JA_SOUND_DISABLED,
|
||||
};
|
||||
enum JA_Music_state {
|
||||
enum JA_Music_state : std::uint8_t {
|
||||
JA_MUSIC_INVALID,
|
||||
JA_MUSIC_PLAYING,
|
||||
JA_MUSIC_PAUSED,
|
||||
@@ -42,7 +42,7 @@ enum JA_Music_state {
|
||||
};
|
||||
|
||||
// --- Struct Definitions ---
|
||||
enum {
|
||||
enum : std::uint8_t {
|
||||
JA_MAX_SIMULTANEOUS_CHANNELS = 20,
|
||||
JA_MAX_GROUPS = 2
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ auto JD8_LoadSurface(const char* file) -> JD8_Surface {
|
||||
memcpy(image, cached.data(), 64000);
|
||||
return image;
|
||||
} catch (const std::exception&) {
|
||||
// No està al cache (asset no llistat al manifest). Fallback.
|
||||
// @INTENTIONAL: no està al cache (asset no llistat al manifest), fallback al loader.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ auto JD8_LoadPalette(const char* file) -> JD8_Palette {
|
||||
memcpy(palette, cached.data(), 768);
|
||||
return palette;
|
||||
} catch (const std::exception&) {
|
||||
// No està al cache — fallback a lectura + LoadPalette.
|
||||
// @INTENTIONAL: no està al cache, fallback a lectura + LoadPalette.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void JD8_SetPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b) {
|
||||
// el caller decideix quan fer Flip.
|
||||
namespace {
|
||||
|
||||
enum class FadeType {
|
||||
enum class FadeType : std::uint8_t {
|
||||
None = 0,
|
||||
Out,
|
||||
ToPal,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void JI_DisableKeyboard(Uint32 time);
|
||||
|
||||
// Bloqueja tot l'input cap al joc (JI_KeyPressed retorna false per a tot)
|
||||
@@ -9,7 +11,7 @@ void JI_SetInputBlocked(bool blocked);
|
||||
// Estableix l'estat d'una tecla virtual. Múltiples fonts (gamepad, remap)
|
||||
// s'agrupen per OR. JI_KeyPressed retorna true si el teclat real O qualsevol
|
||||
// font virtual està premuda.
|
||||
enum JI_VirtualSource {
|
||||
enum JI_VirtualSource : std::uint8_t {
|
||||
JI_VSRC_GAMEPAD = 0,
|
||||
JI_VSRC_REMAP = 1,
|
||||
JI_VSRC_COUNT = 2
|
||||
|
||||
@@ -22,7 +22,9 @@ namespace Locale {
|
||||
} else if (node.is_scalar()) {
|
||||
try {
|
||||
strings_[prefix] = node.get_value<std::string>();
|
||||
} catch (...) {}
|
||||
} catch (...) {
|
||||
// @INTENTIONAL: si el valor no és string vàlid, l'ignorem i continuem.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Menu {
|
||||
static constexpr float HEIGHT_RATE = 12.0F; // smoothing exponencial de l'alçada (~150 ms al 90%)
|
||||
|
||||
// --- Items ---
|
||||
enum class ItemKind { Toggle,
|
||||
enum class ItemKind : std::uint8_t { Toggle,
|
||||
Cycle,
|
||||
IntRange,
|
||||
Submenu,
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Overlay {
|
||||
|
||||
// --- Estat de les notificacions ---
|
||||
|
||||
enum class Status { RISING,
|
||||
enum class Status : std::uint8_t { RISING,
|
||||
STAY,
|
||||
VANISHING,
|
||||
FINISHED };
|
||||
@@ -73,7 +73,7 @@ namespace Overlay {
|
||||
|
||||
// --- Crèdits cinematogràfics ---
|
||||
// Usen el sistema de notificacions en posició TOP_CENTER_DROP.
|
||||
enum class CreditsPhase { IDLE,
|
||||
enum class CreditsPhase : std::uint8_t { IDLE,
|
||||
DELAY,
|
||||
PLAYING_1,
|
||||
GAP,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -10,7 +11,7 @@
|
||||
namespace Rendering {
|
||||
|
||||
/** @brief Identificador del shader de post-procesado activo */
|
||||
enum class ShaderType { POSTFX,
|
||||
enum class ShaderType : std::uint8_t { POSTFX,
|
||||
CRTPI };
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -42,7 +43,7 @@ namespace Resource {
|
||||
private:
|
||||
Cache() = default;
|
||||
|
||||
enum class LoadStage {
|
||||
enum class LoadStage : std::uint8_t {
|
||||
MUSICS,
|
||||
SOUNDS,
|
||||
BITMAPS,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -13,7 +14,7 @@ namespace Resource {
|
||||
// iterar per categoria a l'hora de carregar.
|
||||
class List {
|
||||
public:
|
||||
enum class Type : int {
|
||||
enum class Type : std::uint8_t {
|
||||
DATA,
|
||||
BITMAP,
|
||||
MUSIC,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
#include "game/info.hpp"
|
||||
#include "game/prota.hpp"
|
||||
|
||||
enum {
|
||||
enum : std::uint8_t {
|
||||
CONTE_RES = 0,
|
||||
CONTE_TRESOR = 1,
|
||||
CONTE_FARAO = 2,
|
||||
|
||||
@@ -5,8 +5,6 @@ Marcador::Marcador(JD8_Surface gfx, Prota* sam) {
|
||||
this->sam = sam;
|
||||
}
|
||||
|
||||
Marcador::~Marcador() = default;
|
||||
|
||||
void Marcador::draw() {
|
||||
if (info::ctx.num_piramide < 6) {
|
||||
this->pintaNumero(55, 2, info::ctx.num_piramide);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class Marcador {
|
||||
public:
|
||||
explicit Marcador(JD8_Surface gfx, Prota* sam);
|
||||
~Marcador();
|
||||
~Marcador() = default;
|
||||
|
||||
void draw();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@@ -42,7 +43,7 @@ class ModuleGame : public scenes::Scene {
|
||||
[[nodiscard]] auto nextState() const -> int override;
|
||||
|
||||
private:
|
||||
enum class Phase {
|
||||
enum class Phase : std::uint8_t {
|
||||
FadingIn,
|
||||
Playing,
|
||||
FadingOut,
|
||||
|
||||
+15
-7
@@ -441,7 +441,9 @@ namespace Options {
|
||||
if (node.contains(key)) {
|
||||
try {
|
||||
target = node[key].get_value<float>();
|
||||
} catch (...) {}
|
||||
} catch (...) {
|
||||
// @INTENTIONAL: si el camp YAML no és float vàlid, mantenim el valor per defecte.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,32 +563,38 @@ namespace Options {
|
||||
if (p.contains("mask_type")) {
|
||||
try {
|
||||
preset.mask_type = p["mask_type"].get_value<int>();
|
||||
} catch (...) {}
|
||||
} catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */
|
||||
}
|
||||
}
|
||||
if (p.contains("enable_scanlines")) {
|
||||
try {
|
||||
preset.enable_scanlines = p["enable_scanlines"].get_value<bool>();
|
||||
} catch (...) {}
|
||||
} catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */
|
||||
}
|
||||
}
|
||||
if (p.contains("enable_multisample")) {
|
||||
try {
|
||||
preset.enable_multisample = p["enable_multisample"].get_value<bool>();
|
||||
} catch (...) {}
|
||||
} catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */
|
||||
}
|
||||
}
|
||||
if (p.contains("enable_gamma")) {
|
||||
try {
|
||||
preset.enable_gamma = p["enable_gamma"].get_value<bool>();
|
||||
} catch (...) {}
|
||||
} catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */
|
||||
}
|
||||
}
|
||||
if (p.contains("enable_curvature")) {
|
||||
try {
|
||||
preset.enable_curvature = p["enable_curvature"].get_value<bool>();
|
||||
} catch (...) {}
|
||||
} catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */
|
||||
}
|
||||
}
|
||||
if (p.contains("enable_sharper")) {
|
||||
try {
|
||||
preset.enable_sharper = p["enable_sharper"].get_value<bool>();
|
||||
} catch (...) {}
|
||||
} catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */
|
||||
}
|
||||
}
|
||||
crtpi_presets.push_back(preset);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -19,17 +20,17 @@ namespace Options {
|
||||
};
|
||||
|
||||
// Posició del render info
|
||||
enum class RenderInfoPosition { OFF = 0,
|
||||
enum class RenderInfoPosition : std::uint8_t { OFF = 0,
|
||||
TOP = 1,
|
||||
BOTTOM = 2 };
|
||||
|
||||
// Filtre de textura per a l'upscale final (sempre, no només en 4:3)
|
||||
enum class TextureFilter { NEAREST = 0,
|
||||
enum class TextureFilter : std::uint8_t { NEAREST = 0,
|
||||
LINEAR = 1 };
|
||||
|
||||
// Mode de presentació lògica (escala finestra): mapeja directament
|
||||
// als valors de SDL_RendererLogicalPresentation.
|
||||
enum class ScalingMode { DISABLED = 0,
|
||||
enum class ScalingMode : std::uint8_t { DISABLED = 0,
|
||||
STRETCH = 1,
|
||||
LETTERBOX = 2,
|
||||
OVERSCAN = 3,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "game/scenes/palette_fade.hpp"
|
||||
#include "game/scenes/scene.hpp"
|
||||
#include "game/scenes/surface_handle.hpp"
|
||||
@@ -26,7 +28,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto nextState() const -> int override { return 0; }
|
||||
|
||||
private:
|
||||
enum class Phase { FadingIn,
|
||||
enum class Phase : std::uint8_t { FadingIn,
|
||||
Showing,
|
||||
FadingOut,
|
||||
Done };
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
#include "game/scenes/frame_animator.hpp"
|
||||
#include "game/scenes/palette_fade.hpp"
|
||||
@@ -31,7 +33,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; }
|
||||
|
||||
private:
|
||||
enum class Phase { Rolling,
|
||||
enum class Phase : std::uint8_t { Rolling,
|
||||
FadingOut,
|
||||
Done };
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
@@ -39,7 +40,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; }
|
||||
|
||||
private:
|
||||
enum class Phase {
|
||||
enum class Phase : std::uint8_t {
|
||||
Initial, // pantalla negra 1000 ms
|
||||
Revealing, // 9 × 2 frames × 150 ms cada un
|
||||
FullLogoFlash, // logo complet + cursor, 200 ms
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
@@ -40,7 +41,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; }
|
||||
|
||||
private:
|
||||
enum class Phase {
|
||||
enum class Phase : std::uint8_t {
|
||||
InitialWait, // 1000 ms pantalla negra
|
||||
Reveal, // 15 passos del wordmark
|
||||
PaletteCycle, // 256 × 20 ms mutant pal[16..31]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "game/scenes/frame_animator.hpp"
|
||||
#include "game/scenes/palette_fade.hpp"
|
||||
#include "game/scenes/scene.hpp"
|
||||
@@ -29,7 +31,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; }
|
||||
|
||||
private:
|
||||
enum class Phase { FadingIn,
|
||||
enum class Phase : std::uint8_t { FadingIn,
|
||||
Showing,
|
||||
FadingOut,
|
||||
Done };
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "game/scenes/palette_fade.hpp"
|
||||
#include "game/scenes/scene.hpp"
|
||||
#include "game/scenes/surface_handle.hpp"
|
||||
@@ -21,7 +23,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; }
|
||||
|
||||
private:
|
||||
enum class Phase { FadingIn,
|
||||
enum class Phase : std::uint8_t { FadingIn,
|
||||
Showing,
|
||||
FadingOut,
|
||||
Done };
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
#include "game/scenes/palette_fade.hpp"
|
||||
#include "game/scenes/scene.hpp"
|
||||
@@ -35,7 +37,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto nextState() const -> int override { return 0; }
|
||||
|
||||
private:
|
||||
enum class Phase {
|
||||
enum class Phase : std::uint8_t {
|
||||
InitialFadeOut,
|
||||
Tomba1ScrollIn,
|
||||
Tomba1Hold,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "core/jail/jdraw8.hpp"
|
||||
#include "game/scenes/palette_fade.hpp"
|
||||
#include "game/scenes/scene.hpp"
|
||||
@@ -44,7 +46,7 @@ namespace scenes {
|
||||
[[nodiscard]] auto nextState() const -> int override { return next_state_; }
|
||||
|
||||
private:
|
||||
enum class Phase {
|
||||
enum class Phase : std::uint8_t {
|
||||
Slide1Enter,
|
||||
Slide1Hold,
|
||||
FadeOut1,
|
||||
|
||||
Reference in New Issue
Block a user