Browse Source

Fix merging order of sprite sheets when combining styles.

Michael Ragazzon 4 years ago
parent
commit
fd3b35f0f1
2 changed files with 3 additions and 3 deletions
  1. 1 1
      Include/RmlUi/Core/Spritesheet.h
  2. 2 2
      Source/Core/StyleSheet.cpp

+ 1 - 1
Include/RmlUi/Core/Spritesheet.h

@@ -78,7 +78,7 @@ public:
 	/// Note: The pointer is invalidated whenever another sprite is added. Do not store it around.
 	const Sprite* GetSprite(const String& name) const;
 
-	/// Merge 'other' into this.
+	/// Merge 'other' into this. Sprites in 'other' will overwrite local sprites if they share the same name.
 	void Merge(const SpritesheetList& other);
 
 	void Reserve(size_t size_sprite_sheets, size_t size_sprites);

+ 2 - 2
Source/Core/StyleSheet.cpp

@@ -89,8 +89,8 @@ UniquePtr<StyleSheet> StyleSheet::CombineStyleSheet(const StyleSheet& other_shee
 		spritesheet_list.NumSpriteSheets() + other_sheet.spritesheet_list.NumSpriteSheets(),
 		spritesheet_list.NumSprites() + other_sheet.spritesheet_list.NumSprites()
 	);
-	new_sheet->spritesheet_list = other_sheet.spritesheet_list;
-	new_sheet->spritesheet_list.Merge(spritesheet_list);
+	new_sheet->spritesheet_list = spritesheet_list;
+	new_sheet->spritesheet_list.Merge(other_sheet.spritesheet_list);
 
 	new_sheet->specificity_offset = specificity_offset + other_sheet.specificity_offset;
 	return new_sheet;