diff --git a/src/game.c b/src/game.c index 1c732927..f9a73b30 100644 --- a/src/game.c +++ b/src/game.c @@ -1,26 +1,26 @@ /* - game.c + game.c - Bygfoot Football Manager -- a small and simple GTK2-based - football management game. + Bygfoot Football Manager -- a small and simple GTK2-based + football management game. - http://bygfoot.sourceforge.net + http://bygfoot.sourceforge.net - Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com) + Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com) - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "cup.h" @@ -186,7 +186,7 @@ game_get_player(const Team *tm, gint player_type, if(i < 10) g_print("prob %.3f ", probs[i]); g_print("%d %20s health %d cskill %.2f\n", i, player_of_idx_team(tm, i)->name, - player_of_idx_team(tm, i)->health, player_of_idx_team(tm, i)->cskill); + player_of_idx_team(tm, i)->health, player_of_idx_team(tm, i)->cskill); } main_exit_program(EXIT_INT_NOT_FOUND, NULL); @@ -977,8 +977,8 @@ game_post_match(Fixture *fix) if((debug > 100 && fixture_user_team_involved(fix) != -1) || debug > 130) g_print("game_post_match: %s - %s\n", - fix->teams[0]->name, - fix->teams[1]->name); + fix->teams[0]->name, + fix->teams[1]->name); if(query_fixture_has_tables(fix)) table_update(fix); diff --git a/src/transfer.c b/src/transfer.c index 5da33f0e..1f751a0f 100644 --- a/src/transfer.c +++ b/src/transfer.c @@ -248,8 +248,7 @@ transfer_evaluate_offers(void) player_of_id_team(trans(i).tm, trans(i).id)->name); transoff(i, j).status = TRANSFER_OFFER_REJECTED; } - else if(query_player_star_balks( - player_of_id_team(trans(i).tm, trans(i).id), transoff(i, j).tm, TRUE)) + else if(transfer_new_star_balks(&trans(i), &transoff(i, j))) { user_event_add( user_from_team(transoff(i, j).tm), @@ -548,3 +547,35 @@ transfer_get_previous_offer(const Transfer *tr, const Team *tm, gint *fee, gint *wage = g_array_index(tr->offers, TransferOffer, i).wage; } } + +/** Find out if a potential new star balks because there are already + enough stars on the user team. */ +gboolean +transfer_new_star_balks(const Transfer *tr, const TransferOffer *troff) +{ + gint i; + gint number_of_stars; + + /* Weak players never balk. */ + if(player_of_id_team(tr->tm, tr->id)->skill < + const_float("float_transfer_star_skill_limit")) + return FALSE; + + /* There is some chance that the new star doesn't balk at all. */ + if(math_rnd(0, 1) < const_float("float_transfer_star_no_balk")) + return FALSE; + + /* Find out if there are any stars at all on the team. */ + number_of_stars = 0; + for(i = 0; i < troff->tm->players->len; i++) + { + if(g_array_index(troff->tm->players, Player, i).skill > + const_float("float_transfer_star_skill_limit")) + number_of_stars++; + } + + if(number_of_stars == 0) + return FALSE; + + return (math_rnd(0, 1) > 1 - number_of_stars * const_float("float_transfer_star_prob_decrease")); +} diff --git a/src/transfer.h b/src/transfer.h index 36f9f76f..a5529fcf 100644 --- a/src/transfer.h +++ b/src/transfer.h @@ -96,4 +96,7 @@ transfer_offers_pending(void); void transfer_get_previous_offer(const Transfer *tr, const Team *tm, gint *fee, gint *wage); +gboolean +transfer_new_star_balks(const Transfer *tr, const TransferOffer *troff); + #endif diff --git a/support_files/bygfoot_constants b/support_files/bygfoot_constants index b31f2b5d..facd4d80 100644 --- a/support_files/bygfoot_constants +++ b/support_files/bygfoot_constants @@ -96,13 +96,13 @@ float_team_stadium_safety_upper 100000 # ticket price; this determines together with # the player wages the size of the stadium at -# generation. It's also used inattendance +# generation. Also used in attendance # calculation int_team_stadium_ticket_price 25 # price vs attendace. This determines together -# with the prices gow high the attedace will be -float_team_stadium_price_attendance_factor 5000 +# with the prices how high the attedace will be +float_team_stadium_price_attendance_factor 4000 # factor for stadium size; this determines the income # of the user teams