mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-12-03 21:28:07 +00:00
Tweak this weird hack for the benefit of MSVC.
MSVC wrongly complains about the old version:
game.cpp(6802): error C2664: 'std::pair<hr::cell *,hr::eItem> std::make_pair<hr::cell*&,hr::eItem&>(_Ty1,_Ty2)':
cannot convert argument 2 from 'hr::eItem' to 'hr::eItem &'
with
[
_Ty1=hr::cell *&,
_Ty2=hr::eItem &
]
And MSVC wrongly complains about this alternative:
conformal::findhistory.emplace_back(c2, int(c2->item));
error: no matching function for call to 'std::pair<hr::cell*, hr::eItem>::pair(hr::cell*&, int)'
And MinGW wrongly complains about these alternatives:
game.cpp:6801:49: error: cannot bind bitfield 'c2->hr::cell::<anonymous>.hr::gcell::item' to 'hr::eItem&'
conformal::findhistory.emplace_back(c2, c2->item);
~~~~^~~~
game.cpp:6801:47: error: cannot bind bitfield 'c2->hr::cell::<anonymous>.hr::gcell::item' to 'hr::eItem&'
conformal::findhistory.push_back({c2, c2->item});
~~~~^~~~
This commit is contained in:
5
game.cpp
5
game.cpp
@@ -6822,8 +6822,9 @@ bool collectItem(cell *c2, bool telekinesis) {
|
||||
|
||||
if(dopickup && c2->item) {
|
||||
#ifdef HASLINEVIEW
|
||||
// (eItem) to avoid the "cannot bind bitfield" problem in C++11
|
||||
conformal::findhistory.push_back(make_pair(c2, (eItem) c2->item));
|
||||
// temporary variable to avoid the "cannot bind bitfield" problem in C++11
|
||||
eItem dummy = c2->item;
|
||||
conformal::findhistory.emplace_back(c2, dummy);
|
||||
#endif
|
||||
c2->item = itNone;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user