Mario: formatting

This commit is contained in:
2021-10-18 09:08:35 +02:00
parent f3062464d2
commit 8ca70fa11e
19 changed files with 1262 additions and 1250 deletions
+26 -26
View File
@@ -16,9 +16,9 @@
#define SELECTED_RIGHT_CHARACTER 0x00000100
#define SELECTED_LEFT_CHARACTER 0x00000200
void MouseVisitor::visit( const SDLPP::RenderObject &obj ) {
void MouseVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId();
switch ( id ) {
switch (id) {
case EDITOR_LEFT_MAP_ID:
select_flags |= SELECTED_LEFT_MAP;
break;
@@ -45,72 +45,72 @@ void MouseVisitor::visit( const SDLPP::RenderObject &obj ) {
break;
case EDITOR_EDIT_SQUARE:
edit_box = true;
edit_box_location = dynamic_cast< const EditBox & >( obj ).getIndexes();
edit_box_location = dynamic_cast<const EditBox &>(obj).getIndexes();
break;
case EDITOR_TOOL_ID:
tool_box = true;
tool_box_location = dynamic_cast< const ToolBox & >( obj ).getIndexes();
tool_box_type = dynamic_cast< const ToolBox & >( obj ).getType();
tool_box_location = dynamic_cast<const ToolBox &>(obj).getIndexes();
tool_box_type = dynamic_cast<const ToolBox &>(obj).getType();
break;
default:
break;
}
}
bool MouseVisitor::moveMapLeft( uint64_t flags ) {
bool MouseVisitor::moveMapLeft(uint64_t flags) {
return flags & SELECTED_LEFT_MAP;
}
bool MouseVisitor::moveMapRight( uint64_t flags ) {
bool MouseVisitor::moveMapRight(uint64_t flags) {
return flags & SELECTED_RIGHT_MAP;
}
bool MouseVisitor::moveToolsLeft( uint64_t flags ) {
bool MouseVisitor::moveToolsLeft(uint64_t flags) {
return flags & SELECTED_LEFT_TOOL;
}
bool MouseVisitor::moveToolsRight( uint64_t flags ) {
bool MouseVisitor::moveToolsRight(uint64_t flags) {
return flags & SELECTED_RIGHT_TOOL;
}
bool MouseVisitor::moveModsLeft( uint64_t flags ) {
bool MouseVisitor::moveModsLeft(uint64_t flags) {
return flags & SELECTED_LEFT_MOD;
}
bool MouseVisitor::moveModsRight( uint64_t flags ) {
bool MouseVisitor::moveModsRight(uint64_t flags) {
return flags & SELECTED_RIGHT_MOD;
}
bool MouseVisitor::moveCharactersLeft( uint64_t flags ) {
bool MouseVisitor::moveCharactersLeft(uint64_t flags) {
return flags & SELECTED_LEFT_CHARACTER;
}
bool MouseVisitor::moveCharactersRight( uint64_t flags ) {
bool MouseVisitor::moveCharactersRight(uint64_t flags) {
return flags & SELECTED_RIGHT_CHARACTER;
}
void ToolVisitor::visit( const SDLPP::RenderObject &obj ) {
void ToolVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getCollisions()[0]->getId();
switch ( id ) {
switch (id) {
case EDITOR_TERRAIN_ID: {
const auto &m_obj = dynamic_cast<const MarioBlock&>(obj);
const auto &m_obj = dynamic_cast<const MarioBlock &>(obj);
remove_block = true;
if ( obj.getId() == source_id &&
((m_obj.getType() == source_type &&
getVisitorType() == VisitorType::Terrain) || ( m_obj.getData() == _data && getVisitorType() == VisitorType::Modifier))) {
if (obj.getId() == source_id &&
((m_obj.getType() == source_type &&
getVisitorType() == VisitorType::Terrain) ||
(m_obj.getData() == _data &&
getVisitorType() == VisitorType::Modifier))) {
add_block = false;
}
}
break;
} break;
case EDITOR_CHARACTER_ID: {
const auto &m_obj = dynamic_cast<const MarioBlock&>(obj);
const auto &m_obj = dynamic_cast<const MarioBlock &>(obj);
remove_block = true;
if ( obj.getId() == source_id &&
m_obj.getType() == source_type &&
getVisitorType() == VisitorType::Character ) {
if (obj.getId() == source_id && m_obj.getType() == source_type &&
getVisitorType() == VisitorType::Character) {
add_block = false;
}
}
}
default:
break;
}