O'Reilly logo
  • LI WEI thinks this is interesting:

As a data representation, we can use the TMap<FString, int> items covered in the previous chapter to store our items. When the player picks up an item, we add it to the map. If the item is already in the map, we just increase its value by the quantity of the new items picked up.

From

Cover of Learning C++ by Creating Games with UE4

Note

用map来存放道具,如果背包中没有,就新增,如果有就将其数量增加。