[Scummvm-git-logs] scummvm master -> ccd7f65e5b9b02a5d1a6b0f8dd71131b9b503afa
dreammaster
noreply at scummvm.org
Tue Dec 19 05:48:06 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ccd7f65e5b MM: MM1: Fix GCC ABI Mangling Warnings Caused By Lambda Functions
Commit: ccd7f65e5b9b02a5d1a6b0f8dd71131b9b503afa
https://github.com/scummvm/scummvm/commit/ccd7f65e5b9b02a5d1a6b0f8dd71131b9b503afa
Author: D G Turner (digitall at scummvm.org)
Date: 2023-12-18T19:48:02-10:00
Commit Message:
MM: MM1: Fix GCC ABI Mangling Warnings Caused By Lambda Functions
These warnings are emitted from GCC-13 when -Wabi is passed.
Changed paths:
engines/mm/mm1/maps/map12.cpp
engines/mm/mm1/maps/map12.h
engines/mm/mm1/views/character_info.cpp
engines/mm/mm1/views/character_info.h
engines/mm/mm1/views/spells/cast_spell.cpp
engines/mm/mm1/views/spells/cast_spell.h
engines/mm/mm1/views_enh/character_manage.cpp
engines/mm/mm1/views_enh/character_manage.h
engines/mm/mm1/views_enh/create_characters.cpp
engines/mm/mm1/views_enh/create_characters.h
engines/mm/mm1/views_enh/interactions/interaction_query.cpp
engines/mm/mm1/views_enh/interactions/interaction_query.h
engines/mm/mm1/views_enh/trade.cpp
engines/mm/mm1/views_enh/trade.h
diff --git a/engines/mm/mm1/maps/map12.cpp b/engines/mm/mm1/maps/map12.cpp
index 58b3db01704..87cb1fa3a3a 100644
--- a/engines/mm/mm1/maps/map12.cpp
+++ b/engines/mm/mm1/maps/map12.cpp
@@ -184,6 +184,20 @@ void Map12::polyhedron(unsigned char side1, unsigned char side2) {
send(SoundMessage(msg));
}
+void Map12::keyCallbackSpinPolyhedronTwo() {
+ static_cast<Map12 *>(g_maps->_currentMap)->spinPolyhedron(0);
+ g_maps->_currentMap->updateGame();
+}
+
+void Map12::keyCallbackSpinPolyhedronOne(const Common::KeyState &ks) {
+ if (ks.keycode >= Common::KEYCODE_0 && ks.keycode <= Common::KEYCODE_9) {
+ g_events->close();
+ Map12 &map = *static_cast<Map12 *>(g_maps->_currentMap);
+ map.spinPolyhedron(ks.ascii | 0x80);
+ map.none160();
+ }
+}
+
void Map12::setPolyhedron(int polyIndex) {
_polyIndex = polyIndex;
@@ -191,27 +205,9 @@ void Map12::setPolyhedron(int polyIndex) {
Common::String msg = Common::String::format(
STRING["maps.map12.polyhedron2"].c_str(),
_data[SELECTIONS + polyIndex]);
- send(SoundMessage(
- msg,
- []() {
- static_cast<Map12 *>(g_maps->_currentMap)->spinPolyhedron(0);
- g_maps->_currentMap->updateGame();
- }
- ));
-
+ send(SoundMessage(msg, keyCallbackSpinPolyhedronTwo));
} else {
- send(SoundMessage(
- STRING["maps.map12.polyhedron1"],
- [](const Common::KeyState &ks) {
- if (ks.keycode >= Common::KEYCODE_0 &&
- ks.keycode <= Common::KEYCODE_9) {
- g_events->close();
- Map12 &map = *static_cast<Map12 *>(g_maps->_currentMap);
- map.spinPolyhedron(ks.ascii | 0x80);
- map.none160();
- }
- }
- ));
+ send(SoundMessage(STRING["maps.map12.polyhedron1"], keyCallbackSpinPolyhedronOne));
}
}
diff --git a/engines/mm/mm1/maps/map12.h b/engines/mm/mm1/maps/map12.h
index 5ccc29aacf1..721d2c6ee1b 100644
--- a/engines/mm/mm1/maps/map12.h
+++ b/engines/mm/mm1/maps/map12.h
@@ -33,6 +33,9 @@ class Map12 : public Map {
private:
int _polyIndex = 0;
+ static void keyCallbackSpinPolyhedronTwo();
+ static void keyCallbackSpinPolyhedronOne(const Common::KeyState &ks);
+
void special00();
void special01();
void special02();
diff --git a/engines/mm/mm1/views/character_info.cpp b/engines/mm/mm1/views/character_info.cpp
index cb4df042606..9d6e196799a 100644
--- a/engines/mm/mm1/views/character_info.cpp
+++ b/engines/mm/mm1/views/character_info.cpp
@@ -406,23 +406,22 @@ void CharacterInfo::howMuchEntered(uint amount) {
redraw();
}
+void CharacterInfo::abortFunc() {
+ CharacterInfo *view = (CharacterInfo *)g_events->focusedView();
+ view->howMuchAborted();
+}
+
+void CharacterInfo::enterFunc(const Common::String &text) {
+ CharacterInfo *view = (CharacterInfo *)g_events->focusedView();
+ view->howMuchEntered(atoi(text.c_str()));
+}
+
void CharacterInfo::tradeHowMuch() {
clearLines(20, 24);
escToGoBack(0);
writeString(10, 20, STRING["dialogs.character.how_much"]);
- _textEntry.display(20, 20, 5, true,
- []() {
- CharacterInfo *view =
- (CharacterInfo *)g_events->focusedView();
- view->howMuchAborted();
- },
- [](const Common::String &text) {
- CharacterInfo *view =
- (CharacterInfo *)g_events->focusedView();
- view->howMuchEntered(atoi(text.c_str()));
- }
- );
+ _textEntry.display(20, 20, 5, true, abortFunc, enterFunc);
}
void CharacterInfo::combatUseItem(Inventory &inv, Inventory::Entry &invEntry, bool isEquipped) {
diff --git a/engines/mm/mm1/views/character_info.h b/engines/mm/mm1/views/character_info.h
index 3c77dcc1e5a..a94bfd7ba4f 100644
--- a/engines/mm/mm1/views/character_info.h
+++ b/engines/mm/mm1/views/character_info.h
@@ -49,6 +49,8 @@ private:
int _tradeWith = -1;
TransferKind _tradeKind = TK_GEMS;
TextEntry _textEntry;
+ static void abortFunc();
+ static void enterFunc(const Common::String &text);
private:
/**
* Discards the item at the given index
@@ -84,7 +86,6 @@ private:
* Using an item outside of combat
*/
void nonCombatUseItem(Inventory &inv, Inventory::Entry &invEntry, bool isEquipped);
-
public:
CharacterInfo() : CharacterBase("CharacterInfo") {}
virtual ~CharacterInfo() {}
diff --git a/engines/mm/mm1/views/spells/cast_spell.cpp b/engines/mm/mm1/views/spells/cast_spell.cpp
index fa2fae7db4c..93ec6848f63 100644
--- a/engines/mm/mm1/views/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views/spells/cast_spell.cpp
@@ -79,6 +79,21 @@ void CastSpell::setState(State state) {
draw();
}
+void CastSpell::abortFunc() {
+ CastSpell *view = (CastSpell *)g_events->focusedView();
+ view->close();
+}
+
+void CastSpell::enterSpellLevelFunc(const Common::String &text) {
+ CastSpell *view = (CastSpell *)g_events->focusedView();
+ view->spellLevelEntered(atoi(text.c_str()));
+}
+
+void CastSpell::enterSpellNumberFunc(const Common::String &text) {
+ CastSpell *view = (CastSpell *)g_events->focusedView();
+ view->spellNumberEntered(atoi(text.c_str()));
+}
+
void CastSpell::draw() {
clearSurface();
if (_state == NONE)
@@ -100,34 +115,12 @@ void CastSpell::draw() {
switch (_state) {
case SELECT_SPELL:
_state = NONE;
- _textEntry.display(27, 20, 1, true,
- []() {
- CastSpell *view =
- (CastSpell *)g_events->focusedView();
- view->close();
- },
- [](const Common::String &text) {
- CastSpell *view =
- (CastSpell *)g_events->focusedView();
- view->spellLevelEntered(atoi(text.c_str()));
- }
- );
+ _textEntry.display(27, 20, 1, true, abortFunc, enterSpellLevelFunc);
break;
case SELECT_NUMBER:
_state = NONE;
- _textEntry.display(27, 21, 1, true,
- []() {
- CastSpell *view =
- (CastSpell *)g_events->focusedView();
- view->close();
- },
- [](const Common::String &text) {
- CastSpell *view =
- (CastSpell *)g_events->focusedView();
- view->spellNumberEntered(atoi(text.c_str()));
- }
- );
+ _textEntry.display(27, 21, 1, true, abortFunc, enterSpellNumberFunc);
break;
case SELECT_CHAR:
diff --git a/engines/mm/mm1/views/spells/cast_spell.h b/engines/mm/mm1/views/spells/cast_spell.h
index e04cb6d1372..54f3b443d0a 100644
--- a/engines/mm/mm1/views/spells/cast_spell.h
+++ b/engines/mm/mm1/views/spells/cast_spell.h
@@ -38,6 +38,9 @@ class CastSpell : public SpellView, public MM1::Game::SpellCasting {
private:
State _state = SELECT_SPELL;
TextEntry _textEntry;
+ static void abortFunc();
+ static void enterSpellLevelFunc(const Common::String &text);
+ static void enterSpellNumberFunc(const Common::String &text);
int _spellLevel = -1;
int _spellNumber = -1;
Common::String _spellResult;
diff --git a/engines/mm/mm1/views_enh/character_manage.cpp b/engines/mm/mm1/views_enh/character_manage.cpp
index e7225ea1577..81e9a800b9b 100644
--- a/engines/mm/mm1/views_enh/character_manage.cpp
+++ b/engines/mm/mm1/views_enh/character_manage.cpp
@@ -47,6 +47,16 @@ bool CharacterManage::msgUnfocus(const UnfocusMessage &msg) {
return true;
}
+void CharacterManage::abortFunc() {
+ CharacterManage *view = static_cast<CharacterManage *>(g_events->focusedView());
+ view->setMode(DISPLAY);
+}
+
+void CharacterManage::enterFunc(const Common::String &name) {
+ CharacterManage *view = static_cast<CharacterManage *>(g_events->focusedView());
+ view->setName(name);
+}
+
void CharacterManage::draw() {
assert(g_globals->_currCharacter);
setReduced(false);
@@ -65,16 +75,7 @@ void CharacterManage::draw() {
case RENAME:
_state = DISPLAY;
writeString(80, 172, STRING["dialogs.view_character.name"]);
- _textEntry.display(130, 180, 15, false,
- []() {
- CharacterManage *view = static_cast<CharacterManage *>(g_events->focusedView());
- view->setMode(DISPLAY);
- },
- [](const Common::String &name) {
- CharacterManage *view = static_cast<CharacterManage *>(g_events->focusedView());
- view->setName(name);
- }
- );
+ _textEntry.display(130, 180, 15, false, abortFunc, enterFunc);
break;
case DELETE:
diff --git a/engines/mm/mm1/views_enh/character_manage.h b/engines/mm/mm1/views_enh/character_manage.h
index e50f46b8cb3..1087341c8ac 100644
--- a/engines/mm/mm1/views_enh/character_manage.h
+++ b/engines/mm/mm1/views_enh/character_manage.h
@@ -40,6 +40,8 @@ private:
Common::String _newName;
bool _changed = false;
TextEntry _textEntry;
+ static void abortFunc();
+ static void enterFunc(const Common::String &name);
/**
* Set the mode
@@ -50,7 +52,6 @@ private:
* Set a new name
*/
void setName(const Common::String &newName);
-
public:
CharacterManage();
virtual ~CharacterManage() {}
diff --git a/engines/mm/mm1/views_enh/create_characters.cpp b/engines/mm/mm1/views_enh/create_characters.cpp
index e57df977ad7..82ac33d3ac6 100644
--- a/engines/mm/mm1/views_enh/create_characters.cpp
+++ b/engines/mm/mm1/views_enh/create_characters.cpp
@@ -550,6 +550,18 @@ bool CreateCharacters::msgAction(const ActionMessage &msg) {
return false;
}
+void CreateCharacters::abortFunc() {
+ CreateCharacters *view = static_cast<CreateCharacters *>(g_events->focusedView());
+ view->setState(SELECT_CLASS);
+}
+
+void CreateCharacters::enterFunc(const Common::String &name) {
+ CreateCharacters *view = static_cast<CreateCharacters *>(g_events->focusedView());
+
+ view->_newChar._name = name;
+ view->setState(SAVE_PROMPT);
+}
+
void CreateCharacters::setState(State state) {
_state = state;
@@ -569,20 +581,7 @@ void CreateCharacters::setState(State state) {
if (_state == SELECT_NAME) {
draw();
- _textEntry.display(160, 110, 15, false,
- []() {
- CreateCharacters *view = static_cast<CreateCharacters *>(
- g_events->focusedView());
- view->setState(SELECT_CLASS);
- },
- [](const Common::String &name) {
- CreateCharacters *view = static_cast<CreateCharacters *>(
- g_events->focusedView());
-
- view->_newChar._name = name;
- view->setState(SAVE_PROMPT);
- }
- );
+ _textEntry.display(160, 110, 15, false, abortFunc, enterFunc);
} else {
redraw();
}
diff --git a/engines/mm/mm1/views_enh/create_characters.h b/engines/mm/mm1/views_enh/create_characters.h
index 3518249f336..e0ec2700a92 100644
--- a/engines/mm/mm1/views_enh/create_characters.h
+++ b/engines/mm/mm1/views_enh/create_characters.h
@@ -65,6 +65,8 @@ class CreateCharacters : public ScrollView {
private:
TextEntry _textEntry;
+ static void abortFunc();
+ static void enterFunc(const Common::String &name);
Shared::Xeen::SpriteResource _icons;
State _state = SELECT_CLASS;
NewCharacter _newChar;
diff --git a/engines/mm/mm1/views_enh/interactions/interaction_query.cpp b/engines/mm/mm1/views_enh/interactions/interaction_query.cpp
index 79fffa7b64d..046a5e15be5 100644
--- a/engines/mm/mm1/views_enh/interactions/interaction_query.cpp
+++ b/engines/mm/mm1/views_enh/interactions/interaction_query.cpp
@@ -32,6 +32,16 @@ InteractionQuery::InteractionQuery(const Common::String &name,
_maxChars(maxChars) {
}
+void InteractionQuery::abortFunc() {
+ auto *view = static_cast<InteractionQuery *>(g_events->focusedView());
+ view->answerEntry("");
+}
+
+void InteractionQuery::enterFunc(const Common::String &answer) {
+ auto *view = static_cast<InteractionQuery *>(g_events->focusedView());
+ view->answerEntry(answer);
+}
+
bool InteractionQuery::msgFocus(const FocusMessage &msg) {
Interaction::msgFocus(msg);
_showEntry = dynamic_cast<TextEntry *>(msg._priorView) == nullptr;
@@ -47,16 +57,7 @@ void InteractionQuery::draw() {
int xp = 30; // (_innerBounds.width() / 2) - (_maxChars * 8 / 2);
int yp = (8 + _lines.size()) * 9 - 5;
- _textEntry.display(xp, yp, _maxChars, false,
- []() {
- auto *view = static_cast<InteractionQuery *>(g_events->focusedView());
- view->answerEntry("");
- },
- [](const Common::String &answer) {
- auto *view = static_cast<InteractionQuery *>(g_events->focusedView());
- view->answerEntry(answer);
- }
- );
+ _textEntry.display(xp, yp, _maxChars, false, abortFunc, enterFunc);
}
void InteractionQuery::answerEntry(const Common::String &answer) {
diff --git a/engines/mm/mm1/views_enh/interactions/interaction_query.h b/engines/mm/mm1/views_enh/interactions/interaction_query.h
index 90887026195..1d01e23bfc2 100644
--- a/engines/mm/mm1/views_enh/interactions/interaction_query.h
+++ b/engines/mm/mm1/views_enh/interactions/interaction_query.h
@@ -33,6 +33,8 @@ namespace Interactions {
class InteractionQuery : public Interaction {
private:
TextEntry _textEntry;
+ static void abortFunc();
+ static void enterFunc(const Common::String &answer);
int _maxChars = 0;
protected:
diff --git a/engines/mm/mm1/views_enh/trade.cpp b/engines/mm/mm1/views_enh/trade.cpp
index 32f8bf7ccbd..3edd0df3666 100644
--- a/engines/mm/mm1/views_enh/trade.cpp
+++ b/engines/mm/mm1/views_enh/trade.cpp
@@ -94,6 +94,16 @@ bool Trade::msgAction(const ActionMessage &msg) {
return false;
}
+void Trade::abortFunc() {
+ g_events->close();
+}
+
+void Trade::enterFunc(const Common::String &str) {
+ Trade *view = static_cast<Trade *>(g_events->focusedView());
+ int amount = atoi(str.c_str());
+ view->amountEntered(amount);
+}
+
void Trade::setMode(TradeMode mode) {
_mode = mode;
@@ -111,16 +121,7 @@ void Trade::setMode(TradeMode mode) {
default:
// How much
draw();
- _textEntry.display(70, 157, 5, true,
- []() {
- g_events->close();
- },
- [](const Common::String &str) {
- Trade *view = static_cast<Trade *>(g_events->focusedView());
- int amount = atoi(str.c_str());
- view->amountEntered(amount);
- }
- );
+ _textEntry.display(70, 157, 5, true, abortFunc, enterFunc);
}
}
diff --git a/engines/mm/mm1/views_enh/trade.h b/engines/mm/mm1/views_enh/trade.h
index 4231fd08d24..377ffdf4951 100644
--- a/engines/mm/mm1/views_enh/trade.h
+++ b/engines/mm/mm1/views_enh/trade.h
@@ -36,6 +36,8 @@ private:
TradeMode _mode = TRADE_OPTIONS;
Shared::Xeen::SpriteResource _btnIcons;
TextEntry _textEntry;
+ static void abortFunc();
+ static void enterFunc(const Common::String &str);
/**
* Set the display mode
More information about the Scummvm-git-logs
mailing list