refactor: fase 1 — cleanup mecànic de baix risc (NULL→nullptr, typedef→using, explicit, enum class local)
- jdraw8.hpp: typedef → using (JD8_Surface, JD8_Palette) - jdraw8.cpp: NULL → nullptr, C-casts → static_cast/reinterpret_cast, anon enum FadeType → enum class - momia.cpp: NULL → nullptr - bola/mapa/marcador/momia/engendro: explicit als constructors Zero canvis de lògica ni ownership. Primera fase de la modernització RAII. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
class Bola : public Sprite {
|
||||
public:
|
||||
Bola(JD8_Surface gfx, Prota* sam);
|
||||
explicit Bola(JD8_Surface gfx, Prota* sam);
|
||||
|
||||
void draw() override;
|
||||
void update();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
class Engendro : public Sprite {
|
||||
public:
|
||||
Engendro(JD8_Surface gfx, Uint16 x, Uint16 y);
|
||||
explicit Engendro(JD8_Surface gfx, Uint16 x, Uint16 y);
|
||||
|
||||
bool update();
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ struct Vertex {
|
||||
|
||||
class Mapa {
|
||||
public:
|
||||
Mapa(JD8_Surface gfx, Prota* sam);
|
||||
explicit Mapa(JD8_Surface gfx, Prota* sam);
|
||||
~Mapa(void);
|
||||
|
||||
void draw();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class Marcador {
|
||||
public:
|
||||
Marcador(JD8_Surface gfx, Prota* sam);
|
||||
explicit Marcador(JD8_Surface gfx, Prota* sam);
|
||||
~Marcador(void);
|
||||
|
||||
void draw();
|
||||
|
||||
@@ -40,7 +40,7 @@ Momia::Momia(JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam)
|
||||
this->cur_frame = 0;
|
||||
this->o = rand() % 4;
|
||||
this->cycles_per_frame = 4;
|
||||
this->next = NULL;
|
||||
this->next = nullptr;
|
||||
|
||||
if (this->dimoni) {
|
||||
if (x == 0) {
|
||||
@@ -65,7 +65,7 @@ Momia::Momia(JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam)
|
||||
}
|
||||
|
||||
void Momia::clear() {
|
||||
if (this->next != NULL) this->next->clear();
|
||||
if (this->next != nullptr) this->next->clear();
|
||||
delete this->next;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void Momia::draw() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->next != NULL) this->next->draw();
|
||||
if (this->next != nullptr) this->next->draw();
|
||||
}
|
||||
|
||||
bool Momia::update() {
|
||||
@@ -155,7 +155,7 @@ bool Momia::update() {
|
||||
}
|
||||
}
|
||||
|
||||
if (this->next != NULL) {
|
||||
if (this->next != nullptr) {
|
||||
if (this->next->update()) {
|
||||
Momia* seguent = this->next->next;
|
||||
delete this->next;
|
||||
@@ -168,7 +168,7 @@ bool Momia::update() {
|
||||
}
|
||||
|
||||
void Momia::insertar(Momia* momia) {
|
||||
if (this->next != NULL) {
|
||||
if (this->next != nullptr) {
|
||||
this->next->insertar(momia);
|
||||
} else {
|
||||
this->next = momia;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class Momia : public Sprite {
|
||||
public:
|
||||
Momia(JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam);
|
||||
explicit Momia(JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam);
|
||||
|
||||
void clear();
|
||||
void draw() override;
|
||||
|
||||
Reference in New Issue
Block a user