Skip to content

Commit 2ea071a

Browse files
committed
fix potion issues
1. logical error when to use default_potion() 2. resolve the 'object backing the pointer ' warning for potion_view
1 parent 0a86461 commit 2ea071a

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

engine/player/player.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12322,20 +12322,12 @@ std::unique_ptr<expr_t> player_t::create_expression( util::string_view expressio
1232212322

1232312323
if ( splits.size() == 2 && splits[ 0 ] == "potion" )
1232412324
{
12325-
std::string_view potion_view;
12325+
std::string potion_name = potion_str.empty() ? default_potion() : potion_str;
1232612326

12327-
if ( !potion_str.empty() )
12328-
{
12329-
potion_view = potion_str;
12330-
}
12331-
else if ( default_potion().empty() )
12332-
{
12333-
potion_view = default_potion();
12334-
}
12335-
else
12336-
{
12327+
if ( potion_name.empty() )
1233712328
return expr_t::create_constant( expression_str, false );
12338-
}
12329+
12330+
std::string_view potion_view = potion_name;
1233912331

1234012332
if ( util::str_compare_ci( potion_view, splits[ 1 ] ) )
1234112333
return expr_t::create_constant( expression_str, true );

0 commit comments

Comments
 (0)