GUI: Replace enum-indexed arrays with HashMaps
This commit is contained in:
parent
498e3bf2fc
commit
c9b8cb1a0e
2 changed files with 6 additions and 6 deletions
|
@ -439,11 +439,11 @@ void GridWidget::loadFlagIcons() {
|
|||
Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path);
|
||||
if (gfx) {
|
||||
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, 32, 32);
|
||||
_languageIcons.push_back(scGfx);
|
||||
_languageIcons[l->id] = scGfx;
|
||||
gfx->free();
|
||||
delete gfx;
|
||||
} else {
|
||||
_languageIcons.push_back(nullptr);
|
||||
_languageIcons[l->id] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -455,11 +455,11 @@ void GridWidget::loadPlatformIcons() {
|
|||
Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path);
|
||||
if (gfx) {
|
||||
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, 32, 32);
|
||||
_platformIcons.push_back(scGfx);
|
||||
_platformIcons[l->id] = scGfx;
|
||||
gfx->free();
|
||||
delete gfx;
|
||||
} else {
|
||||
_platformIcons.push_back(nullptr);
|
||||
_platformIcons[l->id] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,8 +90,8 @@ public:
|
|||
/* GridWidget */
|
||||
class GridWidget : public ContainerWidget, public CommandSender {
|
||||
protected:
|
||||
Common::Array<const Graphics::ManagedSurface *> _platformIcons;
|
||||
Common::Array<const Graphics::ManagedSurface *> _languageIcons;
|
||||
Common::HashMap<int, const Graphics::ManagedSurface *> _platformIcons;
|
||||
Common::HashMap<int, const Graphics::ManagedSurface *> _languageIcons;
|
||||
|
||||
// Images are mapped by filename -> surface.
|
||||
Common::HashMap<String, const Graphics::ManagedSurface *> _loadedSurfaces;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue