PRIVATE: avoid global constructors in initCursors

This commit is contained in:
neuromancer 2021-02-15 09:46:03 -03:00 committed by Eugene Sandulenko
parent a238290c33
commit 216258ed21

View File

@ -315,17 +315,17 @@ static struct CursorDataTable {
static struct CursorPointTable { static struct CursorPointTable {
const char *name; const char *name;
const Common::Point *point; const int coord[2];
} cursorPointTable[] = { } cursorPointTable[] = {
{ "kExit", new Common::Point(9, 0)}, { "kExit", {9, 0} },
{ "kInventory", new Common::Point(15, 3)}, { "kInventory", {15, 3} },
{ "kTurnLeft", new Common::Point(29, 16)}, { "kTurnLeft", {29, 16} },
{ "kTurnRight", new Common::Point(1, 15)}, { "kTurnRight", {1, 15} },
{ "kZoomIn", new Common::Point(10, 8)}, { "kZoomIn", {10, 8} },
{ "kZoomOut", new Common::Point(13, 31)}, { "kZoomOut", {13, 31} },
{ "kPhone", new Common::Point(17, 19)}, { "kPhone", {17, 19} },
{ "default", new Common::Point(0, 0)}, { "default", {0, 0} },
{ 0, 0} { 0, {0, 0} }
}; };
CursorDataMap _cursorData; CursorDataMap _cursorData;
@ -336,10 +336,10 @@ void PrivateEngine::initCursors() {
Common::String *name = new Common::String(cur->name); Common::String *name = new Common::String(cur->name);
_cursorData.setVal(*name, cur->cursor); _cursorData.setVal(*name, cur->cursor);
} }
for (Private::CursorPointTable *cur = Private::cursorPointTable; cur->name; cur++) { for (Private::CursorPointTable *cur = Private::cursorPointTable; cur->name; cur++) {
Common::String *name = new Common::String(cur->name); Common::String *name = new Common::String(cur->name);
Common::Point *point = new Common::Point(*cur->point); Common::Point *point = new Common::Point(cur->coord[0], cur->coord[1]);
_cursorPoints.setVal(*name, point); _cursorPoints.setVal(*name, point);
} }
CursorMan.replaceCursorPalette(cursorPalette, 0, 3); CursorMan.replaceCursorPalette(cursorPalette, 0, 3);