mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-01-28 22:49:22 +01:00
Automatic loan repayment.
This commit is contained in:
parent
32759bf142
commit
c648026e3c
@ -1012,6 +1012,81 @@
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">7</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox17">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">3</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label26">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Your debt:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label_alr_debt">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator7">
|
||||
<property name="height_request">10</property>
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label22">
|
||||
<property name="visible">True</property>
|
||||
|
@ -153,7 +153,7 @@ finance_update_user_weekly(User *user)
|
||||
if(user->counters[COUNT_USER_LOAN] > -1)
|
||||
user->counters[COUNT_USER_LOAN]--;
|
||||
|
||||
if(user->counters[COUNT_USER_LOAN] == 0 && debug < 50 && user->alr_start_week == 0)
|
||||
if(user->counters[COUNT_USER_LOAN] == 0 && debug < 50)
|
||||
user_event_add(user, EVENT_TYPE_WARNING, -1, -1, NULL,
|
||||
_("You have to pay back your loan this week."));
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
misc2_callbacks.c
|
||||
misc2_callbacks.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 "bet.h"
|
||||
@ -135,32 +135,34 @@ on_button_digits_ok_clicked (GtkButton *button,
|
||||
|
||||
switch(stat1)
|
||||
{
|
||||
case STATUS_GET_LOAN:
|
||||
finance_get_loan(values[0]);
|
||||
on_menu_show_finances_activate(NULL, NULL);
|
||||
break;
|
||||
case STATUS_PAY_LOAN:
|
||||
finance_pay_loan(¤t_user, values[0]);
|
||||
on_menu_show_finances_activate(NULL, NULL);
|
||||
break;
|
||||
case STATUS_SHOW_TRANSFER_LIST:
|
||||
if(transfer_add_offer(stat2, current_user.tm, values[0], values[1]))
|
||||
game_gui_print_message(_("Your offer has been updated."));
|
||||
else
|
||||
game_gui_print_message(_("Your offer will be considered next week."));
|
||||
break;
|
||||
case STATUS_CUSTOM_STRUCTURE:
|
||||
destroy_window = misc2_callback_change_structure(values[1]);
|
||||
if(destroy_window && stat0 == STATUS_LIVE_GAME_PAUSE)
|
||||
gtk_widget_set_sensitive(window.main, TRUE);
|
||||
break;
|
||||
case STATUS_SET_YA_PERCENTAGE:
|
||||
current_user.youth_academy.percentage = values[1];
|
||||
break;
|
||||
case STATUS_PLACE_BET:
|
||||
if(!bet_place(stat2, stat3, values[0]))
|
||||
destroy_window = FALSE;
|
||||
break;
|
||||
case STATUS_GET_LOAN:
|
||||
finance_get_loan(values[0]);
|
||||
on_menu_show_finances_activate(NULL, NULL);
|
||||
break;
|
||||
case STATUS_PAY_LOAN:
|
||||
finance_pay_loan(¤t_user, values[0]);
|
||||
on_menu_show_finances_activate(NULL, NULL);
|
||||
if(current_user.debt != 0 && current_user.alr_start_week != 0)
|
||||
window_show_yesno(_("Adjust repayment schedule?"));
|
||||
break;
|
||||
case STATUS_SHOW_TRANSFER_LIST:
|
||||
if(transfer_add_offer(stat2, current_user.tm, values[0], values[1]))
|
||||
game_gui_print_message(_("Your offer has been updated."));
|
||||
else
|
||||
game_gui_print_message(_("Your offer will be considered next week."));
|
||||
break;
|
||||
case STATUS_CUSTOM_STRUCTURE:
|
||||
destroy_window = misc2_callback_change_structure(values[1]);
|
||||
if(destroy_window && stat0 == STATUS_LIVE_GAME_PAUSE)
|
||||
gtk_widget_set_sensitive(window.main, TRUE);
|
||||
break;
|
||||
case STATUS_SET_YA_PERCENTAGE:
|
||||
current_user.youth_academy.percentage = values[1];
|
||||
break;
|
||||
case STATUS_PLACE_BET:
|
||||
if(!bet_place(stat2, stat3, values[0]))
|
||||
destroy_window = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if(destroy_window)
|
||||
@ -209,43 +211,46 @@ on_button_yesno_yes_clicked (GtkButton *button,
|
||||
|
||||
switch(stat1)
|
||||
{
|
||||
default:
|
||||
g_warning("on_button_yesno_yes_clicked: unknown status %d\n", stat1);
|
||||
break;
|
||||
case STATUS_FIRE_PLAYER:
|
||||
player_remove_from_team(current_user.tm, stat2);
|
||||
current_user.money -= stat3;
|
||||
current_user.money_out[1][MON_OUT_COMPENSATIONS] -= stat3;
|
||||
treeview_show_user_player_list();
|
||||
game_gui_set_main_window_header();
|
||||
break;
|
||||
case STATUS_USER_MANAGEMENT:
|
||||
user_remove(stat2, TRUE);
|
||||
treeview_show_users(
|
||||
GTK_TREE_VIEW(lookup_widget(window.user_management,
|
||||
"treeview_user_management_users")));
|
||||
treeview_show_team_list(
|
||||
GTK_TREE_VIEW(lookup_widget(window.user_management,
|
||||
"treeview_user_management_teams")),
|
||||
FALSE, FALSE);
|
||||
break;
|
||||
case STATUS_QUERY_UNFIT:
|
||||
load_save_autosave();
|
||||
callback_show_next_live_game();
|
||||
break;
|
||||
case STATUS_QUERY_QUIT:
|
||||
main_exit_program(EXIT_OK, NULL);
|
||||
break;
|
||||
case STATUS_QUERY_USER_NO_TURN:
|
||||
load_save_autosave();
|
||||
callback_show_next_live_game();
|
||||
break;
|
||||
case STATUS_QUERY_KICK_YOUTH:
|
||||
free_player(&g_array_index(current_user.youth_academy.players, Player, selected_row));
|
||||
g_array_remove_index(current_user.youth_academy.players, selected_row);
|
||||
on_menu_show_youth_academy_activate(NULL, NULL);
|
||||
selected_row = -1;
|
||||
break;
|
||||
default:
|
||||
g_warning("on_button_yesno_yes_clicked: unknown status %d\n", stat1);
|
||||
break;
|
||||
case STATUS_PAY_LOAN:
|
||||
on_automatic_loan_repayment_activate(NULL, NULL);
|
||||
break;
|
||||
case STATUS_FIRE_PLAYER:
|
||||
player_remove_from_team(current_user.tm, stat2);
|
||||
current_user.money -= stat3;
|
||||
current_user.money_out[1][MON_OUT_COMPENSATIONS] -= stat3;
|
||||
treeview_show_user_player_list();
|
||||
game_gui_set_main_window_header();
|
||||
break;
|
||||
case STATUS_USER_MANAGEMENT:
|
||||
user_remove(stat2, TRUE);
|
||||
treeview_show_users(
|
||||
GTK_TREE_VIEW(lookup_widget(window.user_management,
|
||||
"treeview_user_management_users")));
|
||||
treeview_show_team_list(
|
||||
GTK_TREE_VIEW(lookup_widget(window.user_management,
|
||||
"treeview_user_management_teams")),
|
||||
FALSE, FALSE);
|
||||
break;
|
||||
case STATUS_QUERY_UNFIT:
|
||||
load_save_autosave();
|
||||
callback_show_next_live_game();
|
||||
break;
|
||||
case STATUS_QUERY_QUIT:
|
||||
main_exit_program(EXIT_OK, NULL);
|
||||
break;
|
||||
case STATUS_QUERY_USER_NO_TURN:
|
||||
load_save_autosave();
|
||||
callback_show_next_live_game();
|
||||
break;
|
||||
case STATUS_QUERY_KICK_YOUTH:
|
||||
free_player(&g_array_index(current_user.youth_academy.players, Player, selected_row));
|
||||
g_array_remove_index(current_user.youth_academy.players, selected_row);
|
||||
on_menu_show_youth_academy_activate(NULL, NULL);
|
||||
selected_row = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(stat4 == STATUS_SHOW_EVENT)
|
||||
@ -310,8 +315,8 @@ on_button_user_management_add_clicked (GtkButton *button,
|
||||
|
||||
void
|
||||
on_button_user_management_close_clicked
|
||||
(GtkButton *button,
|
||||
gpointer user_data)
|
||||
(GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
window_destroy(&window.user_management);
|
||||
on_button_back_to_main_clicked(NULL, NULL);
|
||||
@ -320,9 +325,9 @@ on_button_user_management_close_clicked
|
||||
|
||||
gboolean
|
||||
on_treeview_user_management_users_button_press_event
|
||||
(GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer user_data)
|
||||
(GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
gint idx = -1;
|
||||
@ -347,10 +352,10 @@ on_treeview_user_management_users_button_press_event
|
||||
|
||||
void
|
||||
on_treeview_user_management_teams_row_activated
|
||||
(GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
gpointer user_data)
|
||||
(GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
gpointer user_data)
|
||||
{
|
||||
on_button_user_management_add_clicked(NULL, NULL);
|
||||
}
|
||||
|
@ -502,6 +502,10 @@ create_window_alr (void)
|
||||
{
|
||||
GtkWidget *window_alr;
|
||||
GtkWidget *vbox5;
|
||||
GtkWidget *hbox17;
|
||||
GtkWidget *label26;
|
||||
GtkWidget *label_alr_debt;
|
||||
GtkWidget *hseparator7;
|
||||
GtkWidget *label22;
|
||||
GtkWidget *table2;
|
||||
GtkWidget *label23;
|
||||
@ -544,6 +548,23 @@ create_window_alr (void)
|
||||
gtk_container_add (GTK_CONTAINER (window_alr), vbox5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox5), 5);
|
||||
|
||||
hbox17 = gtk_hbox_new (FALSE, 3);
|
||||
gtk_widget_show (hbox17);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), hbox17, FALSE, FALSE, 0);
|
||||
|
||||
label26 = gtk_label_new (_("Your debt:"));
|
||||
gtk_widget_show (label26);
|
||||
gtk_box_pack_start (GTK_BOX (hbox17), label26, FALSE, FALSE, 0);
|
||||
|
||||
label_alr_debt = gtk_label_new ("");
|
||||
gtk_widget_show (label_alr_debt);
|
||||
gtk_box_pack_start (GTK_BOX (hbox17), label_alr_debt, FALSE, FALSE, 0);
|
||||
|
||||
hseparator7 = gtk_hseparator_new ();
|
||||
gtk_widget_show (hseparator7);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), hseparator7, FALSE, FALSE, 0);
|
||||
gtk_widget_set_size_request (hseparator7, -1, 10);
|
||||
|
||||
label22 = gtk_label_new (_("Current settings:"));
|
||||
gtk_widget_show (label22);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), label22, FALSE, FALSE, 0);
|
||||
@ -712,6 +733,10 @@ create_window_alr (void)
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (window_alr, window_alr, "window_alr");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, vbox5, "vbox5");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, hbox17, "hbox17");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, label26, "label26");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, label_alr_debt, "label_alr_debt");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, hseparator7, "hseparator7");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, label22, "label22");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, table2, "table2");
|
||||
GLADE_HOOKUP_OBJECT (window_alr, label23, "label23");
|
||||
|
11
src/window.c
11
src/window.c
@ -1018,12 +1018,19 @@ window_show_training_camp(void)
|
||||
void
|
||||
window_show_alr(void)
|
||||
{
|
||||
gchar weekly_installment[SMALL],
|
||||
debt[SMALL];
|
||||
|
||||
window_create(WINDOW_ALR);
|
||||
|
||||
misc_print_grouped_int(current_user.alr_weekly_installment, weekly_installment);
|
||||
misc_print_grouped_int(-current_user.debt, debt);
|
||||
|
||||
gui_label_set_text_from_int(GTK_LABEL(lookup_widget(window.alr, "label_current_start_week")),
|
||||
current_user.alr_start_week, FALSE);
|
||||
gui_label_set_text_from_int(GTK_LABEL(lookup_widget(window.alr, "label_current_weekly_installment")),
|
||||
current_user.alr_weekly_installment, FALSE);
|
||||
gtk_label_set_text(GTK_LABEL(lookup_widget(window.alr, "label_current_weekly_installment")), weekly_installment);
|
||||
gtk_label_set_text(GTK_LABEL(lookup_widget(window.alr, "label_alr_debt")), debt);
|
||||
|
||||
gtk_spin_button_set_range(GTK_SPIN_BUTTON(lookup_widget(window.alr, "spinbutton_start_week")),
|
||||
week + 1, MIN(week + current_user.counters[COUNT_USER_LOAN], fixture_get_last_scheduled_week()));
|
||||
gtk_spin_button_set_range(GTK_SPIN_BUTTON(lookup_widget(window.alr, "spinbutton_weekly_installment")),
|
||||
|
Loading…
x
Reference in New Issue
Block a user