Hello everyone,
I'm currently working through the SFML game dev book but I stumbled upon a problem that I can't seem to fix.
This is the method that handles initializing the actions.
void Player::initializeActions()
{
m_ActionBinding[MoveRight].action = derivedAction<Aircraft>(AircraftMover(1, 0.f));
m_ActionBinding[MoveLeft].action = derivedAction<Aircraft>(AircraftMover(-1, 0.f));
m_ActionBinding[MoveUp].action = derivedAction<Aircraft>(AircraftMover(0.f, -1));
m_ActionBinding[MoveDown].action = derivedAction<Aircraft>(AircraftMover(0.f, 1));
m_ActionBinding[Fire].action = derivedAction<Aircraft>(std::bind(&Aircraft::fire, std::placeholders::_1));
}
When I compile I get this error:
Error 1 error C3848: expression having type 'const std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Aircraft::* )(void),void,Aircraft,>,std::_Ph<1> &>' would lose some const-volatile qualifiers in order to call 'void std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Aircraft::* )(void),void,Aircraft,>,std::_Ph<1> &>::operator ()<GameObject&,sf::Time&>(GameObject &,sf::Time &)' e:\_gamedevelopment\sfml\sfml_flyinggame\command.h 24
this is the method I'm trying to bind:
void Aircraft::fire()
{
if (Table[m_Type].fireInterval != sf::Time::Zero)
{
m_IsFiring = true;
}
}
I'm using Visual studio 2013 ( and it's compiler).
Thanks in advance.