Exemple #1
0
boost::statechart::result
sanguis::client::states::has_player::react(
	sanguis::client::events::action const &_event
)
{
	action_handler_->handle_action(
		_event.value()
	);

	return
		this->discard_event();
}
Exemple #2
0
boost::statechart::result
sanguis::client::states::perk_chooser::react(
	sanguis::client::events::action const &_event
)
{
	return
		fcppt::optional::maybe(
			fcppt::variant::to_optional<
				sanguis::client::control::actions::nullary
			>(
				_event.value().get()
			),
			[
				this
			]{
				return
					this->forward_event();
			},
			[
				this
			](
				sanguis::client::control::actions::nullary const &_nullary
			)
			{
				switch(
					_nullary.type()
				)
				{
				case sanguis::client::control::actions::nullary_type::perk_menu:
					return
						this->transit<
							sanguis::client::states::ingame
						>();
				case sanguis::client::control::actions::nullary_type::change_world:
				case sanguis::client::control::actions::nullary_type::console:
				case sanguis::client::control::actions::nullary_type::drop_primary_weapon:
				case sanguis::client::control::actions::nullary_type::drop_secondary_weapon:
				case sanguis::client::control::actions::nullary_type::escape:
				case sanguis::client::control::actions::nullary_type::reload_primary_weapon:
				case sanguis::client::control::actions::nullary_type::reload_secondary_weapon:
					return
						this->forward_event();
				}

				FCPPT_ASSERT_UNREACHABLE;
			}
		);
}
boost::statechart::result
sanguis::client::states::waiting_for_player::react(
    sanguis::client::events::action const &_event
)
{
    fcppt::optional::maybe_void(
        fcppt::variant::to_optional<
        sanguis::client::control::actions::nullary
        >(
            _event.value().get()
        ),
        [
            this
        ](
            sanguis::client::control::actions::nullary const &_nullary
        )
    {
        switch(
            _nullary.type()
        )
        {
        case sanguis::client::control::actions::nullary_type::escape:
            context<
            sanguis::client::machine
            >().quit();

            return;
        case sanguis::client::control::actions::nullary_type::console:
        case sanguis::client::control::actions::nullary_type::change_world:
        case sanguis::client::control::actions::nullary_type::drop_primary_weapon:
        case sanguis::client::control::actions::nullary_type::drop_secondary_weapon:
        case sanguis::client::control::actions::nullary_type::perk_menu:
        case sanguis::client::control::actions::nullary_type::reload_primary_weapon:
        case sanguis::client::control::actions::nullary_type::reload_secondary_weapon:
            return;
        }

        FCPPT_ASSERT_UNREACHABLE;
    }
    );

    return
        this->discard_event();
}