mirror of
https://github.com/tstellar/bygfoot.git
synced 2024-12-16 18:29:21 +01:00
included training camp
This commit is contained in:
parent
4b25e61977
commit
c1b8298d1d
288
src/training.c
Executable file
288
src/training.c
Executable file
@ -0,0 +1,288 @@
|
||||
/*
|
||||
bet_struct.h
|
||||
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include "enums.h"
|
||||
#include "glib.h"
|
||||
#include "training.h"
|
||||
#include "training.h"
|
||||
#include "player.h"
|
||||
|
||||
void
|
||||
calculateTrainingCamp(Team *current_team,
|
||||
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;
|
||||
|
||||
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))
|
||||
{
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gfloat
|
||||
calculate_skill_points(gint value_training,
|
||||
gint number_camp,
|
||||
gfloat age,
|
||||
gfloat fitness,
|
||||
gfloat lsu)
|
||||
{
|
||||
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 -> 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;
|
||||
|
||||
//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;
|
||||
}
|
||||
}
|
||||
|
||||
gfloat
|
||||
calculate_fitness_points(gint value_training,
|
||||
gint value_recreation,
|
||||
gint number_camp,
|
||||
gfloat age)
|
||||
{
|
||||
gint training_points=0;
|
||||
gfloat fitness_points=0.0;
|
||||
gint random=0;
|
||||
|
||||
if (value_recreation > 8)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return fitness_points;
|
||||
|
||||
}
|
||||
|
||||
gint
|
||||
calculate_recovery_points(gint value_recreation,
|
||||
gint number_camp,
|
||||
gfloat age)
|
||||
{
|
||||
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 -> 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;
|
||||
|
||||
if (recovery_points > 17)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint
|
||||
random_int(gint min, gint max)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
void
|
||||
calculateCostsTrainingCamp(gint number_camp)
|
||||
{
|
||||
gint *money_out = current_user.money_out[0];
|
||||
gint *money = ¤t_user.money;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
63
src/training.h
Executable file
63
src/training.h
Executable file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
bet_struct.h
|
||||
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#ifndef TRAINING_
|
||||
#define TRAINING_
|
||||
|
||||
#include "team.h"
|
||||
#include "training_struct.h"
|
||||
#include "user.h"
|
||||
|
||||
void
|
||||
calculateTrainingCamp(Team *current_team,
|
||||
gdouble value_training,
|
||||
gdouble value_recreation,
|
||||
gint number_camp);
|
||||
|
||||
gfloat
|
||||
calculate_skill_points(gint value_training,
|
||||
gint number_camp,
|
||||
gfloat age,
|
||||
gfloat fitness,
|
||||
gfloat lsu);
|
||||
|
||||
gfloat
|
||||
calculate_fitness_points(gint value_training,
|
||||
gint value_recreation,
|
||||
gint number_camp,
|
||||
gfloat age);
|
||||
|
||||
gint
|
||||
calculate_recovery_points(gint value_recreation,
|
||||
gint number_camp,
|
||||
gfloat age);
|
||||
|
||||
gint
|
||||
random_int(gint min, gint max);
|
||||
|
||||
void
|
||||
calculateCostsTrainingCamp(gint number_camp);
|
||||
|
||||
#endif /*TRAINING_*/
|
198
src/training_callbacks.c
Executable file
198
src/training_callbacks.c
Executable file
@ -0,0 +1,198 @@
|
||||
/*
|
||||
bet_struct.h
|
||||
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "bygfoot.h"
|
||||
#include "game_gui.h"
|
||||
#include "support.h"
|
||||
#include "training.h"
|
||||
#include "training_callbacks.h"
|
||||
#include "training_interface.h"
|
||||
#include "training_struct.h"
|
||||
#include "treeview.h"
|
||||
#include "user.h"
|
||||
#include "variables.h"
|
||||
#include "window.h"
|
||||
|
||||
void
|
||||
on_b_cancel_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
window_destroy(&window.training_camp);
|
||||
}
|
||||
|
||||
void
|
||||
on_b_ok_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
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;
|
||||
|
||||
//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;
|
||||
|
||||
//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);
|
||||
|
||||
//Set new av-values -> GUI
|
||||
game_gui_write_av_skills(current_team);
|
||||
|
||||
//Set new player values in GUI
|
||||
treeview_show_user_player_list();
|
||||
|
||||
//Calculate costs of the training camp
|
||||
calculateCostsTrainingCamp(number_camp);
|
||||
|
||||
//Set new av-values -> GUI
|
||||
game_gui_write_money();
|
||||
|
||||
window_destroy(&window.training_camp);
|
||||
}
|
||||
|
||||
void
|
||||
on_rb_camp3_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkEntry *tfCosts;
|
||||
gchar buf[SMALL];
|
||||
|
||||
sprintf(buf, "%d", COSTS_CAMP_3);
|
||||
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
|
||||
gtk_entry_set_text (tfCosts, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_rb_camp2_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkEntry *tfCosts;
|
||||
gchar buf[SMALL];
|
||||
|
||||
sprintf(buf, "%d", COSTS_CAMP_2);
|
||||
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)
|
||||
{
|
||||
GtkEntry *tfCosts;
|
||||
gchar buf[SMALL];
|
||||
|
||||
sprintf(buf, "%d", COSTS_CAMP_1);
|
||||
tfCosts = GTK_ENTRY(lookup_widget(window.training_camp, "tf_costs"));
|
||||
gtk_entry_set_text (tfCosts, buf);
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
on_hs_recreation_change_value (GtkRange *range,
|
||||
GtkScrollType scroll,
|
||||
gdouble value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkHScale *hs_camp_points;
|
||||
gdouble value_camp_points;
|
||||
gdouble value_recreation;
|
||||
|
||||
value_recreation = gtk_range_get_value(GTK_RANGE(range));
|
||||
|
||||
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
|
||||
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
|
||||
|
||||
if ((value > (value_recreation + 0.5)) && (value_camp_points > CAMP_SCALE_MIN))
|
||||
{
|
||||
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points - 1.0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((value < (value_recreation - 0.5)) && (value_camp_points < CAMP_SCALE_MAX))
|
||||
{
|
||||
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points + 1.0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
on_hs_training_change_value (GtkRange *range,
|
||||
GtkScrollType scroll,
|
||||
gdouble value,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkHScale *hs_camp_points;
|
||||
gdouble value_camp_points;
|
||||
gdouble value_training;
|
||||
|
||||
value_training = gtk_range_get_value(GTK_RANGE(range));
|
||||
|
||||
hs_camp_points = GTK_HSCALE(lookup_widget(window.training_camp, "hs_camp_points"));
|
||||
value_camp_points = gtk_range_get_value(GTK_RANGE(hs_camp_points));
|
||||
|
||||
if ((value > (value_training + 0.5)) && (value_camp_points > CAMP_SCALE_MIN))
|
||||
{
|
||||
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points - 1.0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((value < (value_training - 0.5)) && (value_camp_points < CAMP_SCALE_MAX))
|
||||
{
|
||||
gtk_range_set_value(GTK_RANGE(hs_camp_points), value_camp_points + 1.0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
193
src/training_interface.c
Executable file
193
src/training_interface.c
Executable file
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "training_callbacks.h"
|
||||
#include "training_interface.h"
|
||||
#include "support.h"
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
GtkWidget*
|
||||
create_window_training_camp (void)
|
||||
{
|
||||
GtkWidget *window_training_camp;
|
||||
GtkWidget *panel_camp;
|
||||
GtkWidget *tf_costs;
|
||||
GtkWidget *hs_camp2;
|
||||
GtkWidget *hs_camp1;
|
||||
GtkWidget *rb_camp2;
|
||||
GSList *rb_camp2_group = NULL;
|
||||
GtkWidget *b_cancel;
|
||||
GtkWidget *rb_camp1;
|
||||
GtkWidget *b_ok;
|
||||
GtkWidget *rb_camp3;
|
||||
GtkWidget *l_costs;
|
||||
GtkWidget *hs_recreation;
|
||||
GtkWidget *hs_training;
|
||||
GtkWidget *hs_camp_points;
|
||||
GtkWidget *l_recreation;
|
||||
GtkWidget *l_camp_points;
|
||||
GtkWidget *l_training;
|
||||
|
||||
window_training_camp = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window_training_camp), _("Training camp"));
|
||||
gtk_window_set_position (GTK_WINDOW (window_training_camp), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_modal (GTK_WINDOW (window_training_camp), TRUE);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window_training_camp), FALSE);
|
||||
|
||||
panel_camp = gtk_fixed_new ();
|
||||
gtk_widget_show (panel_camp);
|
||||
gtk_container_add (GTK_CONTAINER (window_training_camp), panel_camp);
|
||||
gtk_widget_set_size_request (panel_camp, 500, 290);
|
||||
|
||||
tf_costs = gtk_entry_new ();
|
||||
gtk_widget_show (tf_costs);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), tf_costs, 296, 39);
|
||||
gtk_widget_set_size_request (tf_costs, 158, 22);
|
||||
GTK_WIDGET_UNSET_FLAGS (tf_costs, GTK_CAN_FOCUS);
|
||||
gtk_editable_set_editable (GTK_EDITABLE (tf_costs), FALSE);
|
||||
gtk_entry_set_has_frame (GTK_ENTRY (tf_costs), FALSE);
|
||||
gtk_entry_set_invisible_char (GTK_ENTRY (tf_costs), 9679);
|
||||
|
||||
hs_camp2 = gtk_hseparator_new ();
|
||||
gtk_widget_show (hs_camp2);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp2, 25, 90);
|
||||
gtk_widget_set_size_request (hs_camp2, 450, 16);
|
||||
|
||||
hs_camp1 = gtk_hseparator_new ();
|
||||
gtk_widget_show (hs_camp1);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp1, 25, 235);
|
||||
gtk_widget_set_size_request (hs_camp1, 450, 16);
|
||||
|
||||
rb_camp2 = gtk_radio_button_new_with_mnemonic (NULL, _("First-Class Hotel"));
|
||||
gtk_widget_show (rb_camp2);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp2, 24, 40);
|
||||
gtk_widget_set_size_request (rb_camp2, 150, 21);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp2), rb_camp2_group);
|
||||
rb_camp2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp2));
|
||||
|
||||
b_cancel = gtk_button_new_from_stock ("gtk-cancel");
|
||||
gtk_widget_show (b_cancel);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), b_cancel, 376, 254);
|
||||
gtk_widget_set_size_request (b_cancel, 110, 25);
|
||||
|
||||
rb_camp1 = gtk_radio_button_new_with_mnemonic (NULL, _("Good Hotel"));
|
||||
gtk_widget_show (rb_camp1);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp1, 24, 16);
|
||||
gtk_widget_set_size_request (rb_camp1, 150, 21);
|
||||
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));
|
||||
|
||||
b_ok = gtk_button_new_from_stock ("gtk-apply");
|
||||
gtk_widget_show (b_ok);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), b_ok, 256, 254);
|
||||
gtk_widget_set_size_request (b_ok, 110, 25);
|
||||
|
||||
rb_camp3 = gtk_radio_button_new_with_mnemonic (NULL, _("Premium Hotel"));
|
||||
gtk_widget_show (rb_camp3);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp3, 24, 64);
|
||||
gtk_widget_set_size_request (rb_camp3, 150, 21);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp3), rb_camp2_group);
|
||||
rb_camp2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp3));
|
||||
|
||||
l_costs = gtk_label_new (_("Costs"));
|
||||
gtk_widget_show (l_costs);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), l_costs, 240, 41);
|
||||
gtk_widget_set_size_request (l_costs, 60, 20);
|
||||
|
||||
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, 150, 120);
|
||||
gtk_widget_set_size_request (hs_recreation, 200, 36);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (hs_recreation), GTK_POS_RIGHT);
|
||||
|
||||
hs_training = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0)));
|
||||
gtk_widget_show (hs_training);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), hs_training, 150, 152);
|
||||
gtk_widget_set_size_request (hs_training, 200, 36);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (hs_training), GTK_POS_RIGHT);
|
||||
|
||||
hs_camp_points = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0)));
|
||||
gtk_widget_show (hs_camp_points);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp_points, 150, 184);
|
||||
gtk_widget_set_size_request (hs_camp_points, 200, 36);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (hs_camp_points), GTK_POS_RIGHT);
|
||||
|
||||
l_recreation = gtk_label_new (_("Recreation"));
|
||||
gtk_widget_show (l_recreation);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), l_recreation, 24, 128);
|
||||
gtk_widget_set_size_request (l_recreation, 120, 20);
|
||||
|
||||
l_camp_points = gtk_label_new (_("Camp points"));
|
||||
gtk_widget_show (l_camp_points);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), l_camp_points, 24, 192);
|
||||
gtk_widget_set_size_request (l_camp_points, 120, 20);
|
||||
|
||||
l_training = gtk_label_new (_("Training"));
|
||||
gtk_widget_show (l_training);
|
||||
gtk_fixed_put (GTK_FIXED (panel_camp), l_training, 24, 160);
|
||||
gtk_widget_set_size_request (l_training, 120, 20);
|
||||
|
||||
g_signal_connect ((gpointer) rb_camp2, "clicked",
|
||||
G_CALLBACK (on_rb_camp2_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) b_cancel, "clicked",
|
||||
G_CALLBACK (on_b_cancel_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) rb_camp1, "clicked",
|
||||
G_CALLBACK (on_rb_camp1_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) b_ok, "clicked",
|
||||
G_CALLBACK (on_b_ok_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) rb_camp3, "clicked",
|
||||
G_CALLBACK (on_rb_camp3_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) hs_recreation, "change_value",
|
||||
G_CALLBACK (on_hs_recreation_change_value),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) hs_training, "change_value",
|
||||
G_CALLBACK (on_hs_training_change_value),
|
||||
NULL);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (window_training_camp, window_training_camp, "window_training_camp");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, panel_camp, "panel_camp");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, tf_costs, "tf_costs");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp2, "hs_camp2");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp1, "hs_camp1");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp2, "rb_camp2");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, b_cancel, "b_cancel");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp1, "rb_camp1");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, b_ok, "b_ok");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp3, "rb_camp3");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, l_costs, "l_costs");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, hs_recreation, "hs_recreation");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, hs_training, "hs_training");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp_points, "hs_camp_points");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, l_recreation, "l_recreation");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, l_camp_points, "l_camp_points");
|
||||
GLADE_HOOKUP_OBJECT (window_training_camp, l_training, "l_training");
|
||||
|
||||
return window_training_camp;
|
||||
}
|
||||
|
5
src/training_interface.h
Executable file
5
src/training_interface.h
Executable file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_window_training_camp (void);
|
39
src/training_struct.h
Executable file
39
src/training_struct.h
Executable file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
bet_struct.h
|
||||
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#ifndef TRAINING_STRUCT_H_
|
||||
#define TRAINING_STRUCT_H_
|
||||
|
||||
#include "bygfoot.h"
|
||||
|
||||
#define COSTS_CAMP_1 250000
|
||||
#define COSTS_CAMP_2 500000
|
||||
#define COSTS_CAMP_3 750000
|
||||
|
||||
#define CAMP_SCALE_MIN 0
|
||||
#define CAMP_SCALE_MAX 10
|
||||
#define CAMP_SCALE_STEP 1
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user