1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +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:
Arthur O'Dwyer 2018-06-27 16:46:26 -07:00
parent 5fa9dcaab5
commit eac2ce1168

View File

@ -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;
}