void WorldMap::balance() { Uint32 now = SDL_GetTicks(); if ( now - last_balance < sd->load_balance_limit ) return; last_balance = now; if( !strcmp( sd->algorithm_name, "static" ) ) return; n_players = 0; for( int i = 0; i < sd->num_threads; i++ ) n_players += players[i].size(); if( n_players == 0 ) return; if( !strcmp( sd->algorithm_name, "lightest" ) ) return balance_lightest(); if( !strcmp( sd->algorithm_name, "spread" ) ) return balance_spread(); printf("Algorithm %s is not implemented.\n", sd->algorithm_name); return; }
int loadb_balance( int cycle ) { if( sv.balance_type == BALANCE_NONE_T ) balance_none(); else if( sv.balance_type == BALANCE_STATIC1_T ) balance_static1(cycle); else if( sv.balance_type == BALANCE_STATIC2_T ) balance_static2(cycle); else if( sv.balance_type == BALANCE_STATIC3_T ) balance_static3(cycle); else if( sv.balance_type == BALANCE_LIGHTEST_T ) balance_lightest(cycle); else if( sv.balance_type == BALANCE_SPREAD_T ) balance_spread(cycle); else if( sv.balance_type == BALANCE_QUADTREE_T ) balance_quad(cycle); else if( sv.balance_type == BALANCE_AREATREE_T ) balance_areatree(cycle); else if( sv.balance_type == BALANCE_GRAPH_T ) balance_graph(cycle); else if( sv.balance_type == BALANCE_AOIGRAPH_T ) balanceAOI(); else if( sv.balance_type == BALANCE_LOSGRAPH_T ) balanceLOS(); else assert(0); loadb_print_results( cycle ); return 1; }