style: canviar border_ a enum class

This commit is contained in:
2025-03-20 14:06:58 +01:00
parent 68c97610fb
commit f438e8946b
6 changed files with 32 additions and 28 deletions

View File

@@ -3,7 +3,7 @@
#include <algorithm> // Para max, min
#include <cmath> // Para ceil, abs
#include "debug.h" // Para Debug
#include "defines.h" // Para BORDER_BOTTOM, BORDER_LEFT, BORDER_RIGHT
#include "defines.h" // Para RoomBorder::BOTTOM, RoomBorder::LEFT, RoomBorder::RIGHT
#include "input.h" // Para Input, InputAction
#include "jail_audio.h" // Para JA_PlaySound
#include "options.h" // Para Cheat, Options, options
@@ -132,25 +132,25 @@ void Player::checkBorders()
{
if (x_ < PLAY_AREA_LEFT)
{
border_ = BORDER_LEFT;
border_ = RoomBorder::LEFT;
is_on_border_ = true;
}
else if (x_ + WIDTH_ > PLAY_AREA_RIGHT)
{
border_ = BORDER_RIGHT;
border_ = RoomBorder::RIGHT;
is_on_border_ = true;
}
else if (y_ < PLAY_AREA_TOP)
{
border_ = BORDER_TOP;
border_ = RoomBorder::TOP;
is_on_border_ = true;
}
else if (y_ + HEIGHT_ > PLAY_AREA_BOTTOM)
{
border_ = BORDER_BOTTOM;
border_ = RoomBorder::BOTTOM;
is_on_border_ = true;
}
@@ -204,21 +204,21 @@ void Player::switchBorders()
{
switch (border_)
{
case BORDER_TOP:
case RoomBorder::TOP:
y_ = PLAY_AREA_BOTTOM - HEIGHT_ - BLOCK;
setState(PlayerState::STANDING);
break;
case BORDER_BOTTOM:
case RoomBorder::BOTTOM:
y_ = PLAY_AREA_TOP;
setState(PlayerState::STANDING);
break;
case BORDER_RIGHT:
case RoomBorder::RIGHT:
x_ = PLAY_AREA_LEFT;
break;
case BORDER_LEFT:
case RoomBorder::LEFT:
x_ = PLAY_AREA_RIGHT - WIDTH_;
break;