bool ServerConnectDaemon::connectStateWaitForClientGameSetupAck(
        const NetMessage* message )
{
    if ( message != 0 ) {
        if ( message->message_id == _net_message_id_connect_client_game_setup_ack ) {
            PlayerConnectID player_connect_mesg
                (connect_player_state->getNetworkPlayerState());

            SERVER->sendMessage(connect_player_id, &player_connect_mesg,
                    sizeof(PlayerConnectID));
            PlayerInterface::startPlayerStateSync( connect_player_id );

            ConnectProcessStateMessage state_mesg;
            state_mesg.setMessageEnum(_connect_state_message_sync_player_info);
            state_mesg.setPercentComplete(0);
            SERVER->sendMessage(connect_player_id, &state_mesg,
                    sizeof(ConnectProcessStateMessage));
			if(connection_state != connect_state_idle) {
				connection_state = connect_state_player_state_sync;
			}
			return true;
        } else if ( message->message_id == _net_message_id_connect_client_game_setup_ping ) {
            time_out_timer.reset();
            return true;
        }
    }

    if ( time_out_timer.count() ) {
        connect_player_state->setStatus( _player_state_free );
        resetConnectFsm();
    }

    return true;
}
bool ServerConnectDaemon::connectStateWaitForClientGameSetupAck( NetMessage *message )
{
    int send_ret_val;

    if ( message != 0 ) {
        if ( message->message_id == _net_message_id_connect_client_game_setup_ack ) {
            PlayerConnectID player_connect_mesg
                (connect_player_state->getNetworkPlayerState());

            send_ret_val = SERVER->sendMessage(connect_player_id, &player_connect_mesg, sizeof(PlayerConnectID), 0 );

            if( send_ret_val != _network_ok ) {
                connect_player_state->setStatus( _player_state_free );
                resetConnectFsm();
                return( true );
            }

            PlayerInterface::startPlayerStateSync( connect_player_id );

            ConnectProcessStateMessage state_mesg;
            state_mesg.message_enum = _connect_state_message_sync_player_info;
            send_ret_val = SERVER->sendMessage( connect_player_id, &state_mesg,
                                                sizeof(ConnectProcessStateMessage), 0);

            if( send_ret_val != _network_ok ) {
                connect_player_state->setStatus( _player_state_free );
                resetConnectFsm();
                return( true );
            }

            connection_state = _connect_state_player_state_sync;

            SERVER->activateKeepAlive( connect_player_id );
        } else
            if ( message->message_id == _net_message_id_connect_client_game_setup_ping ) {
                time_out_timer.reset();
                return( true );
            } else {
                if ( time_out_timer.count() ) {
                    connect_player_state->setStatus( _player_state_free );
                    resetConnectFsm();
                    return( true );
                }

                return( true );
            }

    } else {
        if ( time_out_timer.count() ) {
            connect_player_state->setStatus( _player_state_free );
            resetConnectFsm();
            return( true );
        }

        return( true );
    }

    return( true );
}
Ejemplo n.º 3
0
    virtual T message(const NetMessage* msg)
    {
        if ( msg->message_id == _net_message_id_connect_client_game_setup_ack )
        {
            PlayerConnectID player_connect_mesg(player->getID());
            connect_client->sendMessage( &player_connect_mesg,
                                         sizeof(PlayerConnectID));

            return connect_state_unit_profile_sync;
        }
        else if ( msg->message_id == _net_message_id_connect_client_game_setup_ping )
        {
            time_out_timer.reset();
        }
        return State<T>::state;
    }