iOS Port

@dimi.t.d Check out your mailbox. I would like to help you with iOS port.

For anyone interested. My fork of the project is at:
github.com/idimiter/vcmi

It currently works on jailbroken devices when runned outside the sandbox. I need to make some cleanup and will make a pull request to the main repo.

After that I’m thinking to help with some bugfixing to the vcmi team

Out of curiosity…does anyone think HOMM3 will make it to the App Store on the iPad?

I am thinking about simply buying a laptop to play H3 on but it would be nice to be able to play on my ipad instead.

You all are incredible for doing this project. Heroes 3 is my all time favorite game and I still play it often. Keep up the excellent work! I wish I had the expertise to match my ambition for this project so I could contribute.

I was wondering if you could give some instructions on how to install this cause i’d love to try it out

trying to compile this with xcode 6 but i am getting the following error

In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:626:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:277:5: error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const
pair(const pair& __p) = default;

Posting message at the end of template chain never helped anyone. Try to find which piece of VCMI code causes this behavior.

well that actually turned out to be a problem with the latest Xcode,reverting to a previous version makes it advance quite a bit and give this error:
CHeroWindow.cpp:

	ony += std::bind(&CCallback::dismissHero, LOCPLINT->cb.get(), curHero);
vcmi/client/CHeroWindow.cpp:296:6: No viable overloaded '+='

welp,still stuck on the same error

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”

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)

                               ^

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!

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

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?

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 ()>'
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.

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

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.

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.

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

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