Lint: convert-member-functions-to-static (20 hits)
Métodos privados que no consultan estado de la instancia pasan a 'static' en la declaración del header. Las definiciones en el .cpp pierden el 'const' trailing (incompatible con static). Cero callsites afectados: las llamadas via 'this->method()' o sin qualifier siguen siendo válidas para métodos estáticos. Aplicado en: - Shape: trim, startsWith, extractValue, parsePoints. - VectorText: getShapeFilename, get_text_width, get_text_height. - Pack: readFile, calculateChecksum, encryptData. - DebrisManager: computeExplosionDirection. - Enemy: attemptSafeSpawn. - LogoScene / TitleScene: checkSkipButtonPressed (consulta Input singleton). - SpawnController: get_enemics_vius. - StageManager: processPlaying. - ShipAnimator: updateEntering, updateFloating, updateExiting, configureShipP1, configureShipP2, computeOffscreenPosition. - Director: run (los miembros executable_path_ / system_folder_ se fijan en el ctor y no se vuelven a leer en el loop principal). Verificado previamente con grep que ningún '&Class::method' los usa como function pointer (cambiar a estático cambiaría su tipo). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6d0df85e5e
commit
4e5ab6be1d
18 files changed
+56
-41
No files matched your search
@@ -331,7 +331,7 @@ auto DebrisManager::findFreeSlot() -> Debris* {
|
||||
|
||||
auto DebrisManager::computeExplosionDirection(const Vec2& p1,
|
||||
const Vec2& p2,
|
||||
const Vec2& centre_objecte) const -> Vec2 {
|
||||
const Vec2& centre_objecte) -> Vec2 {
|
||||
// 1. Calcular centro del segment
|
||||
float centro_seg_x = (p1.x + p2.x) / 2.0F;
|
||||
float centro_seg_y = (p1.y + p2.y) / 2.0F;
|
||||
|
||||
@@ -69,8 +69,9 @@ class DebrisManager {
|
||||
// Trobar primer slot inactiu
|
||||
auto findFreeSlot() -> Debris*;
|
||||
|
||||
// Calcular direcció de explosión (radial, des del centro hacia el segment)
|
||||
[[nodiscard]] auto computeExplosionDirection(const Vec2& p1, const Vec2& p2, const Vec2& centre_objecte) const -> Vec2;
|
||||
// Calcular direcció de explosión (radial, des del centro hacia el segment).
|
||||
// Estático: solo opera sobre los puntos pasados, sin estado del manager.
|
||||
[[nodiscard]] static auto computeExplosionDirection(const Vec2& p1, const Vec2& p2, const Vec2& centre_objecte) -> Vec2;
|
||||
};
|
||||
|
||||
} // namespace Effects
|
||||
@@ -113,7 +113,8 @@ class Enemy : public Entities::Entity {
|
||||
void behaviorQuadrat(float delta_time);
|
||||
void behaviorMolinillo(float delta_time);
|
||||
[[nodiscard]] auto computeCurrentScale() const -> float;
|
||||
auto attemptSafeSpawn(const Vec2& ship_pos, float& out_x, float& out_y) -> bool;
|
||||
// Estático: solo opera sobre ship_pos pasado; no consulta estado del enemy.
|
||||
static auto attemptSafeSpawn(const Vec2& ship_pos, float& out_x, float& out_y) -> bool;
|
||||
|
||||
// Helper: setear body_.velocity desde un ángulo y magnitud.
|
||||
// angle_movement=0 apunta hacia arriba (eje Y negativo SDL).
|
||||
|
||||
@@ -87,7 +87,8 @@ class LogoScene final : public Scene {
|
||||
// Métodos privats
|
||||
void initLetters();
|
||||
void updateExplosions(float delta_time);
|
||||
auto checkSkipButtonPressed() -> bool;
|
||||
// Estático: solo consulta Input (singleton), no estado de la escena.
|
||||
static auto checkSkipButtonPressed() -> bool;
|
||||
|
||||
// Métodos de gestió de estats
|
||||
void changeState(AnimationState nou_estat);
|
||||
|
||||
@@ -113,7 +113,8 @@ class TitleScene final : public Scene {
|
||||
|
||||
// Métodos privats
|
||||
void updateLogoAnimation(float delta_time); // Actualitza l'animación orbital del logo
|
||||
auto checkSkipButtonPressed() -> bool;
|
||||
// Estático: solo consulta Input (singleton), no estado de la escena.
|
||||
static auto checkSkipButtonPressed() -> bool;
|
||||
auto checkStartGameButtonPressed() -> bool;
|
||||
void initTitle(); // Carrega i posiciona las lletres del título
|
||||
void inicialitzarJailgames(); // Carrega i posiciona el logo JAILGAMES pequeño
|
||||
|
||||
@@ -99,7 +99,7 @@ auto SpawnController::tots_enemics_destruits(const std::array<Enemy, 15>& orni_a
|
||||
return true;
|
||||
}
|
||||
|
||||
auto SpawnController::get_enemics_vius(const std::array<Enemy, 15>& orni_array) const -> uint8_t {
|
||||
auto SpawnController::get_enemics_vius(const std::array<Enemy, 15>& orni_array) -> uint8_t {
|
||||
uint8_t count = 0;
|
||||
for (const auto& enemy : orni_array) {
|
||||
if (enemy.isActive()) {
|
||||
|
||||
@@ -35,7 +35,8 @@ class SpawnController {
|
||||
// Status queries
|
||||
[[nodiscard]] auto tots_enemics_spawnejats() const -> bool;
|
||||
[[nodiscard]] auto tots_enemics_destruits(const std::array<Enemy, 15>& orni_array) const -> bool;
|
||||
[[nodiscard]] auto get_enemics_vius(const std::array<Enemy, 15>& orni_array) const -> uint8_t;
|
||||
// Estático: solo recorre el array pasado; no consulta estado del controller.
|
||||
[[nodiscard]] static auto get_enemics_vius(const std::array<Enemy, 15>& orni_array) -> uint8_t;
|
||||
[[nodiscard]] auto get_enemics_spawnejats() const -> uint8_t;
|
||||
|
||||
// [NEW] Set ship position reference for safe spawn
|
||||
|
||||
@@ -126,6 +126,7 @@ void StageManager::processLevelStart(float delta_time) {
|
||||
}
|
||||
|
||||
void StageManager::processPlaying(float delta_time, bool pause_spawn) {
|
||||
|
||||
// Update spawn controller (pauses when pause_spawn = true)
|
||||
// Note: The actual enemy array update happens in GameScene::update()
|
||||
// This is just for internal timekeeping
|
||||
|
||||
@@ -55,7 +55,8 @@ class StageManager {
|
||||
void changeState(EstatStage nou_estat);
|
||||
void processInitHud(float delta_time);
|
||||
void processLevelStart(float delta_time);
|
||||
void processPlaying(float delta_time, bool pause_spawn);
|
||||
// Estático: solo registra log; no consulta estado del manager.
|
||||
static void processPlaying(float delta_time, bool pause_spawn);
|
||||
void processLevelCompleted(float delta_time);
|
||||
void loadStage(uint8_t stage_id);
|
||||
};
|
||||
|
||||
@@ -320,7 +320,7 @@ void ShipAnimator::configureShipP2(TitleShip& ship) {
|
||||
ship.visible = true;
|
||||
}
|
||||
|
||||
auto ShipAnimator::computeOffscreenPosition(float angle_rellotge) const -> Vec2 {
|
||||
auto ShipAnimator::computeOffscreenPosition(float angle_rellotge) -> Vec2 {
|
||||
using namespace Defaults::Title::Ships;
|
||||
|
||||
// Convertir angle del rellotge a radians (per exemple: 240° per clock 8)
|
||||
|
||||
@@ -89,15 +89,16 @@ class ShipAnimator {
|
||||
Rendering::Renderer* renderer_;
|
||||
std::array<TitleShip, 2> ships_; // Naves P1 i P2
|
||||
|
||||
// Métodos de animación
|
||||
void updateEntering(TitleShip& ship, float delta_time);
|
||||
void updateFloating(TitleShip& ship, float delta_time);
|
||||
void updateExiting(TitleShip& ship, float delta_time);
|
||||
// Métodos de animación. Estáticos: solo modifican el TitleShip pasado,
|
||||
// sin tocar otros miembros del ShipAnimator.
|
||||
static void updateEntering(TitleShip& ship, float delta_time);
|
||||
static void updateFloating(TitleShip& ship, float delta_time);
|
||||
static void updateExiting(TitleShip& ship, float delta_time);
|
||||
|
||||
// Configuración
|
||||
void configureShipP1(TitleShip& ship);
|
||||
void configureShipP2(TitleShip& ship);
|
||||
[[nodiscard]] auto computeOffscreenPosition(float angle_rellotge) const -> Vec2;
|
||||
// Configuración (también estáticos: trabajan sobre el ship pasado).
|
||||
static void configureShipP1(TitleShip& ship);
|
||||
static void configureShipP2(TitleShip& ship);
|
||||
[[nodiscard]] static auto computeOffscreenPosition(float angle_rellotge) -> Vec2;
|
||||
};
|
||||
|
||||
} // namespace Title
|
||||
Reference in new issue
Block a user