コード例 #1
0
ファイル: ibattle.cpp プロジェクト: cleanrock/springlobby
User& IBattle::OnUserAdded( User& user )
{
	UserList::AddUser( user );
	UserBattleStatus& bs = user.BattleStatus();
	bs.spectator = false;
	bs.ready = false;
	bs.sync = SYNC_UNKNOWN;
	if ( !bs.IsBot() && IsFounderMe() && GetBattleType() == BT_Played ) {
		bs.team = GetFreeTeam( &user == &GetMe() );
		bs.ally = GetFreeAlly( &user == &GetMe() );
		bs.colour = GetFreeColour( user );
	}
	if ( IsFounderMe() && ( ( bs.pos.x < 0 ) || ( bs.pos.y < 0 ) ) ) {
		UserPosition& pos = bs.pos;
		pos = GetFreePosition();
		UserPositionChanged( user );
	}
	if ( !bs.spectator ) {
		PlayerJoinedAlly( bs.ally );
		PlayerJoinedTeam( bs.team );
	}
	if ( bs.spectator && IsFounderMe() ) m_opts.spectators++;
	if ( !bs.spectator && !bs.IsBot() ) {
		if ( bs.ready ) m_players_ready++;
		if ( bs.sync) m_players_sync++;
		if ( !bs.ready || !bs.sync ) m_ready_up_map[user.GetNick()] = time(0);
		if ( bs.ready && bs.sync ) m_players_ok++;
	}
	return user;
}
コード例 #2
0
ファイル: battle.cpp プロジェクト: tvo/springlobby
void Battle::OnRequestBattleStatus()
{
    UserBattleStatus& bs = m_serv.GetMe().BattleStatus();
    bs.team = GetFreeTeam( true );
    bs.ally = GetFreeAlly( true );
    bs.spectator = false;
    bs.colour = sett().GetBattleLastColour();
    // theres some highly annoying bug with color changes on player join/leave.
    if ( !bs.colour.IsOk() ) bs.colour = GetFreeColour( GetMe() );

    SendMyBattleStatus();
}
コード例 #3
0
ファイル: ibattle.cpp プロジェクト: cleanrock/springlobby
wxColour IBattle::GetNewColour() const
{
	return GetFreeColour();
}
コード例 #4
0
ファイル: ibattle.cpp プロジェクト: cleanrock/springlobby
wxColour IBattle::GetFreeColour( User &for_whom ) const
{
	return GetFreeColour( &for_whom );
}