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);
|
Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path);
|
||||||
if (gfx) {
|
if (gfx) {
|
||||||
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, 32, 32);
|
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, 32, 32);
|
||||||
_languageIcons.push_back(scGfx);
|
_languageIcons[l->id] = scGfx;
|
||||||
gfx->free();
|
gfx->free();
|
||||||
delete gfx;
|
delete gfx;
|
||||||
} else {
|
} else {
|
||||||
_languageIcons.push_back(nullptr);
|
_languageIcons[l->id] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,11 +455,11 @@ void GridWidget::loadPlatformIcons() {
|
||||||
Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path);
|
Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path);
|
||||||
if (gfx) {
|
if (gfx) {
|
||||||
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, 32, 32);
|
const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, 32, 32);
|
||||||
_platformIcons.push_back(scGfx);
|
_platformIcons[l->id] = scGfx;
|
||||||
gfx->free();
|
gfx->free();
|
||||||
delete gfx;
|
delete gfx;
|
||||||
} else {
|
} else {
|
||||||
_platformIcons.push_back(nullptr);
|
_platformIcons[l->id] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,8 +90,8 @@ public:
|
||||||
/* GridWidget */
|
/* GridWidget */
|
||||||
class GridWidget : public ContainerWidget, public CommandSender {
|
class GridWidget : public ContainerWidget, public CommandSender {
|
||||||
protected:
|
protected:
|
||||||
Common::Array<const Graphics::ManagedSurface *> _platformIcons;
|
Common::HashMap<int, const Graphics::ManagedSurface *> _platformIcons;
|
||||||
Common::Array<const Graphics::ManagedSurface *> _languageIcons;
|
Common::HashMap<int, const Graphics::ManagedSurface *> _languageIcons;
|
||||||
|
|
||||||
// Images are mapped by filename -> surface.
|
// Images are mapped by filename -> surface.
|
||||||
Common::HashMap<String, const Graphics::ManagedSurface *> _loadedSurfaces;
|
Common::HashMap<String, const Graphics::ManagedSurface *> _loadedSurfaces;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue