Permalink
Browse files

invlet_cache: set should be no-op when present

The old set implementation would move an existing invlet to the end of
the list if it was already present, which we don't want.  Now set is
explicitly a no-op if that invlet was already associated with that item.
  • Loading branch information...
jbytheway committed Dec 4, 2018
1 parent b1d8f4f commit 34f80d92db4278d8bf98cc639f7dc91b0ec2d021
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/inventory.cpp
@@ -50,6 +50,9 @@ invlet_preferences::invlet_preferences( std::unordered_map<itype_id, std::string

void invlet_preferences::set( char invlet, itype_id id )
{
if( contains( invlet, id ) ) {
return;
}
erase( invlet );
uint8_t invlet_u = invlet;
ids_by_invlet[invlet_u] = id;

0 comments on commit 34f80d9

Please sign in to comment.