Skip to content

Commit

Permalink
Show Monster and Artifact names in the popup dialog of the Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ihhub committed Dec 25, 2024
1 parent 7ee9d84 commit d56b816
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/fheroes2/editor/editor_object_popup_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,35 @@ namespace

// This is an invalid object!
assert( 0 );
return "Invalid resource";
break;
}
case MP2::OBJ_ARTIFACT: {
for ( const auto & info : Maps::getObjectsByGroup( Maps::ObjectGroup::ADVENTURE_ARTIFACTS ) ) {
assert( !info.groundLevelParts.empty() );

if ( info.objectType == MP2::OBJ_ARTIFACT && info.groundLevelParts.front().icnIndex == tile.getMainObjectPart().icnIndex
&& info.groundLevelParts.front().icnType == tile.getMainObjectPart().icnType ) {
return MP2::StringObject( MP2::OBJ_ARTIFACT ) + std::string( " - " ) + Artifact( static_cast<int32_t>( info.metadata[0] ) ).GetName();
}
}

// This is an invalid object!
assert( 0 );
break;
}
case MP2::OBJ_MONSTER: {
for ( const auto & info : Maps::getObjectsByGroup( Maps::ObjectGroup::MONSTERS ) ) {
assert( !info.groundLevelParts.empty() );

if ( info.objectType == MP2::OBJ_MONSTER && info.groundLevelParts.front().icnIndex == tile.getMainObjectPart().icnIndex
&& info.groundLevelParts.front().icnType == tile.getMainObjectPart().icnType ) {
return MP2::StringObject( MP2::OBJ_MONSTER ) + std::string( " - " ) + Monster( static_cast<int32_t>( info.metadata[0] ) ).GetMultiName();
}
}

// This is an invalid object!
assert( 0 );
break;
}
default:
break;
Expand Down

0 comments on commit d56b816

Please sign in to comment.