"Player number management."

This commit is contained in:
gyboth 2005-05-14 15:10:25 +00:00
parent 1b83698aa8
commit 62a77c6406
4 changed files with 18 additions and 13 deletions

View File

@ -91,12 +91,12 @@ player_get_position_from_structure(gint structure, gint player_number)
position = PLAYER_POS_GOALIE;
else if(player_number < bound[0] ||
(player_number > 10 &&
player_number < (11 + (const_int("int_team_max_players") - 11) *
player_number < (11 + (const_int("int_team_cpu_max_players") - 11) *
const_float("float_player_pos_bound1"))))
position = PLAYER_POS_DEFENDER;
else if(player_number < bound[1] ||
(player_number > 10 &&
player_number < (11 + (const_int("int_team_max_players") - 11) *
player_number < (11 + (const_int("int_team_cpu_max_players") - 11) *
const_float("float_player_pos_bound2"))))
position = PLAYER_POS_MIDFIELDER;
else

View File

@ -123,7 +123,7 @@ team_generate_players_stadium(Team *tm)
average_skill = CLAMP(average_skill, 0, const_float("float_player_max_skill"));
for(i=0;i<const_int("int_team_max_players");i++)
for(i=0;i<const_int("int_team_cpu_max_players");i++)
{
new = player_new(tm, average_skill, TRUE);
wages += new.wage;
@ -139,13 +139,6 @@ team_generate_players_stadium(Team *tm)
tm->stadium.capacity =
math_round_integer((gint)rint((wages / (gfloat)const_int("int_team_stadium_ticket_price")) *
const_float("float_team_stadium_size_wage_factor")), 2);
/*d*/
/* printf("%30s wag %.0f stadcap %d cap * tick %d diff %d\n", */
/* tm->name->str, wages, tm->stadium.capacity, */
/* tm->stadium.capacity * const_int("int_team_stadium_ticket_price"), */
/* math_round_integer((gint)(2 * wages) - */
/* tm->stadium.capacity * const_int("int_team_stadium_ticket_price"), 3)); */
}
/** Return a certain value from the league or cup struct

View File

@ -141,11 +141,20 @@ user_remove(gint idx, gboolean regenerate_team)
for(i=0;i<usr(idx).tm->players->len;i++)
free_player(&g_array_index(usr(idx).tm->players, Player, i));
g_array_free(usr(idx).tm->players, TRUE);
usr(idx).tm->players = g_array_new(FALSE, FALSE, sizeof(Player));
team_generate_players_stadium(usr(idx).tm);
for(i=0;i<usr(idx).tm->players->len;i++)
g_array_index(usr(idx).tm->players, Player, i).team = usr(idx).tm;
}
free_user(&usr(idx));
g_array_remove_index(users, idx);
cur_user = 0;
game_gui_show_main();
}
void

View File

@ -188,8 +188,11 @@ int_treeview_max_pipes 50
float_player_pos_bound1 3755
float_player_pos_bound2 7510
# maximum number of players in a team.
# maximum number of players in a user team.
int_team_max_players 20
# maximum number of players in cpu teams. should be
# less or equal int_team_max_players
int_team_cpu_max_players 20
# highest skill and talent a player can have.
float_player_max_skill 990000
@ -660,10 +663,10 @@ int_transfer_new_players_upper 4
int_transfer_time_lower 3
int_transfer_time_upper 5
# percentage of players from international cup teams
float_transfer_cup_percentage 2500
float_transfer_cup_percentage 8000#2500
# restrictions applying to very good players
float_transfer_good_player_skill_bound 9000
float_transfer_good_player_prob 2500
float_transfer_good_player_prob 5000
# scout deviance in percent of the players' values and wages
# these values are the deviance for the best scout; the others