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

"Job exchange fixes."

This commit is contained in:
gyboth 2005-12-01 14:49:00 +00:00
parent 15ad0cbb01
commit dd7376b42e
7 changed files with 86 additions and 55 deletions

View File

@ -34,6 +34,7 @@
#include "league.h"
#include "load_save.h"
#include "main.h"
#include "misc2_callback_func.h"
#include "option.h"
#include "player.h"
#include "table.h"
@ -648,6 +649,14 @@ on_treeview_right_button_press_event (GtkWidget *widget,
game_gui_show_job_offer(NULL,
&g_array_index(jobs, Job, idx - 1),
STATUS_JOB_EXCHANGE_SHOW_TEAM);
else if(event->button == 3)
if(misc2_callback_evaluate_job_application(
&g_array_index(jobs, Job, idx - 1), &current_user))
{
stat0 = STATUS_MAIN;
game_gui_show_main();
setsav0;
}
break;
}

View File

@ -500,7 +500,8 @@ file_load_user_conf_file(User *user)
!file_my_fopen(conf_file, "r", &fil, FALSE))
{
g_free(conf_file);
conf_file = file_find_support_file(opt_str("string_opt_default_user_conf_file"), TRUE);
conf_file =
file_find_support_file(opt_str("string_opt_default_user_conf_file"), TRUE);
}
file_load_opt_file(conf_file, &user->options);

View File

@ -334,7 +334,11 @@ query_job_application_successful(const Job *job, const User *user)
}
/*d*/
printf("%s %.0f\n", tm->name, success_needed);
printf("%s avd %.1f ld %d crd %d %.0f\n", tm->name,
job_av_skill - user_av_skill,
job->league_layer - league_from_clid(user->tm->clid)->layer,
job->country_rating - country.rating,
success_needed);
return (user->counters[COUNT_USER_SUCCESS] >= success_needed);
}

View File

@ -29,6 +29,7 @@
#include "finance.h"
#include "free.h"
#include "game_gui.h"
#include "job.h"
#include "league.h"
#include "maths.h"
#include "misc.h"
@ -217,7 +218,8 @@ void
misc2_callback_add_user(void)
{
GtkTreeView *treeview_user_management_teams =
GTK_TREE_VIEW(lookup_widget(window.user_management, "treeview_user_management_teams"));
GTK_TREE_VIEW(lookup_widget(window.user_management,
"treeview_user_management_teams"));
GtkEntry *entry_user_management =
GTK_ENTRY(lookup_widget(window.user_management, "entry_user_management"));
const gchar *user_name = gtk_entry_get_text(entry_user_management);
@ -225,9 +227,10 @@ misc2_callback_add_user(void)
Team *tm = (Team*)treeview_helper_get_pointer(treeview_user_management_teams, 2);
if(strlen(user_name) > 0)
misc_string_assign(&new_user.name, user_name);
gtk_entry_set_text(entry_user_management, "");
{
misc_string_assign(&new_user.name, user_name);
gtk_entry_set_text(entry_user_management, "");
}
new_user.tm = tm;
new_user.team_id = tm->id;
@ -238,11 +241,13 @@ misc2_callback_add_user(void)
g_array_append_val(users, new_user);
user_set_up_team(&usr(users->len - 1));
file_load_user_conf_file(&usr(users->len - 1));
treeview_show_users(GTK_TREE_VIEW(lookup_widget(window.user_management, "treeview_user_management_users")));
user_set_up_team(&usr(users->len - 1));
treeview_show_users(
GTK_TREE_VIEW(lookup_widget(window.user_management,
"treeview_user_management_users")));
treeview_show_team_list(treeview_user_management_teams, FALSE, FALSE);
setsav0;
@ -293,3 +298,45 @@ misc2_callback_mmatches_button_press(GtkWidget *widget, gint row_num, gint col_n
treeview2_show_mmatches();
}
}
/** Find out whether the user's application for the job
is accepted and show the appropriate popups.
@return TRUE if accepted, FALSE otherwise. */
gboolean
misc2_callback_evaluate_job_application(Job *job, User *user)
{
if(!query_job_application_successful(job, user))
{
game_gui_show_warning(
_("The owners of %s politely reject your application. You're not successful enough in their eyes."),
job_get_team(job)->name);
return FALSE;
}
if(job->type != JOB_TYPE_NATIONAL)
{
game_gui_show_warning(
_("The owners of %s accept your application. Since %s don't want to get stuck with a lame duck, you get fired instantly and spend the rest of the current season tending your garden."),
job_get_team(job)->name, user->tm->name);
job_change_country(job);
}
else
game_gui_show_warning(
_("The owners of %s accept your application."),
current_user.tm->name);
printf("misc2 1\n");
user_change_team(user, team_of_id(job->team_id));
printf("misc2 2\n");
if(job->type == JOB_TYPE_NATIONAL)
job_remove(job, TRUE);
else
{
job_remove(job, FALSE);
job_remove_national();
}
printf("misc2 3\n");
return TRUE;
}

View File

@ -46,5 +46,8 @@ misc2_callback_add_user(void);
void
misc2_callback_mmatches_button_press(GtkWidget *widget, gint row_num, gint col_num);
gboolean
misc2_callback_evaluate_job_application(Job *job, User *user);
#endif

View File

@ -55,43 +55,8 @@ on_button_offer_ok_clicked (GtkButton *button,
gchar *team_name = g_strdup(current_user.tm->name);
if(stat2 == STATUS_JOB_EXCHANGE_SHOW_TEAM)
{
if(query_job_application_successful((Job*)statp, &current_user))
{
if(((Job*)statp)->type != JOB_TYPE_NATIONAL)
{
game_gui_show_warning(
_("The owners of %s accept your application. Since %s don't want to get stuck with a lame duck, you get fired instantly and spend the rest of the current season tending your garden."),
job_get_team((Job*)statp)->name, current_user.tm->name);
job_change_country((Job*)statp);
}
else
game_gui_show_warning(
_("The owners of %s accept your application."),
current_user.tm->name);
printf("misc2 1\n");
user_change_team(&current_user, team_of_id(((Job*)statp)->team_id));
printf("misc2 2\n");
if(((Job*)statp)->type == JOB_TYPE_NATIONAL)
job_remove((Job*)statp, TRUE);
else
{
job_remove((Job*)statp, FALSE);
job_remove_national();
}
printf("misc2 3\n");
}
else
{
game_gui_show_warning(
_("The owners of %s politely reject your application. You're not successful enough in their eyes."),
job_get_team((Job*)statp)->name);
changed = FALSE;
}
}
changed =
misc2_callback_evaluate_job_application((Job*)statp, &current_user);
else
user_change_team(&current_user, (Team*)statp);
@ -247,10 +212,12 @@ on_button_yesno_yes_clicked (GtkButton *button,
break;
case STATUS_USER_MANAGEMENT:
user_remove(stat2, TRUE);
treeview_show_users(GTK_TREE_VIEW(lookup_widget(window.user_management,
"treeview_user_management_users")));
treeview_show_team_list(GTK_TREE_VIEW(lookup_widget(window.user_management,
"treeview_user_management_teams")),
treeview_show_users(
GTK_TREE_VIEW(lookup_widget(window.user_management,
"treeview_user_management_users")));
treeview_show_team_list(
GTK_TREE_VIEW(lookup_widget(window.user_management,
"treeview_user_management_teams")),
FALSE, FALSE);
break;
case STATUS_QUERY_UNFIT:

View File

@ -898,26 +898,26 @@ int_bet_wager_max 25000
# lower and upper bounds for the number
# of new job offers when the job exchange gets updated
int_job_new_offers_lower 3
int_job_new_offers_upper 6
int_job_new_offers_lower 4
int_job_new_offers_upper 8
# how often (in weeks) an update occurs
int_job_update_interval 5
# percentage of international offers
float_job_international_perc 50000
float_job_international_perc 70000
# number of success points per average skill
# difference unit (needed when finding out whether
# a user's application for a job is successful)
int_job_application_points_per_av_skill 40
int_job_application_points_per_av_skill 20
# how many points a league layer difference is worth
int_job_application_points_per_layer 30
# how many points more are needed for an international
# application
int_job_application_points_international 150
int_job_application_points_international 200
# how many points a country rating difference is worth
int_job_application_points_per_rating 80