manuals tidy tier 2: empty-catch, enum-size, trivially-destructible

This commit is contained in:
2026-05-14 19:07:43 +02:00
parent 8676c0e773
commit 0b82be193f
24 changed files with 69 additions and 37 deletions
+3 -3
View File
@@ -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
};
+3 -3
View File
@@ -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,
+3 -1
View File
@@ -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
+3 -1
View File
@@ -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.
}
}
}
+1 -1
View File
@@ -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,
+2 -2
View File
@@ -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,
+1
View File
@@ -2,6 +2,7 @@
#include <SDL3/SDL.h>
#include <cstdint>
#include <string>
#include <vector>
+2 -1
View File
@@ -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 };
/**
+2 -1
View File
@@ -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,
+2 -1
View File
@@ -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,