Star player balking.

This commit is contained in:
gyboth 2008-05-02 13:00:05 +00:00
parent 491ac8c785
commit 13c13850c8
8 changed files with 596 additions and 579 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,9 @@
*/
#include "enums.h"
#include "finance.h"
#include "glib.h"
#include "option.h"
#include "training.h"
#include "player.h"
@ -271,17 +273,12 @@ calculateCostsTrainingCamp(gint number_camp)
{
gint *money_out = current_user.money_out[0];
gint *money = &current_user.money;
gfloat factor = finance_wage_unit(current_user.tm);
switch (number_camp)
{
case 1: money_out[MON_OUT_TRAINING_CAMP] -= COSTS_CAMP_1;
*money -= COSTS_CAMP_1;
break;
case 2: money_out[MON_OUT_TRAINING_CAMP] -= COSTS_CAMP_2;
*money -= COSTS_CAMP_2;
break;
case 3: money_out[MON_OUT_TRAINING_CAMP] -= COSTS_CAMP_3;
*money -= COSTS_CAMP_3;
break;
}
gint costs[3] = {factor * const_float("float_training_camp_factor1"),
factor * const_float("float_training_camp_factor2"),
factor * const_float("float_training_camp_factor2")};
money_out[MON_OUT_TRAINING_CAMP] -= costs[number_camp - 1];
*money -= costs[number_camp - 1];
}

View File

@ -30,7 +30,11 @@
#include <gtk/gtk.h>
#include "bygfoot.h"
#include "finance.h"
#include "game_gui.h"
#include "option.h"
#include "maths.h"
#include "misc.h"
#include "support.h"
#include "training.h"
#include "training_callbacks.h"
@ -103,7 +107,9 @@ on_rb_camp3_clicked (GtkButton *button,
GtkEntry *tfCosts;
gchar buf[SMALL];
sprintf(buf, "%d", COSTS_CAMP_3);
misc_print_grouped_int(
math_round_integer(finance_wage_unit(current_user.tm) * const_float("float_training_camp_factor3"), -2),
buf);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
gtk_entry_set_text (tfCosts, buf);
}
@ -116,7 +122,9 @@ on_rb_camp2_clicked (GtkButton *button,
GtkEntry *tfCosts;
gchar buf[SMALL];
sprintf(buf, "%d", COSTS_CAMP_2);
misc_print_grouped_int(
math_round_integer(finance_wage_unit(current_user.tm) * const_float("float_training_camp_factor2"), -2),
buf);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
gtk_entry_set_text (tfCosts, buf);
}
@ -129,7 +137,9 @@ on_rb_camp1_clicked (GtkButton *button,
GtkEntry *tfCosts;
gchar buf[SMALL];
sprintf(buf, "%d", COSTS_CAMP_1);
misc_print_grouped_int(
math_round_integer(finance_wage_unit(current_user.tm) * const_float("float_training_camp_factor1"), -2),
buf);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
gtk_entry_set_text (tfCosts, buf);
}
@ -239,4 +249,3 @@ on_window_training_camp_delete_event (GtkWidget *widget,
return TRUE;
}

View File

@ -66,3 +66,7 @@ gboolean
on_window_training_camp_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
void
on_hs_recreation_value_changed (GtkRange *range,
gpointer user_data);

View File

@ -51,10 +51,10 @@ create_window_training_camp (void)
GtkWidget *image4;
GtkWidget *hs_camp_points;
GtkWidget *hs_training;
GtkWidget *hs_recreation;
GtkWidget *b_dec_recreation;
GtkWidget *image1;
GtkWidget *rb_camp1;
GtkWidget *hs_recreation;
window_training_camp = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window_training_camp), _("Training camp"));
@ -171,13 +171,6 @@ create_window_training_camp (void)
GTK_WIDGET_UNSET_FLAGS (hs_training, GTK_CAN_FOCUS);
gtk_scale_set_value_pos (GTK_SCALE (hs_training), GTK_POS_RIGHT);
hs_recreation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0)));
gtk_widget_show (hs_recreation);
gtk_fixed_put (GTK_FIXED (panel_camp), hs_recreation, 220, 120);
gtk_widget_set_size_request (hs_recreation, 200, 36);
GTK_WIDGET_UNSET_FLAGS (hs_recreation, GTK_CAN_FOCUS);
gtk_scale_set_value_pos (GTK_SCALE (hs_recreation), GTK_POS_RIGHT);
b_dec_recreation = gtk_button_new ();
gtk_widget_show (b_dec_recreation);
gtk_fixed_put (GTK_FIXED (panel_camp), b_dec_recreation, 176, 125);
@ -194,6 +187,13 @@ create_window_training_camp (void)
gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp1), rb_camp2_group);
rb_camp2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp1));
hs_recreation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0)));
gtk_widget_show (hs_recreation);
gtk_fixed_put (GTK_FIXED (panel_camp), hs_recreation, 220, 120);
gtk_widget_set_size_request (hs_recreation, 200, 36);
GTK_WIDGET_UNSET_FLAGS (hs_recreation, GTK_CAN_FOCUS);
gtk_scale_set_value_pos (GTK_SCALE (hs_recreation), GTK_POS_RIGHT);
g_signal_connect ((gpointer) window_training_camp, "delete_event",
G_CALLBACK (on_window_training_camp_delete_event),
NULL);
@ -247,10 +247,10 @@ create_window_training_camp (void)
GLADE_HOOKUP_OBJECT (window_training_camp, image4, "image4");
GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp_points, "hs_camp_points");
GLADE_HOOKUP_OBJECT (window_training_camp, hs_training, "hs_training");
GLADE_HOOKUP_OBJECT (window_training_camp, hs_recreation, "hs_recreation");
GLADE_HOOKUP_OBJECT (window_training_camp, b_dec_recreation, "b_dec_recreation");
GLADE_HOOKUP_OBJECT (window_training_camp, image1, "image1");
GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp1, "rb_camp1");
GLADE_HOOKUP_OBJECT (window_training_camp, hs_recreation, "hs_recreation");
gtk_widget_grab_focus (rb_camp1);
return window_training_camp;

View File

@ -28,10 +28,6 @@
#include "bygfoot.h"
#define COSTS_CAMP_1 200000
#define COSTS_CAMP_2 400000
#define COSTS_CAMP_3 600000
#define CAMP_SCALE_MIN 0
#define CAMP_SCALE_MAX 10
#define CAMP_SCALE_STEP 1

View File

@ -38,6 +38,7 @@
#include "load_save.h"
#include "main.h"
#include "maths.h"
#include "misc.h"
#include "misc_callback_func.h"
#include "misc_interface.h"
#include "misc2_interface.h"
@ -941,7 +942,9 @@ window_show_training_camp(void)
window_create(WINDOW_TRAINING_CAMP);
// Initialize entry costs
sprintf(buf, "%d", COSTS_CAMP_1);
misc_print_grouped_int(
math_round_integer(finance_wage_unit(current_user.tm) * const_float("float_training_camp_factor1"), -2),
buf);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
gtk_entry_set_text (tfCosts, buf);

View File

@ -976,3 +976,8 @@ float_transfer_star_prob_decrease 15000
# probability of a star goalie accepting if there's
# already one present
float_transfer_star_goalie_accepts 12000
# wage unit factors for training camp hotel
float_training_camp_factor1 500000
float_training_camp_factor2 1000000
float_training_camp_factor3 1500000