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

@ -1,106 +1,108 @@
/*
bet_struct.h
bet_struct.h
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 "enums.h"
#include "finance.h"
#include "glib.h"
#include "option.h"
#include "training.h"
#include "player.h"
void
calculateTrainingCamp(Team *current_team,
gdouble value_training,
gdouble value_training,
gdouble value_recreation,
gint number_camp)
{
gint count, i;
Player *player;
gfloat skill_points=0.0;
gfloat fitness_points=0.0;
gint recovery_points=0;
gint count, i;
Player *player;
gfloat skill_points=0.0;
gfloat fitness_points=0.0;
gint recovery_points=0;
for (count=0; count<current_team->players->len; count++)
for (count=0; count<current_team->players->len; count++)
{
player = &g_array_index(current_team->players, Player, count);
if (((value_training>0) || (value_recreation>0)) && (player->health == 0))
{
player = &g_array_index(current_team->players, Player, count);
if (((value_training>0) || (value_recreation>0)) && (player->health == 0))
{
skill_points=calculate_skill_points((gint) value_training,
number_camp,
player->age,
player->fitness,
player->lsu);
skill_points=calculate_skill_points((gint) value_training,
number_camp,
player->age,
player->fitness,
player->lsu);
fitness_points=calculate_fitness_points((gint) value_training,
(gint) value_recreation,
number_camp,
player->age);
fitness_points=calculate_fitness_points((gint) value_training,
(gint) value_recreation,
number_camp,
player->age);
recovery_points=0;
}
else
{
recovery_points = calculate_recovery_points((gint) value_recreation,
number_camp,
player->age);
skill_points=0.0;
fitness_points=0.0;
}
//Set new values
if ((player->health > 0) && (player->recovery > 0))
{
//Health & recovery
player->recovery -= recovery_points;
}
else
{
//Skill
if ((player->skill+skill_points) <= (player->talent-2))
{
player->skill += skill_points;
player->lsu = 0;
// Functions which are called during a skill-update by player_update_skill() in player.c
player->cskill = player_get_cskill(player, player->cpos, TRUE);
player->value = player_assign_value(player);
for(i=0; i<QUALITY_END; i++)
if(player->skill > player->etal[i])
{
player_estimate_talent(player);
break;
}
}
//Fitness
player->fitness -= fitness_points;
if (player->fitness > 1)
player->fitness = 1;
else if (player->fitness < 0)
player->fitness = 0;
}
}
else
{
recovery_points = calculate_recovery_points((gint) value_recreation,
number_camp,
player->age);
skill_points=0.0;
fitness_points=0.0;
}
//Set new values
if ((player->health > 0) && (player->recovery > 0))
{
//Health & recovery
player->recovery -= recovery_points;
}
else
{
//Skill
if ((player->skill+skill_points) <= (player->talent-2))
{
player->skill += skill_points;
player->lsu = 0;
// Functions which are called during a skill-update by player_update_skill() in player.c
player->cskill = player_get_cskill(player, player->cpos, TRUE);
player->value = player_assign_value(player);
for(i=0; i<QUALITY_END; i++)
if(player->skill > player->etal[i])
{
player_estimate_talent(player);
break;
}
}
//Fitness
player->fitness -= fitness_points;
if (player->fitness > 1)
player->fitness = 1;
else if (player->fitness < 0)
player->fitness = 0;
}
}
}
gfloat
@ -110,110 +112,110 @@ calculate_skill_points(gint value_training,
gfloat fitness,
gfloat lsu)
{
gint training_points=0;
gfloat skill_points=0.0;
gint random=0;
gint training_points=0;
gfloat skill_points=0.0;
gint random=0;
//Calculat training points -> age
if (age < 20)
training_points += 4;
else if (age < 25)
training_points += 3;
else if (age < 30)
training_points += 2;
else
training_points += 1;
//Calculat training points -> age
if (age < 20)
training_points += 4;
else if (age < 25)
training_points += 3;
else if (age < 30)
training_points += 2;
else
training_points += 1;
//Calculat training points -> fittness
if (fitness > 0.75)
training_points += 4;
else if (fitness > 0.50)
training_points += 3;
else if (fitness > 0.25)
training_points += 2;
else
training_points += 1;
//Calculat training points -> fittness
if (fitness > 0.75)
training_points += 4;
else if (fitness > 0.50)
training_points += 3;
else if (fitness > 0.25)
training_points += 2;
else
training_points += 1;
//Calculat training points -> lsu
if (lsu > 15)
training_points += 4;
else if (lsu > 10)
training_points += 3;
else if (lsu > 5)
training_points += 2;
else
training_points += 1;
//Calculat training points -> lsu
if (lsu > 15)
training_points += 4;
else if (lsu > 10)
training_points += 3;
else if (lsu > 5)
training_points += 2;
else
training_points += 1;
//Calculate skill points
random = random_int(1, 3);
skill_points = training_points - random;
//Calculate skill points
random = random_int(1, 3);
skill_points = training_points - random;
if (skill_points == 0)
return skill_points;
else
{
skill_points = skill_points * value_training * number_camp / 100.0;
return skill_points;
}
if (skill_points == 0)
return skill_points;
else
{
skill_points = skill_points * value_training * number_camp / 100.0;
return skill_points;
}
}
gfloat
calculate_fitness_points(gint value_training,
gint value_recreation,
gint value_recreation,
gint number_camp,
gfloat age)
{
gint training_points=0;
gfloat fitness_points=0.0;
gint random=0;
gint training_points=0;
gfloat fitness_points=0.0;
gint random=0;
if (value_recreation > 8)
if (value_recreation > 8)
{
if (value_recreation == 9)
{
if (value_recreation == 9)
{
//Calculate fitness points
random = random_int(1, 2);
fitness_points = ((0.02 * number_camp) + (random / 100.0)) * -1;
}
else
{
//Calculate fitness points
random = random_int(1, 2);
fitness_points = ((0.04 * number_camp) + (random / 100.0)) * -1;
}
//Calculate fitness points
random = random_int(1, 2);
fitness_points = ((0.02 * number_camp) + (random / 100.0)) * -1;
}
else
{
//Calculat fitness points -> age
if (age < 20)
training_points += 1;
else if (age < 25)
training_points += 2;
else if (age < 30)
training_points += 3;
else
training_points += 4;
//Calculate fitness points
random = random_int(1, 2);
fitness_points = ((0.04 * number_camp) + (random / 100.0)) * -1;
}
}
else
{
//Calculat fitness points -> age
if (age < 20)
training_points += 1;
else if (age < 25)
training_points += 2;
else if (age < 30)
training_points += 3;
else
training_points += 4;
//Calculat fitness points -> value training
switch (value_training)
{
case 2: training_points += 1; break;
case 3: training_points += 1; break;
case 4: training_points += 2; break;
case 5: training_points += 2; break;
case 6: training_points += 3; break;
case 7: training_points += 3; break;
case 8: training_points += 4; break;
case 9: training_points += 4; break;
case 10: training_points += 5; break;
}
//Calculate fitness points
random = random_int(1, 2);
fitness_points = (((gfloat) training_points + random) / number_camp) / 100;
//Calculat fitness points -> value training
switch (value_training)
{
case 2: training_points += 1; break;
case 3: training_points += 1; break;
case 4: training_points += 2; break;
case 5: training_points += 2; break;
case 6: training_points += 3; break;
case 7: training_points += 3; break;
case 8: training_points += 4; break;
case 9: training_points += 4; break;
case 10: training_points += 5; break;
}
return fitness_points;
//Calculate fitness points
random = random_int(1, 2);
fitness_points = (((gfloat) training_points + random) / number_camp) / 100;
}
return fitness_points;
}
@ -222,66 +224,61 @@ calculate_recovery_points(gint value_recreation,
gint number_camp,
gfloat age)
{
gint training_points=0;
gint recovery_points=0;
gint random=0;
gint training_points=0;
gint recovery_points=0;
gint random=0;
//Calculat recovery points -> age
if (age < 20)
training_points += 4;
else if (age < 25)
training_points += 3;
else if (age < 30)
training_points += 2;
else
training_points += 1;
//Calculat recovery points -> age
if (age < 20)
training_points += 4;
else if (age < 25)
training_points += 3;
else if (age < 30)
training_points += 2;
else
training_points += 1;
//Calculat recovery points -> recreation
switch (value_recreation)
{
case 10: training_points += 4; break;
case 9: training_points += 3; break;
case 8: training_points += 2; break;
case 7: training_points += 1; break;
}
//Calculat recovery points -> recreation
switch (value_recreation)
{
case 10: training_points += 4; break;
case 9: training_points += 3; break;
case 8: training_points += 2; break;
case 7: training_points += 1; break;
}
//Calculate recreation points
random = random_int(1, 2);
recovery_points = (training_points + random) * number_camp;
//Calculate recreation points
random = random_int(1, 2);
recovery_points = (training_points + random) * number_camp;
if (recovery_points > 17)
return 1;
else
return 0;
if (recovery_points > 17)
return 1;
else
return 0;
}
gint
random_int(gint min, gint max)
{
gint random=0;
GRand *grand = NULL;
gint random=0;
GRand *grand = NULL;
grand = g_rand_new ();
random = (gint) g_rand_int_range(grand, min, max+1); //random() works until max -1
return random;
grand = g_rand_new ();
random = (gint) g_rand_int_range(grand, min, max+1); //random() works until max -1
return random;
}
void
calculateCostsTrainingCamp(gint number_camp)
{
gint *money_out = current_user.money_out[0];
gint *money = &current_user.money;
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

@ -1,26 +1,26 @@
/*
bet_struct.h
bet_struct.h
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.
*/
#ifdef HAVE_CONFIG_H
@ -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"
@ -45,66 +49,68 @@ void
on_b_cancel_clicked (GtkButton *button,
gpointer user_data)
{
window_destroy(&window.training_camp);
window_destroy(&window.training_camp);
}
void
on_b_ok_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *rb_camp1;
GtkWidget *rb_camp1;
GtkWidget *rb_camp2;
GtkHScale *hs_recreation;
GtkHScale *hs_training;
gdouble value_training;
gdouble value_recreation;
gint number_camp;
Team *current_team = current_user.tm;
gdouble value_recreation;
gint number_camp;
Team *current_team = current_user.tm;
//Get active radio
rb_camp1 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp1"));
//Get active radio
rb_camp1 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp1"));
rb_camp2 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp2"));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb_camp1)))
number_camp = 1;
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb_camp2)))
number_camp = 2;
else
number_camp = 3;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb_camp1)))
number_camp = 1;
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb_camp2)))
number_camp = 2;
else
number_camp = 3;
//Get values for training and recreation
//Get values for training and recreation
hs_recreation = GTK_HSCALE(lookup_widget(window.training_camp, "hs_recreation"));
hs_training = GTK_HSCALE(lookup_widget(window.training_camp, "hs_training"));
value_training = gtk_range_get_value(GTK_RANGE(hs_training));
value_recreation = gtk_range_get_value(GTK_RANGE(hs_recreation));
//Calculate training camp
calculateTrainingCamp(current_team, value_training, value_recreation, number_camp);
//Calculate training camp
calculateTrainingCamp(current_team, value_training, value_recreation, number_camp);
//Set new av-values -> GUI
game_gui_write_av_skills(current_team);
//Set new av-values -> GUI
game_gui_write_av_skills(current_team);
//Set new player values in GUI
treeview_show_user_player_list();
//Set new player values in GUI
treeview_show_user_player_list();
//Calculate costs of the training camp
calculateCostsTrainingCamp(number_camp);
//Calculate costs of the training camp
calculateCostsTrainingCamp(number_camp);
//Set new av-values -> GUI
game_gui_write_money();
//Set new av-values -> GUI
game_gui_write_money();
window_destroy(&window.training_camp);
window_destroy(&window.training_camp);
}
void
on_rb_camp3_clicked (GtkButton *button,
gpointer user_data)
{
GtkEntry *tfCosts;
gchar buf[SMALL];
GtkEntry *tfCosts;
gchar buf[SMALL];
sprintf(buf, "%d", COSTS_CAMP_3);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
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);
}
@ -113,24 +119,28 @@ void
on_rb_camp2_clicked (GtkButton *button,
gpointer user_data)
{
GtkEntry *tfCosts;
gchar buf[SMALL];
GtkEntry *tfCosts;
gchar buf[SMALL];
sprintf(buf, "%d", COSTS_CAMP_2);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
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);
}
void
on_rb_camp1_clicked (GtkButton *button,
gpointer user_data)
gpointer user_data)
{
GtkEntry *tfCosts;
gchar buf[SMALL];
GtkEntry *tfCosts;
gchar buf[SMALL];
sprintf(buf, "%d", COSTS_CAMP_1);
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
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);
}
@ -138,23 +148,23 @@ void
on_b_dec_recreation_clicked (GtkButton *button,
gpointer user_data)
{
GtkHScale *hs_camp_points;
GtkHScale *hs_recreation;
gdouble value_camp_points;
gdouble value_recreation;
GtkHScale *hs_camp_points;
GtkHScale *hs_recreation;
gdouble value_camp_points;
gdouble value_recreation;
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_recreation = GTK_HSCALE(lookup_widget(window.training_camp, "hs_recreation"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_recreation = gtk_range_get_value(GTK_RANGE(hs_recreation));
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_recreation = GTK_HSCALE(lookup_widget(window.training_camp, "hs_recreation"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_recreation = gtk_range_get_value(GTK_RANGE(hs_recreation));
if (value_recreation > CAMP_SCALE_MIN)
{
value_recreation --;
value_camp_points ++;
gtk_range_set_value(GTK_RANGE(hs_recreation), value_recreation);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
if (value_recreation > CAMP_SCALE_MIN)
{
value_recreation --;
value_camp_points ++;
gtk_range_set_value(GTK_RANGE(hs_recreation), value_recreation);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
}
@ -162,23 +172,23 @@ void
on_b_inc_recreation_clicked (GtkButton *button,
gpointer user_data)
{
GtkHScale *hs_camp_points;
GtkHScale *hs_recreation;
gdouble value_camp_points;
gdouble value_recreation;
GtkHScale *hs_camp_points;
GtkHScale *hs_recreation;
gdouble value_camp_points;
gdouble value_recreation;
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_recreation = GTK_HSCALE(lookup_widget(window.training_camp, "hs_recreation"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_recreation = gtk_range_get_value(GTK_RANGE(hs_recreation));
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_recreation = GTK_HSCALE(lookup_widget(window.training_camp, "hs_recreation"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_recreation = gtk_range_get_value(GTK_RANGE(hs_recreation));
if (value_camp_points > CAMP_SCALE_MIN)
{
value_recreation ++;
value_camp_points --;
gtk_range_set_value(GTK_RANGE(hs_recreation), value_recreation);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
if (value_camp_points > CAMP_SCALE_MIN)
{
value_recreation ++;
value_camp_points --;
gtk_range_set_value(GTK_RANGE(hs_recreation), value_recreation);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
}
@ -186,23 +196,23 @@ void
on_b_dec_training_clicked (GtkButton *button,
gpointer user_data)
{
GtkHScale *hs_camp_points;
GtkHScale *hs_training;
gdouble value_camp_points;
gdouble value_training;
GtkHScale *hs_camp_points;
GtkHScale *hs_training;
gdouble value_camp_points;
gdouble value_training;
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_training = GTK_HSCALE(lookup_widget(window.training_camp, "hs_training"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_training = gtk_range_get_value(GTK_RANGE(hs_training));
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_training = GTK_HSCALE(lookup_widget(window.training_camp, "hs_training"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_training = gtk_range_get_value(GTK_RANGE(hs_training));
if (value_training > CAMP_SCALE_MIN)
{
value_training --;
value_camp_points ++;
gtk_range_set_value(GTK_RANGE(hs_training), value_training);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
if (value_training > CAMP_SCALE_MIN)
{
value_training --;
value_camp_points ++;
gtk_range_set_value(GTK_RANGE(hs_training), value_training);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
}
@ -210,23 +220,23 @@ void
on_b_inc_training_clicked (GtkButton *button,
gpointer user_data)
{
GtkHScale *hs_camp_points;
GtkHScale *hs_training;
gdouble value_camp_points;
gdouble value_training;
GtkHScale *hs_camp_points;
GtkHScale *hs_training;
gdouble value_camp_points;
gdouble value_training;
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_training = GTK_HSCALE(lookup_widget(window.training_camp, "hs_training"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_training = gtk_range_get_value(GTK_RANGE(hs_training));
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
hs_training = GTK_HSCALE(lookup_widget(window.training_camp, "hs_training"));
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
value_training = gtk_range_get_value(GTK_RANGE(hs_training));
if (value_camp_points > CAMP_SCALE_MIN)
{
value_training ++;
value_camp_points --;
gtk_range_set_value(GTK_RANGE(hs_training), value_training);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
if (value_camp_points > CAMP_SCALE_MIN)
{
value_training ++;
value_camp_points --;
gtk_range_set_value(GTK_RANGE(hs_training), value_training);
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points);
}
}
@ -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