1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2024-12-16 10:21:15 +01:00

Fixed player removal when user changes teams.

This commit is contained in:
gyboth 2007-09-01 11:28:09 +00:00
parent 9e00c407ba
commit 2b9e3795e0
4 changed files with 37 additions and 15 deletions

View File

@ -25,6 +25,7 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
libdir = @libdir@
localedir = $(libdir)/locale
@ -78,7 +79,7 @@ INSTOBJEXT = @INSTOBJEXT@
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
&& rm -f $$file && $(GMSGFMT) -c -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
@ -93,6 +94,21 @@ all-no:
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--flag=g_strdup_printf:1:c-format \
--flag=g_string_printf:2:c-format \
--flag=g_string_append_printf:2:c-format \
--flag=g_error_new:3:c-format \
--flag=g_set_error:4:c-format \
--flag=g_markup_printf_escaped:1:c-format \
--flag=g_log:3:c-format \
--flag=g_print:1:c-format \
--flag=g_printerr:1:c-format \
--flag=g_printf:1:c-format \
--flag=g_fprintf:2:c-format \
--flag=g_sprintf:2:c-format \
--flag=g_snprintf:3:c-format \
--flag=g_scanner_error:2:c-format \
--flag=g_scanner_warn:2:c-format \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(GETTEXT_PACKAGE).po \
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \

View File

@ -248,7 +248,7 @@ misc2_callback_add_user(void)
file_load_user_conf_file(&usr(users->len - 1));
user_set_up_team(&usr(users->len - 1));
user_set_up_team(&usr(users->len - 1), TRUE);
treeview_show_users(
GTK_TREE_VIEW(lookup_widget(window.user_management,

View File

@ -89,9 +89,12 @@ user_set_up_team_new_game(User *user)
gchar buf[SMALL];
gint rndom;
/* If the user chose to start in a different league than
his team is originally in, the league is stored in the scout
variable. */
if(user->scout == -1)
{
user_set_up_team(user);
user_set_up_team(user, TRUE);
user_history_add(user, USER_HISTORY_START_GAME,
user->tm->name,
league_cup_get_name_string(user->tm->clid), NULL, NULL);
@ -114,25 +117,28 @@ user_set_up_team_new_game(User *user)
user->tm->name,
league_cup_get_name_string(user->tm->clid), NULL, NULL);
user_set_up_team(user);
user_set_up_team(user, TRUE);
}
}
/** Set up finances, remove some players etc. for a new user team.
@par am user The user whose team we set up. */
void
user_set_up_team(User *user)
user_set_up_team(User *user, gboolean remove_players)
{
gint i, j;
for(i=PLAYER_POS_DEFENDER; i<=PLAYER_POS_FORWARD; i++)
for(j=user->tm->players->len - 1; j > 10; j--)
if(g_array_index(user->tm->players, Player, j).pos == i &&
g_array_index(user->tm->players, Player, j).recovery != 1)
{
player_remove_from_team(user->tm, j);
break;
}
if(remove_players)
{
for(i=PLAYER_POS_DEFENDER; i<=PLAYER_POS_FORWARD; i++)
for(j=user->tm->players->len - 1; j > 10; j--)
if(g_array_index(user->tm->players, Player, j).pos == i &&
g_array_index(user->tm->players, Player, j).recovery != 1)
{
player_remove_from_team(user->tm, j);
break;
}
}
for(i=0;i<user->tm->players->len;i++)
g_array_index(user->tm->players, Player, i).recovery = 0;
@ -559,7 +565,7 @@ user_change_team(User *user, Team *tm)
user->tm = tm;
user->team_id = tm->id;
user_set_up_team(user);
user_set_up_team(user, FALSE);
user->counters[COUNT_USER_NEW_SPONSOR] = 0;
user->counters[COUNT_USER_SUCCESS] = (success < 0) ?

View File

@ -40,7 +40,7 @@ void
user_set_up_team_new_game(User *user);
void
user_set_up_team(User *user);
user_set_up_team(User *user, gboolean remove_players);
void
user_set_up_finances(User *user);