mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-03-14 01:30:10 +01:00
Live game development.
This commit is contained in:
parent
36b43c895a
commit
5ea95f38e9
12
src/game.c
12
src/game.c
@ -248,9 +248,6 @@ game_initialize(Fixture *fix)
|
||||
if(player_of(fix->teams[i], j)->cskill > 0)
|
||||
player_games_goals_set(player_of(fix->teams[i], j), fix->clid,
|
||||
PLAYER_VALUE_GAMES, 1, TRUE);
|
||||
|
||||
if(player_card_get(player_of(fix->teams[i], j), fix->clid, PLAYER_VALUE_CARD_RED) > 0)
|
||||
player_card_set(player_of(fix->teams[i], j), fix->clid, PLAYER_VALUE_CARD_RED, -1, TRUE);
|
||||
}
|
||||
|
||||
player_of(fix->teams[i], j)->participation =
|
||||
@ -558,7 +555,7 @@ game_player_get_ban_duration(void)
|
||||
|
||||
for(i=1;i<6;i++)
|
||||
if(duration_probs[i - 1] < rndom && rndom < duration_probs[i])
|
||||
return i;
|
||||
return i + 1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -981,10 +978,11 @@ game_post_match(Fixture *fix)
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
if(team_is_user(fix->teams[i]) == -1)
|
||||
if(team_is_user(fix->teams[i]) == -1 &&
|
||||
fix->teams[i]->clid == fix->clid)
|
||||
team_update_cpu_team(fix->teams[i],
|
||||
(fixture_user_team_involved(fix) != -1));
|
||||
else if(fix->teams[i]->clid == fix->clid)
|
||||
team_update_post_match(fix->teams[i]);
|
||||
else
|
||||
team_update_post_match(fix->teams[i], fix->clid);
|
||||
}
|
||||
}
|
||||
|
32
src/player.c
32
src/player.c
@ -172,7 +172,6 @@ player_assign_value(const Player *pl)
|
||||
(1 - const_float("float_player_value_skill_weight")) * pl->talent * 0.7),
|
||||
const_float("float_player_value_power"));
|
||||
|
||||
/*todooooo*/
|
||||
if(diff > const_float("float_player_peak_age_diff_older1"))
|
||||
value = (gint)rint((gfloat)value * (1 - const_float("float_player_value_scale1")));
|
||||
else if(diff > const_float("float_player_peak_age_diff_peak_older"))
|
||||
@ -187,8 +186,8 @@ player_assign_value(const Player *pl)
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Assign a value to a player. The value depends on skill,
|
||||
talent and age.
|
||||
/** Assign a wage to a player. The wage depends mainly on
|
||||
the value.
|
||||
@param pl The player we examine.
|
||||
@return The wage of the player. */
|
||||
gint
|
||||
@ -895,6 +894,7 @@ player_update_skill(Player *pl)
|
||||
|
||||
pl->skill = CLAMP(pl->skill, 0, pl->talent);
|
||||
pl->cskill = player_get_cskill(pl, pl->cpos);
|
||||
pl->value = player_assign_value(pl);
|
||||
|
||||
for(i=0;i<QUALITY_END;i++)
|
||||
if(pl->skill > pl->etal[i])
|
||||
@ -942,17 +942,16 @@ player_remove_from_team(Team *tm, gint idx)
|
||||
|
||||
/** Make some player updates after a match
|
||||
for user players.
|
||||
@param pl The player we update. */
|
||||
@param pl The player we update.
|
||||
@param clid The fixture clid. */
|
||||
void
|
||||
player_update_post_match(Player *pl)
|
||||
player_update_post_match(Player *pl, gint clid)
|
||||
{
|
||||
Fixture *fix = team_get_next_fixture(pl->team);
|
||||
|
||||
if(pl->health == 0)
|
||||
player_update_fitness(pl);
|
||||
else if(pl->cskill == 0 &&
|
||||
(fix == NULL || player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_RED) == 0))
|
||||
pl->cskill = player_get_cskill(pl, pl->cpos);
|
||||
|
||||
if(player_card_get(pl, clid, PLAYER_VALUE_CARD_RED) > 0)
|
||||
player_card_set(pl, clid, PLAYER_VALUE_CARD_RED, -1, TRUE);
|
||||
}
|
||||
|
||||
/** Replace a player by a new one in a cpu team. */
|
||||
@ -973,3 +972,16 @@ player_replace_by_new(Player *pl)
|
||||
player_remove_from_team(tm, idx);
|
||||
g_array_insert_val(tm->players, idx, new);
|
||||
}
|
||||
|
||||
/** Update players in user teams.
|
||||
@param tm The team of the player.
|
||||
@param idx The index in the players array. */
|
||||
/*d maybe argument player pointer?*/
|
||||
void
|
||||
player_update_week_roundly(Team *tm, gint idx)
|
||||
{
|
||||
Player *pl = player_of(tm, idx);
|
||||
|
||||
pl->cskill = (pl->health > 0 || player_is_banned(pl) > 0) ?
|
||||
0 : player_get_cskill(pl, pl->cpos);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void
|
||||
player_update_fitness(Player *pl);
|
||||
|
||||
void
|
||||
player_update_post_match(Player *pl);
|
||||
player_update_post_match(Player *pl, gint clid);
|
||||
|
||||
void
|
||||
player_replace_by_new(Player *pl);
|
||||
@ -127,4 +127,7 @@ player_replace_by_new(Player *pl);
|
||||
void
|
||||
player_remove_from_team(Team *tm, gint idx);
|
||||
|
||||
void
|
||||
player_update_week_roundly(Team *tm, gint idx);
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,7 @@ WeekFunc end_week_round_funcs[] =
|
||||
/** Array of functions called when a week round
|
||||
is started. */
|
||||
WeekFunc start_week_round_funcs[] =
|
||||
{NULL};
|
||||
{start_week_round_update_user_teams, NULL};
|
||||
|
||||
/** Array of functions called when a week
|
||||
is started. */
|
||||
@ -273,8 +273,8 @@ start_week_round(void)
|
||||
start_func++;
|
||||
}
|
||||
|
||||
if(!user_games_this_week_round())
|
||||
end_week_round();
|
||||
/* if(!user_games_this_week_round()) */
|
||||
/* end_week_round(); */
|
||||
}
|
||||
|
||||
/** Start a new week. */
|
||||
@ -290,7 +290,7 @@ start_week(void)
|
||||
}
|
||||
}
|
||||
|
||||
/** Fitness increase etc. of players.
|
||||
/** Age increase etc. of players.
|
||||
CPU teams get updated at the end of their matches
|
||||
(to avoid cup teams getting updated too often). */
|
||||
void
|
||||
@ -301,3 +301,14 @@ start_week_update_user_teams(void)
|
||||
for(i=0;i<users->len;i++)
|
||||
team_update_user_team_weekly(usr(i).tm);
|
||||
}
|
||||
|
||||
/** Do some things at the beginning of each new round for
|
||||
the user teams. */
|
||||
void
|
||||
start_week_round_update_user_teams(void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<users->len;i++)
|
||||
team_update_user_team_week_roundly(usr(i).tm);
|
||||
}
|
||||
|
@ -39,4 +39,7 @@ start_week(void);
|
||||
void
|
||||
start_week_update_user_teams(void);
|
||||
|
||||
void
|
||||
start_week_round_update_user_teams(void);
|
||||
|
||||
#endif
|
||||
|
18
src/team.c
18
src/team.c
@ -797,12 +797,24 @@ team_update_user_team_weekly(Team *tm)
|
||||
}
|
||||
|
||||
/** Regenerate player fitness etc. after a match.
|
||||
@param tm The user team we examine. */
|
||||
@param tm The user team we examine.
|
||||
@param clid The fixture clid. */
|
||||
void
|
||||
team_update_post_match(Team *tm)
|
||||
team_update_post_match(Team *tm, gint clid)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<tm->players->len;i++)
|
||||
player_update_post_match(player_of(tm, i));
|
||||
player_update_post_match(player_of(tm, i), clid);
|
||||
}
|
||||
|
||||
/** Some updates each round.
|
||||
@param tm The user team we examine. */
|
||||
void
|
||||
team_update_user_team_week_roundly(Team *tm)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<tm->players->len;i++)
|
||||
player_update_week_roundly(tm, i);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void
|
||||
team_update_cpu_team(Team *tm, gboolean reset_fitness);
|
||||
|
||||
void
|
||||
team_update_post_match(Team *tm);
|
||||
team_update_post_match(Team *tm, gint clid);
|
||||
|
||||
void
|
||||
team_update_cpu_corrections(Team *tm, gboolean reset_fitness);
|
||||
@ -105,4 +105,7 @@ team_update_cpu_structure(Team *tm);
|
||||
void
|
||||
team_update_cpu_new_players(Team *tm);
|
||||
|
||||
void
|
||||
team_update_user_team_week_roundly(Team *tm);
|
||||
|
||||
#endif
|
||||
|
@ -149,7 +149,7 @@ treeview_cell_player_to_cell(GtkTreeViewColumn *col,
|
||||
void
|
||||
treeview_cell_player_contract_to_cell(GtkCellRenderer *renderer, gchar *buf, gfloat contract_time)
|
||||
{
|
||||
sprintf(buf, "%.*f", opt_int("int_opt_player_precision"),
|
||||
sprintf(buf, "%.*f", 1 + opt_int("int_opt_player_precision"),
|
||||
contract_time);
|
||||
|
||||
if(contract_time < const_float("float_treeview_cell_limit_player_contract_below3"))
|
||||
|
@ -14,6 +14,10 @@ int_opt_autosave_interval 3
|
||||
int_opt_compress 1
|
||||
int_opt_objective 1
|
||||
|
||||
# precision of skill and talent in player lists
|
||||
int_opt_player_precision 0
|
||||
|
||||
|
||||
# whether some debugging info's shown (in the console)
|
||||
int_opt_debug 0
|
||||
|
||||
|
@ -209,7 +209,7 @@ float_live_game_stadium_event_riots 5000
|
||||
float_live_game_stadium_event_breakdown 10000
|
||||
|
||||
# foul probabilities.
|
||||
float_live_game_foul 0 #1100
|
||||
float_live_game_foul 1100
|
||||
float_live_game_foul_red_injury 500
|
||||
float_live_game_foul_red 800
|
||||
float_live_game_foul_yellow 2300
|
||||
@ -227,7 +227,7 @@ float_live_game_ban_5 200
|
||||
float_live_game_foul_by_possession 2000
|
||||
|
||||
# injury probabilities.
|
||||
float_live_game_injury 0 #170
|
||||
float_live_game_injury 170
|
||||
float_live_game_injury_goalie_factor 2000
|
||||
float_live_game_injury_is_temp 7000
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# is rather clear if you take a look at the options window in the game.
|
||||
|
||||
int_opt_user_confirm_unfit 1
|
||||
int_opt_user_show_live_game 1
|
||||
int_opt_user_show_live_game 0
|
||||
int_opt_user_live_game_speed -10
|
||||
int_opt_user_show_tendency_bar 1
|
||||
int_opt_user_notify_transfer 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user