Mario: fix modifier deletion

This commit is contained in:
2021-08-07 12:13:23 +02:00
parent 7b1ef25f37
commit 6238022ed2
8 changed files with 88 additions and 77 deletions
+6 -6
View File
@@ -93,17 +93,17 @@ void ToolVisitor::visit( const SDLPP::RenderObject &obj ) {
auto id = obj.getCollisions()[0]->getId();
switch ( id ) {
case EDITOR_TERRAIN_ID: {
const MarioBlock &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.getType() == source_type &&
getVisitorType() == VisitorType::Terrain) || ( m_obj.getData() == _data && getVisitorType() == VisitorType::Modifier))) {
add_block = false;
}
}
break;
case EDITOR_CHARACTER_ID: {
const MarioBlock &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 &&
@@ -115,9 +115,9 @@ void ToolVisitor::visit( const SDLPP::RenderObject &obj ) {
break;
}
}
bool ToolVisitor::addBlock() {
bool ToolVisitor::addBlock() const {
return add_block;
}
bool ToolVisitor::removeBlock() {
bool ToolVisitor::removeBlock() const {
return remove_block;
}