iOS Port


#21

Hmm… Not sure what’s causing that. Does our function list has several += operators? Can you post entire output from compiler? It usually has messages like this: “Candidate overload A failed, reason B”


#22

here’s the entire thing

vcmi-ios/client/CHeroWindow.cpp:296:6: error: no viable overloaded '+='
        ony += std::bind(&CCallback::dismissHero, LOCPLINT->cb.get(), curHero);
        ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from vcmi-ios/client/CHeroWindow.cpp:4:
In file included from vcmi-ios/client/CAdvmapInterface.h:6:
In file included from vcmi-ios/client/gui/CIntObjectClasses.h:5:
/Users/Dave/Documents/vcmi-ios/ios/../client/gui/../../lib/FunctionList.h:35:18: note: candidate function not viable: no known conversion from '__bind<bool (CCallback::*)(const CGHeroInstance *), CCallback *, const CGHeroInstance *&>' to 'const std::function<void ()>' for 1st argument
        CFunctionList & operator+=(const std::function<Signature> &first)

                               ^

#23

Wow, Heroes on iPad. I think idimiter lost enthusiasm? Who else wants to make a normal port on the iOS? It would be very cool!


#24

BTW, through VCMI (android) may play on the Internet?


#25

Davenger,
Looks to be yet another result of our switch from boost to std.

Replacing that line with this should help:

ony += =] { LOCPLINT->cb.get()->dismissHero(curHero); };

(unless I missed something)

Can you try to make this change and see if vcmi will compile fine now?


#26

Ivan,
thank you for answering,building goes much further now but there are still some errors,i am getting the following 3 errors now

vcmi-ios/client/GUIClasses.cpp:1308:28:
		buttons.back()->callback += std::bind(&CCallback::selectionMade,LOCPLINT->cb.get(),0,askID);                  No viable overloaded '+='
vcmi-ios/lib/FunctionList.h:35:18: Candidate function not viable: no known conversion from '__bind<int (CCallback::*)(int, QueryID), CCallback *, int, QueryID &>' to 'const std::function<void ()>' for 1st argument
vcmi-ios/lib/FunctionList.h:26:19: No matching conversion for functional-style cast from 'const std::__1::__bind<bool (CCallback::*)(const CGHeroInstance *, ArtifactPosition, bool, ArtifactID), CCallback *, const CGHeroInstance *&, ArtifactPosition &, bool, const ArtifactID &>' to 'std::function<void ()>'
/Users/Dave/Documents/vcmi-ios/lib/FunctionList.h:26:19: No matching conversion for functional-style cast from 'const std::__1::__bind<bool (CCallback::*)(const CGHeroInstance *, ArtifactPosition, bool, ArtifactID), CCallback *, const CGHeroInstance *&, ArtifactPosition &, bool, ArtifactID>' to 'std::function<void ()>'

#27
buttons.back()->callback += =] { LOCPLINT->cb.get()->selectionMade(0, askID); };

If there are further errors can you either comment-out offending lines (just add double slash at start - “//” ) or if you’re running “make” command manually - add “-k” switch to it, e.g. “make -k” so compilation won’t terminate and will eventually give you all problematic locations.

These fixes are trivial but I can’t think of some way to detect them on my side. You’ll have to provide me such list before I can commit fixes to github.


#28

thankfully there are only 2 errors left(finally found out the damn Xcode ignore error),one of which,oddly enough,is in bind.hpp in the boost library,i’ll try building boost personally with the same Xcode version since it’s finicky as hell and see what goes but i’ll post it here anyway:

In file included from vcmi-ios/client/GUIClasses.cpp:2:
In file included from vcmi-ios/client/GUIClasses.h:4:
vcmi-ios/client/../lib/FunctionList.h:26:19: error: no matching conversion for functional-style cast from 'const std::__1::__bind<bool (CCallback::*)(const CGHeroInstance *, ArtifactPosition, bool, ArtifactID), CCallback *, const CGHeroInstance *&, ArtifactPosition &, bool, const ArtifactID &>' to 'std::function<void ()>'
 
vcmi-ios/ios/deps/boost.framework/Headers/bind/bind.hpp:313:8: error: no matching function for call to object of type 'boost::_mfi::mf1<void, CBonusSelection, int>'
       unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~

it would also be helpful to know what version of boost is used for vcmi to avoid compatibility errors


#29

Hmm… What version of VCMI are you trying to make work? First two compile errors that you posted before are already fixed in git.

As for your last post:

  1. Again, post all compiler output. Templates usually produce quite big error messages so you need to track location of an actual error.
  2. As far as I know, VCMI should no longer include boost::bind and use only standard library here.

#30

i am building from idimter’s iOS branch posted in the last page and going from there,also as for the compiler output

In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:1:
In file included from /Users/Dave/Documents/vcmi-ios/client/StdInc.h:3:
In file included from /Users/Dave/Documents/vcmi-ios/client/../Global.h:113:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/thread.hpp:13:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/thread/thread.hpp:22:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/thread/detail/thread.hpp:29:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind.hpp:22:
/Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/bind.hpp:313:8: error: no matching function for call to object of type 'boost::_mfi::mf1<void, CBonusSelection, int>'
       unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:1:
In file included from /Users/Dave/Documents/vcmi-ios/client/StdInc.h:3:
In file included from /Users/Dave/Documents/vcmi-ios/client/../Global.h:113:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/thread.hpp:13:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/thread/thread.hpp:22:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/thread/detail/thread.hpp:29:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind.hpp:22:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/bind.hpp:873:
/Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/bind_template.hpp:47:27: note: in instantiation of function template specialization 'boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > >::operator()<boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list1<const int &> >' requested here
        BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
                          ^
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:1:
In file included from /Users/Dave/Documents/vcmi-ios/client/StdInc.h:3:
In file included from /Users/Dave/Documents/vcmi-ios/client/../Global.h:61:
In file included from /Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:627:
In file included from /Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:601:
/Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base:413:12: note: in instantiation of function template specialization 'boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > >::operator()<int>' requested here
    return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
           ^
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:1:
In file included from /Users/Dave/Documents/vcmi-ios/client/StdInc.h:3:
In file included from /Users/Dave/Documents/vcmi-ios/client/../Global.h:58:
In file included from /Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstdio:99:
/Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:345:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:1:
In file included from /Users/Dave/Documents/vcmi-ios/client/StdInc.h:3:
In file included from /Users/Dave/Documents/vcmi-ios/client/../Global.h:67:
/Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1370:12: note: in instantiation of function template specialization 'std::__1::__invoke<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > > &, int>' requested here
    return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
           ^
/Users/Dave/Documents/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1596:26: note: in instantiation of member function 'std::__1::__function::__func<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > >, std::__1::allocator<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > > >, void (int)>::operator()' requested here
            ::new (__f_) _FF(_VSTD::move(__f));
                         ^
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:2:
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.h:6:
In file included from /Users/Dave/Documents/vcmi-ios/client/GUIClasses.h:4:
/Users/Dave/Documents/vcmi-ios/client/../lib/FunctionList.h:26:25: note: in instantiation of function template specialization 'std::__1::function<void (int)>::function<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > > >' requested here
        funcs.push_back(std::function<Signature>(f));
                        ^
/Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:3193:43: note: in instantiation of function template specialization 'CFunctionList<void (int)>::CFunctionList<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > > >' requested here
        bonuses = new CHighlightableButtonsGroup(boost::bind(&CBonusSelection::selectBonus, this, _1));
                                                 ^
In file included from /Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:1:
In file included from /Users/Dave/Documents/vcmi-ios/client/StdInc.h:3:
In file included from /Users/Dave/Documents/vcmi-ios/client/../Global.h:94:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/algorithm/string.hpp:23:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/algorithm/string/split.hpp:16:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/algorithm/string/iter_find.hpp:27:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/algorithm/string/find_iterator.hpp:24:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/algorithm/string/detail/find_iterator.hpp:18:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/function.hpp:24:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/function/detail/prologue.hpp:18:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/mem_fn.hpp:22:
In file included from /Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/mem_fn.hpp:215:
/Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/mem_fn_template.hpp:163:7: note: candidate function not viable: no known conversion from 'std::__1::placeholders::__ph<1>' to 'int' for 2nd argument
    R operator()(T * p, A1 a1) const
      ^
/Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/mem_fn_template.hpp:168:25: note: candidate function [with U = CBonusSelection *] not viable: no known conversion from 'std::__1::placeholders::__ph<1>' to 'int' for 2nd argument
    template<class U> R operator()(U & u, A1 a1) const
                        ^
/Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/mem_fn_template.hpp:176:25: note: candidate function [with U = CBonusSelection *] not viable: no known conversion from 'std::__1::placeholders::__ph<1>' to 'int' for 2nd argument
    template<class U> R operator()(U const & u, A1 a1) const
                        ^
/Users/Dave/Documents/vcmi-ios/ios/deps/boost.framework/Headers/bind/mem_fn_template.hpp:184:7: note: candidate function not viable: no known conversion from 'CBonusSelection *' to 'CBonusSelection &' for 1st argument; dereference the argument with *
    R operator()(T & t, A1 a1) const
      ^
18 warnings and 1 error generated.

#31

gah incredibly sorry about this i thought scroll would have a scrollbar cause of the big amount of text


#32

And here is your offender:

/Users/Dave/Documents/vcmi-ios/client/CPreGame.cpp:3193:43: note: in instantiation of function template specialization 'CFunctionList<void (int)>::CFunctionList<boost::_bi::bind_t<void, boost::_mfi::mf1<void, CBonusSelection, int>, boost::_bi::list2<boost::_bi::value<CBonusSelection *>, boost::_bi::value<std::__1::placeholders::__ph<1> > > > >' requested here 
         bonuses = new CHighlightableButtonsGroup(boost::bind(&CBonusSelection::selectBonus, this, _1));

Replacing boost::bind with std::bind should help but again - this was already fixed in git. I suggest rebasing* his branch on our current code to get all necessary fixes.

  • actually, in terms of git rebasing likely won’t work - you’ll have to merge changes from our main repo onto yours

#33

thank’s for the help,just 1 last error that i posted above remains,for the full log i went ahead and posted it on paste bin to avoid cluttering the thread anymore,once it builds and i can test it working on x64 and regular iOS devices i’ll try to merge the ios-specific fixes to the main repo
ur1.ca/ireuc


#34

nothing to show of nearly 2 weeks of trying to fix it.


#35

Hello, guys.
I’m sorry for my very late response. But I’ve started working on a huge game and almost have no time for anything else right now. I have not merged the main branch for very long time now and I think some parts of my fork need fixing. If someone in the meantime manage to get it running I’ll be happy to accept a PR on github.

Currently the game only works on a jailbroken devices and data needs to be in the main Documents directory in order to run it. I’ll think of a way to distribute the compiled .ipa file without using iTunes store.

I promise that once I got back to work on this project I will let you know via this post.


#36

if you can provide an ipa i would be more than happy to it on my cydia repo,it shouldn’t take more than 3 minutes to make a proper package out of it


#37

People, I believe in you, because there is only RoE by Ubisoft without addons :frowning:


#38

Hi All,
I create fork of Vcmi and port to iOS last source from original project also make base support localization (but can have crash for non English , in progres). See github.com/COJIDAT/vcmi-ios


#39

Tested under iPad and for build use Xcode 6 (last versio) and OSX 10.10


#40

Hi all.
Instruction
After installation you need copy some folders and files to Documents directory. You can copy by iTunes (i share Documents folder for this application).
Need following folder structures in Document directory:
Data
Maps
Mp3
config
Games
Mods

In Data folder copy H3*.snd,H3*.vid,H3*.lod,VIDEO.VID files from original HMM3 game
In Maps folder copy maps files from origin game (*.h3m)
In Mods folder copy vcmi folder from Mods folder in sources.
In MP3 folder copy MP3 folder from origin games.
in config folder copy config folder from source code.
After that you can start test/game.
Enjoy