1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-06-05 21:49:20 +02:00

Removed some files. Transfers.

This commit is contained in:
gyboth
2005-03-21 10:16:37 +00:00
parent afaf931d60
commit 41462e6916
45 changed files with 174 additions and 141 deletions

View File

@@ -9,51 +9,46 @@ INCLUDES = \
bin_PROGRAMS = bygfoot
bygfoot_SOURCES = \
callback_func.c callback_func.h \
callbacks.c callbacks.h \
cup.c cup.h free.h maths.h misc.h team.h variables.h xml_league.h \
file.c file.h free.h misc.h support.h \
finance.c finance.h \
fixture.c cup.h fixture.h league_struct.h main.h maths.h misc.h team.h variables.h \
free.c cup.h fixture.h free.h league.h player.h variables.h \
game.c game.h \
game_gui.c game_gui.h \
generation.c generation.h \
graph.c graph.h \
gui.c gui.h \
history.c history.h \
callback_func.c callback_func.h callbacks.h cup.h finance.h fixture.h game_gui.h league.h live_game.h misc.h option.h player.h start_end.h team.h transfer.h treeview.h user.h window.h \
callbacks.c callbacks.h callback_func.h game_gui.h main.h team.h transfer.h treeview.h user.h window.h \
cup.c cup.h free.h main.h maths.h misc.h team.h variables.h xml_league.h \
file.c file.h free.h main.h misc.h option.h support.h variables.h \
finance.c callbacks.h finance.h game_gui.h maths.h option.h player.h team.h user.h \
fixture.c cup.h fixture.h free.h league.h main.h maths.h misc.h table.h team.h variables.h \
free.c free.h user.h variables.h \
game.c cup.h finance.h fixture.h game.h game_gui.h league.h live_game.h maths.h misc.h option.h player.h table.h team.h treeview.h user.h variables.h \
game_gui.c file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h treeview.h support.h team.h user.h variables.h window.h \
gui.c gui.h misc.h support.h variables.h window.h \
interface.c callbacks.h interface.h support.h \
league.c league.h team.h variables.h \
live_game.c game.h live_game.h variables.h \
league.c cup.h league.h team.h variables.h \
live_game.c fixture.h free.h game.h game_gui.h live_game.h maths.h misc_callback_func.h option.h player.h support.h team.h treeview.h user.h variables.h window.h \
load_save.c load_save.h \
main.c file.h free.h main.h variables.h window.h \
maths.c maths.h misc.h variables.h \
misc.c free.h misc.h \
main.c misc_callbacks.h file.h free.h main.h transfer_struct.h variables.h window.h \
maths.c maths.h misc.h \
misc.c main.h maths.h misc.h \
misc_callbacks.c free.h misc_callback_func.h misc_callbacks.h \
misc_callback_func.c misc_callback_func.h start_end.h support.h team.h treeview.h user.h variables.h xml_country.h \
misc_interface.c misc_interface.h misc_callbacks.h support.h \
misc2_callbacks.c misc2_callbacks.h \
misc2_callbacks.c finance.h game_gui.h main.h misc2_callbacks.h misc2_callback_func.h misc2_interface.h support.h transfer.h user.h window.h \
misc2_callback_func.c finance.h game_gui.h maths.h misc2_callback_func.h option.h player.h team.h treeview.h transfer.h user.h \
misc2_interface.c misc2_interface.h misc2_callbacks.h support.h \
option.c option.h \
option.c option.h variables.h \
options_callbacks.c options_callbacks.h \
options_interface.c options_interface.h options_callbacks.h support.h \
player.c free.h league.h maths.h player.h team.h variables.h \
start_end.c cup.h fixture.h league.h maths.h player.h start_end.h team.h transfer.h variables.h xml_name.h \
player.c cup.h free.h game_gui.h league.h maths.h misc.h option.h player.h team.h user.h \
start_end.c cup.h file.h finance.h fixture.h game_gui.h gui.h league.h live_game.h main.h maths.h start_end.h table.h team.h transfer.h user.h variables.h xml_name.h \
support.c support.h \
table.c table.h \
team.c cup.h free.h league.h maths.h player.h team.h variables.h \
transfer.c transfer.h \
treeview.c gui.h league.h support.h team.h treeview.h variables.h \
treeview_cell.c treeview_cell.h \
user.c team.h user.h user_struct.h \
window.c misc_interface.h file.h free.h support.h window.h \
xml_cup.c cup.h file.h misc.h variables.h xml_cup.h \
xml_country.c file.h free.h league.h misc.h variables.h xml_cup.h xml_country.h xml_league.h \
xml_general.c xml_general.h \
xml_league.c file.h league.h misc.h team.h variables.h xml_league.h \
xml_name.c file.h free.h maths.h variables.h xml_name.h \
xml_teams.c xml_teams.h \
xml.c xml.h
table.c cup.h league.h table.h variables.h \
team.c cup.h fixture.h game.h game_gui.h league.h maths.h misc.h option.h player.h team.h transfer.h user.h \
transfer.c finance.h free.h maths.h option.h player.h team.h transfer.h user.h \
treeview.c cup.h file.h finance.h fixture.h free.h league.h live_game.h maths.h misc.h player.h option.h support.h team.h transfer.h treeview.h treeview_cell.h user.h \
treeview_cell.c misc.h option.h player.h team.h treeview.h treeview_cell.h user.h variables.h \
user.c fixture.h free.h game_gui.h maths.h misc.h option.h player.h transfer.h user.h window.h \
window.c file.h finance.h free.h game_gui.h gui.h interface.h misc_interface.h misc2_interface.h option.h support.h user.h window.h \
xml_cup.c cup.h file.h misc.h xml_cup.h \
xml_country.c file.h free.h misc.h variables.h xml_cup.h xml_country.h xml_league.h \
xml_league.c cup_struct.h file.h free.h league.h misc.h team.h table.h variables.h xml_league.h xml_cup.h \
xml_name.c file.h free.h maths.h misc.h variables.h xml_name.h
bygfoot_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)

View File

@@ -10,12 +10,10 @@
#include "option.h"
#include "player.h"
#include "start_end.h"
#include "support.h"
#include "team.h"
#include "transfer.h"
#include "treeview.h"
#include "user.h"
#include "variables.h"
#include "window.h"
/** Show the users' live games. */

View File

@@ -1,17 +1,12 @@
#include "callbacks.h"
#include "callback_func.h"
#include "enums.h"
#include "game_gui.h"
#include "main.h"
#include "team.h"
#include "transfer.h"
#include "treeview.h"
#include "variables.h"
#include "window.h"
/*d*/
#include "player.h"
#include "user.h"
#include "window.h"
gboolean
on_button_quit_clicked (GtkWidget *widget,

View File

@@ -4,7 +4,6 @@
#include "misc.h"
#include "option.h"
#include "support.h"
#include "user.h"
#include "variables.h"
/**

View File

@@ -6,7 +6,6 @@
#include "player.h"
#include "team.h"
#include "user.h"
#include "window.h"
/** Weekly update of finances. */
void

View File

@@ -2,7 +2,6 @@
#define FINANCE_H
#include "bygfoot.h"
#include "variables.h"
#include "user_struct.h"
/** The amount of money the user can spend. */

View File

@@ -7,7 +7,6 @@
#include "misc.h"
#include "table.h"
#include "team.h"
#include "user.h"
#include "variables.h"
/** Write the fixtures for the given league

View File

@@ -1,11 +1,6 @@
#include "cup.h"
#include "fixture.h"
#include "free.h"
#include "league.h"
#include "player.h"
#include "user.h"
#include "variables.h"
#include "window.h"
/**
Free all memory allocated by the program.

View File

@@ -4,24 +4,14 @@
#include "bygfoot.h"
#include "fixture_struct.h"
#include "player_struct.h"
/** Indices for the team_value array.
@see game_get_values() */
enum GameTeamValue
{
GAME_TEAM_VALUE_DEFEND = 0,
GAME_TEAM_VALUE_MIDFIELD,
GAME_TEAM_VALUE_ATTACK,
GAME_TEAM_VALUE_GOALIE,
GAME_TEAM_VALUE_END
};
#include "live_game_struct.h"
/** Player types. @see game_get_player() */
enum GamePlayerType
{
GAME_PLAYER_TYPE_ATTACK = 0,
GAME_PLAYER_TYPE_MIDFIELD,
GAME_PLAYER_TYPE_DEFEND,
GAME_PLAYER_TYPE_DEFEND = LIVE_GAME_UNIT_AREA_DEFEND,
GAME_PLAYER_TYPE_MIDFIELD = LIVE_GAME_UNIT_AREA_MIDFIELD,
GAME_PLAYER_TYPE_ATTACK = LIVE_GAME_UNIT_AREA_ATTACK,
GAME_PLAYER_TYPE_PENALTY,
GAME_PLAYER_TYPE_END
};

View File

View File

View File

View File

View File

View File

View File

@@ -1,5 +1,4 @@
#include "cup.h"
#include "fixture_struct.h"
#include "league.h"
#include "team.h"
#include "variables.h"

View File

@@ -1,4 +1,3 @@
#include "enums.h"
#include "fixture.h"
#include "free.h"
#include "game.h"

View File

@@ -2,7 +2,7 @@
#define LIVE_GAME_STRUCT_H
#include "bygfoot.h"
#include "game.h"
#include "fixture_struct.h"
/** Events happening during a live game.
@see #LiveGameEvent
@@ -76,6 +76,15 @@ enum LiveGameEventValue2
LIVE_GAME_EVENT_VALUE2_END
};
enum LiveGameUnitArea
{
LIVE_GAME_UNIT_AREA_DEFEND = 0,
LIVE_GAME_UNIT_AREA_MIDFIELD,
LIVE_GAME_UNIT_AREA_ATTACK,
LIVE_GAME_UNIT_AREA_END
};
/** Indices for the time variable of th
#LiveGameUnit struct. */
enum LiveGameUnitTime
@@ -102,14 +111,6 @@ enum LiveGameStatValue
LIVE_GAME_STAT_VALUE_END
};
enum LiveGameUnitArea
{
LIVE_GAME_UNIT_AREA_DEFEND = GAME_PLAYER_TYPE_DEFEND,
LIVE_GAME_UNIT_AREA_MIDFIELD = GAME_PLAYER_TYPE_MIDFIELD,
LIVE_GAME_UNIT_AREA_ATTACK = GAME_PLAYER_TYPE_ATTACK,
LIVE_GAME_UNIT_AREA_END
};
enum LiveGameStatArray
{
LIVE_GAME_STAT_ARRAY_SCORERS = 0,
@@ -119,6 +120,17 @@ enum LiveGameStatArray
LIVE_GAME_STAT_ARRAY_END
};
/** Indices for the team_value array.
@see game_get_values() */
enum GameTeamValue
{
GAME_TEAM_VALUE_DEFEND = 0,
GAME_TEAM_VALUE_MIDFIELD,
GAME_TEAM_VALUE_ATTACK,
GAME_TEAM_VALUE_GOALIE,
GAME_TEAM_VALUE_END
};
/** Some stats for a live game like ball possession,
shots on goal etc. */
typedef struct

View File

@@ -1,7 +1,5 @@
#include "maths.h"
#include "misc.h"
#include "variables.h"
/**
Generate a Gauss-distributed (pseudo)random number.

View File

@@ -1,4 +1,3 @@
#include "free.h"
#include "main.h"
#include "maths.h"
#include "misc.h"

View File

@@ -1,15 +1,12 @@
#include "bygfoot.h"
#include "finance.h"
#include "game_gui.h"
#include "main.h"
#include "misc2_callbacks.h"
#include "misc2_callback_func.h"
#include "misc2_interface.h"
#include "player.h"
#include "support.h"
#include "transfer.h"
#include "treeview.h"
#include "user.h"
#include "variables.h"
#include "window.h"
@@ -145,13 +142,7 @@ on_button_yesno_yes_clicked (GtkButton *button,
g_warning("on_button_yesno_yes_clicked: unknown status %d\n", stat0);
break;
case STATUS_TRANSFER_OFFER:
current_user.money += transoff(stat1, 0).fee;
current_user.money_in[1][MON_IN_TRANSFERS] += transoff(stat1, 0).fee;
player_remove_from_team(current_user.tm,
player_id_index(current_user.tm, trans(stat1).id));
transfer_remove_player(stat1);
treeview_show_user_player_list(&current_user);
game_gui_set_main_window_header();
misc2_callback_transfer_user_player();
break;
}
/*d*/

View File

@@ -1,3 +1,6 @@
#ifndef MISC2_CALLBACKS_H
#define MISC2_CALLBACKS_H
#include <gtk/gtk.h>
@@ -47,3 +50,6 @@ on_button_yesno_yes_clicked (GtkButton *button,
void
on_button_yesno_no_clicked (GtkButton *button,
gpointer user_data);
#endif

View File

@@ -4,10 +4,8 @@
#include "gui.h"
#include "maths.h"
#include "misc_callback_func.h"
#include "option.h"
#include "start_end.h"
#include "support.h"
#include "team.h"
#include "treeview.h"
#include "user.h"
#include "variables.h"

View File

@@ -1,14 +1,11 @@
#include <string.h>
#include "callback_func.h"
#include "free.h"
#include "game.h"
#include "game_gui.h"
#include "live_game.h"
#include "main.h"
#include "misc_callback_func.h"
#include "misc_callbacks.h"
#include "option.h"
#include "treeview.h"
#include "user.h"
#include "variables.h"
#include "window.h"

View File

@@ -8,7 +8,6 @@
#include "player.h"
#include "team.h"
#include "user.h"
#include "variables.h"
/** Create and return a new player.
@param tm The team the player will belong to.

View File

@@ -8,7 +8,6 @@
#include "live_game.h"
#include "main.h"
#include "maths.h"
#include "player.h"
#include "start_end.h"
#include "table.h"
#include "team.h"

View File

@@ -1,6 +1,5 @@
#include "cup.h"
#include "league.h"
#include "maths.h"
#include "table.h"
#include "variables.h"

View File

@@ -1,6 +1,5 @@
#include "cup.h"
#include "fixture.h"
#include "free.h"
#include "game.h"
#include "game_gui.h"
#include "league.h"
@@ -11,7 +10,6 @@
#include "team.h"
#include "transfer.h"
#include "user.h"
#include "variables.h"
/**
Generate a team with default values, e.g.

View File

@@ -1,6 +1,5 @@
#include "finance.h"
#include "free.h"
#include "league.h"
#include "maths.h"
#include "option.h"
#include "player.h"
@@ -27,21 +26,26 @@ transfer_update(void)
transfer_evaluate_offers();
for(i=transfer_list->len - 1;i>=0;i--)
{
if(team_is_user(trans(i).tm) == -1 ||
trans(i).offers->len == 0)
{
trans(i).time--;
if(trans(i).time == 0)
transfer_remove_player(i);
}
}
transfer_add_new_players();
transfer_add_offers();
}
/** Add offers for the users' players on the list. */
/** Add offers for the users' players on the list.
We also sort the offers from other users. */
void
transfer_add_offers(void)
{
gint i;
gint i, j;
gfloat scout_factor_bounds[4][2] =
{{const_float("float_transfer_offer_fee_best_lower"),
const_float("float_transfer_offer_fee_best_upper")},
@@ -64,9 +68,35 @@ transfer_add_offers(void)
scout_factor_bounds[user_from_team(trans(i).tm)->scout % 10][0],
scout_factor_bounds[user_from_team(trans(i).tm)->scout % 10][1]))),
-1);
}
else if(team_is_user(trans(i).tm) != -1 &&
trans(i).offers->len > 1)
{
g_array_sort(trans(i).offers, transfer_offer_compare_func);
for(j=trans(i).offers->len - 1; j >= 0; j--)
if(transoff(i, j).fee > BUDGET(user_get_index(user_from_team(transoff(i, j).tm))))
{
user_event_add(user_from_team(transoff(i, j).tm),
EVENT_TYPE_TRANSFER_OFFER_MONEY, -1, -1,
trans(i).tm, player_of_id(trans(i).tm, trans(i).id)->name->str);
user_event_remove(user_from_team(trans(i).tm),
user_event_get_index(user_from_team(trans(i).tm),
EVENT_TYPE_TRANSFER_OFFER, trans(i).id,
-1, NULL, NULL));
g_array_remove_index(trans(i).offers, j);
}
user_event_add(user_from_team(trans(i).tm), EVENT_TYPE_TRANSFER_OFFER,
i, -1, NULL, NULL);
for(j=trans(i).offers->len - 1; j >= 1; j--)
{
user_event_add(user_from_team(transoff(i, j).tm),
EVENT_TYPE_TRANSFER_OFFER_OUTBID, -1, -1,
trans(i).tm, player_of_id(trans(i).tm, trans(i).id)->name->str);
user_event_remove(user_from_team(trans(i).tm),
user_event_get_index(user_from_team(trans(i).tm),
EVENT_TYPE_TRANSFER_OFFER, trans(i).id,
-1, NULL, NULL));
g_array_remove_index(trans(i).offers, j);
}
}
}
@@ -328,9 +358,29 @@ transfer_add_offer(gint idx, Team *tm, gint fee, gint wage)
g_array_append_val(trans(idx).offers, new);
if(team_is_user(trans(idx).tm) != -1)
user_event_add(user_from_team(trans(idx).tm), EVENT_TYPE_TRANSFER_OFFER,
trans(idx).id, -1, NULL, NULL);
return FALSE;
}
/** Return the index of the transfer containing the player going with
the team and the id. */
gint
transfer_get_index(const Team *tm, gint id)
{
gint i;
for(i=0;i<transfer_list->len;i++)
if(trans(i).tm == tm && trans(i).id == id)
return i;
g_warning("transfer_get_index: didn't find transfer.\n");
return -1;
}
/** Remove any offers from the team for the given transfer player. */
gboolean
transfer_remove_offer(gint idx, const Team *tm)

View File

@@ -53,4 +53,7 @@ transfer_remove_player_ptr(const Player *pl);
Team*
transfer_team_get_new(void);
gint
transfer_get_index(const Team *tm, gint id);
#endif

View File

@@ -3,7 +3,6 @@
#include "finance.h"
#include "fixture.h"
#include "free.h"
#include "gui.h"
#include "league.h"
#include "live_game.h"
#include "maths.h"
@@ -16,8 +15,6 @@
#include "treeview.h"
#include "treeview_cell.h"
#include "user.h"
#include "variables.h"
#include "window.h"
/** Select the row that's been clicked on. */
void

View File

@@ -1,4 +1,3 @@
#include "maths.h"
#include "misc.h"
#include "option.h"
#include "player.h"

View File

@@ -1,13 +1,10 @@
#include "fixture.h"
#include "free.h"
#include "game_gui.h"
#include "league.h"
#include "maths.h"
#include "misc.h"
#include "option.h"
#include "player.h"
#include "support.h"
#include "team.h"
#include "transfer.h"
#include "user.h"
#include "window.h"
@@ -261,7 +258,8 @@ user_event_add(User *user, gint type, gint value1, gint value2,
if(value_string != NULL)
new.value_string = g_string_new(value_string);
else
new.value_string = NULL;
g_array_append_val(user->events, new);
}
@@ -276,6 +274,28 @@ user_event_remove(User *user, gint idx)
g_array_remove_index(user->events, idx);
}
/** Find the event index going with the values. */
gint
user_event_get_index(User *user, gint type, gint value1, gint value2,
gpointer value_pointer, gchar *value_string)
{
gint i;
for(i=0;i<user->events->len;i++)
if(g_array_index(user->events, Event, i).type == type &&
g_array_index(user->events, Event, i).value1 == value1 &&
g_array_index(user->events, Event, i).value2 == value2 &&
g_array_index(user->events, Event, i).value_pointer == value_pointer &&
((gpointer)g_array_index(user->events, Event, i).value_string == (gpointer)value_string ||
strcmp(g_array_index(user->events, Event, i).value_string->str, value_string) == 0))
return i;
g_warning("user_event_get_index: didn't find index.");
return -1;
}
/** Show the next event for the current user. */
void
user_event_show_next(void)
@@ -283,6 +303,7 @@ user_event_show_next(void)
Event *event = NULL;
gchar buf[BIG],
buf2[SMALL], buf3[SMALL];
gint temp_int = -1;
if(current_user.events->len == 0)
{
@@ -339,23 +360,28 @@ user_event_show_next(void)
game_gui_show_warning(buf);
break;
case EVENT_TYPE_TRANSFER_OFFER:
misc_print_grouped_int(transoff(event->value1, 0).fee, buf2, FALSE);
misc_print_grouped_int(
ABS(transoff(event->value1, 0).fee -
player_of_id(event->user->tm, trans(event->value1).id)->value), buf3, FALSE);
if(transoff(event->value1, 0).fee -
player_of_id(event->user->tm, trans(event->value1).id)->value > 0)
temp_int = transfer_get_index(event->user->tm, event->value1);
misc_print_grouped_int(transoff(temp_int, 0).fee, buf2, FALSE);
misc_print_grouped_int(ABS(transoff(temp_int, 0).fee -
player_of_id(event->user->tm, trans(temp_int).id)->value), buf3, FALSE);
if(transoff(temp_int, 0).fee -
player_of_id(event->user->tm, trans(temp_int).id)->value > 0)
strcat(buf3, " more");
else
strcat(buf3, " less");
sprintf(buf, _("%s would like to buy %s. They offer %s for him, which is %s than the player's value. Do you accept?"), transoff(event->value1, 0).tm->name->str,
player_of_id(event->user->tm, trans(event->value1).id)->name->str,
sprintf(buf, _("%s would like to buy %s. They offer %s for him, which is %s than the player's value. Do you accept?"), transoff(temp_int, 0).tm->name->str,
player_of_id(event->user->tm, trans(temp_int).id)->name->str,
buf2, buf3);
stat0 = STATUS_TRANSFER_OFFER;
stat1 = event->value1;
stat1 = temp_int;
window_show_yesno(buf, FALSE);
break;
case EVENT_TYPE_TRANSFER_OFFER_OUTBID:
sprintf(buf, _("There was a higher bid for %s than yours."),
event->value_string->str);
game_gui_show_warning(buf);
break;
}
user_event_remove(&current_user, 0);

View File

@@ -59,4 +59,8 @@ user_set_up_counters(User *user);
gint
user_get_index(User *user);
gint
user_event_get_index(User *user, gint type, gint value1, gint value2,
gpointer value_pointer, gchar *value_string);
#endif

View File

@@ -3,8 +3,9 @@
#include "bygfoot.h"
#include "enums.h"
#include "team_struct.h"
#include "live_game_struct.h"
#include "player_struct.h"
#include "team_struct.h"
/** Indices for the money_in array. */
enum MonIn
@@ -96,6 +97,7 @@ enum EventType
EVENT_TYPE_TRANSFER_OFFER_MONEY,
EVENT_TYPE_TRANSFER_OFFER_ROSTER,
EVENT_TYPE_TRANSFER_OFFER_ACCEPTED,
EVENT_TYPE_TRANSFER_OFFER_OUTBID,
EVENT_TYPE_END
};

View File

@@ -4,13 +4,11 @@
#include "game_gui.h"
#include "gui.h"
#include "interface.h"
#include "main.h"
#include "misc_interface.h"
#include "misc2_interface.h"
#include "option.h"
#include "support.h"
#include "user.h"
#include "variables.h"
#include "window.h"
/**

View File

@@ -1,2 +0,0 @@
#include "xml.h"

View File

@@ -1,4 +0,0 @@
#ifndef XML_H
#define XML_H
#endif

View File

@@ -1,6 +1,5 @@
#include "file.h"
#include "free.h"
#include "league.h"
#include "misc.h"
#include "variables.h"
#include "xml_cup.h"

View File

@@ -1,10 +1,8 @@
#include "cup.h"
#include "file.h"
#include "misc.h"
#include "variables.h"
#include "xml_cup.h"
/**
* The tags used in the XML files defining cups.
*/

View File

View File

View File

View File

View File

@@ -5,7 +5,7 @@
# is rather clear if you take a look at the options window in the game.
int_opt_user_confirm_unfit 1
int_opt_user_show_live_game 0
int_opt_user_show_live_game 1
int_opt_user_live_game_speed -10
int_opt_user_show_tendency_bar 1
int_opt_user_notify_transfer 0