mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-01-31 07:54:50 +01:00
Ticket prices are saved. They are also moved to team.stadium instead of user.
This commit is contained in:
parent
83976487f8
commit
beff044999
@ -2067,11 +2067,11 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="climb_rate">1</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="numeric">False</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
|
||||
<property name="snap_to_ticks">False</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="adjustment">1 0 100 1 10 10</property>
|
||||
<property name="adjustment">1 0 100 0.00999999977648 10 10</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -260,7 +260,10 @@ misc_callback_improve_stadium(void)
|
||||
GtkSpinButton *spinbutton_capacity =
|
||||
GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spinbutton_capacity")),
|
||||
*spinbutton_safety =
|
||||
GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spinbutton_safety"));
|
||||
GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spinbutton_safety")),
|
||||
*spinbutton_ticket_price =
|
||||
GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spin_ticket_price"));
|
||||
gfloat ticket_price = gtk_spin_button_get_value(spinbutton_ticket_price);
|
||||
gint value_capacity = gtk_spin_button_get_value_as_int(spinbutton_capacity),
|
||||
value_safety = gtk_spin_button_get_value_as_int(spinbutton_safety);
|
||||
gint cost_capacity, cost_safety;
|
||||
@ -282,6 +285,8 @@ misc_callback_improve_stadium(void)
|
||||
return;
|
||||
}
|
||||
|
||||
current_user.tm->stadium.ticket_price = ticket_price;
|
||||
|
||||
current_user.money -= (cost_capacity + cost_safety);
|
||||
current_user.money_out[1][MON_OUT_STADIUM_IMPROVEMENT] -= (cost_safety + cost_capacity);
|
||||
|
||||
|
@ -1004,12 +1004,13 @@ create_window_stadium (void)
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table3), 3);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table3), 3);
|
||||
|
||||
spin_ticket_price_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
|
||||
spin_ticket_price_adj = gtk_adjustment_new (1, 0, 100, 0.00999999977648, 10, 10);
|
||||
spin_ticket_price = gtk_spin_button_new (GTK_ADJUSTMENT (spin_ticket_price_adj), 1, 2);
|
||||
gtk_widget_show (spin_ticket_price);
|
||||
gtk_table_attach (GTK_TABLE (table3), spin_ticket_price, 1, 2, 1, 2,
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (0), 0, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_ticket_price), TRUE);
|
||||
|
||||
label124 = gtk_label_new (_("Change ticket price"));
|
||||
gtk_widget_show (label124);
|
||||
|
@ -64,6 +64,8 @@ team_new(gboolean new_id)
|
||||
new.average_talent = 0;
|
||||
new.luck = 1;
|
||||
|
||||
new.stadium.ticket_price = const_int("int_team_stadium_ticket_price");
|
||||
|
||||
new.players = g_array_new(FALSE, FALSE, sizeof(Player));
|
||||
|
||||
return new;
|
||||
|
@ -65,6 +65,7 @@ typedef struct
|
||||
of the capacity. Default: 0. */
|
||||
games; /**< Number of games. Default: 0. */
|
||||
gfloat safety; /**< Safety percentage between 0 and 100. Default: randomized. */
|
||||
gfloat ticket_price;
|
||||
|
||||
} Stadium;
|
||||
|
||||
|
@ -76,7 +76,6 @@ user_new(void)
|
||||
|
||||
new.bets[0] = g_array_new(FALSE, FALSE, sizeof(BetUser));
|
||||
new.bets[1] = g_array_new(FALSE, FALSE, sizeof(BetUser));
|
||||
new.ticket_price = const_int("int_team_stadium_ticket_price");
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ typedef struct
|
||||
/** The user's money, debt, income and expenses.
|
||||
We have double arrays to store information about
|
||||
the current and the past week. */
|
||||
gint ticket_price, money, debt, money_in[2][MON_IN_END],
|
||||
gint money, debt, money_in[2][MON_IN_END],
|
||||
money_out[2][MON_OUT_END];
|
||||
/** The user's scout and physio qualities.
|
||||
@see #Quality */
|
||||
|
@ -510,7 +510,7 @@ window_show_stadium(void)
|
||||
GtkProgressBar *progressbar_safety,
|
||||
*progressbar_average_attendance;
|
||||
gfloat average_attendance_perc = 0;
|
||||
GtkSpinButton *spinbutton_ticket_price;
|
||||
GtkSpinButton *spin_ticket_price;
|
||||
|
||||
window_create(WINDOW_STADIUM);
|
||||
|
||||
@ -519,8 +519,8 @@ window_show_stadium(void)
|
||||
label_average_attendance = GTK_LABEL(lookup_widget(window.stadium, "label_average_attendance"));
|
||||
label_name = GTK_LABEL(lookup_widget(window.stadium, "label_stadium_name"));
|
||||
|
||||
spinbutton_ticket_price = GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spin_ticket_price"));
|
||||
gtk_spin_button_set_value(spinbutton_ticket_price, current_user.ticket_price);
|
||||
spin_ticket_price = GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spin_ticket_price"));
|
||||
gtk_spin_button_set_value(spin_ticket_price, tm->stadium.ticket_price);
|
||||
|
||||
progressbar_safety = GTK_PROGRESS_BAR(lookup_widget(window.stadium, "progressbar_safety"));
|
||||
progressbar_average_attendance = GTK_PROGRESS_BAR(lookup_widget(window.stadium, "progressbar_average_attendance"));
|
||||
|
@ -49,6 +49,7 @@ enum
|
||||
TAG_TEAM_STADIUM_GAMES,
|
||||
TAG_TEAM_STADIUM_SAFETY,
|
||||
TAG_TEAM_LUCK,
|
||||
TAG_TEAM_STADIUM_TICKET_PRICE,
|
||||
TAG_END
|
||||
};
|
||||
|
||||
@ -129,6 +130,7 @@ xml_loadsave_teams_end_element (GMarkupParseContext *context,
|
||||
tag == TAG_TEAM_STADIUM_AVERAGE_ATTENDANCE ||
|
||||
tag == TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE ||
|
||||
tag == TAG_TEAM_STADIUM_GAMES ||
|
||||
tag == TAG_TEAM_STADIUM_TICKET_PRICE ||
|
||||
tag == TAG_TEAM_STADIUM_SAFETY)
|
||||
state = TAG_TEAM_STADIUM;
|
||||
else if(tag >= TAG_START_PLAYERS && tag <= TAG_END_PLAYERS)
|
||||
@ -189,6 +191,8 @@ xml_loadsave_teams_text (GMarkupParseContext *context,
|
||||
new_team.stadium.games = int_value;
|
||||
else if(state == TAG_TEAM_STADIUM_SAFETY)
|
||||
new_team.stadium.safety = float_value;
|
||||
else if(state == TAG_TEAM_STADIUM_TICKET_PRICE)
|
||||
new_team.stadium.ticket_price = float_value;
|
||||
else if(state == TAG_TEAM_LUCK)
|
||||
new_team.luck = float_value;
|
||||
else if(state >= TAG_START_PLAYERS && state <= TAG_END_PLAYERS)
|
||||
@ -279,6 +283,7 @@ xml_loadsave_teams_write_team(FILE *fil, const Team* team)
|
||||
xml_write_int(fil, team->stadium.possible_attendance, TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE, I2);
|
||||
xml_write_int(fil, team->stadium.games, TAG_TEAM_STADIUM_GAMES, I2);
|
||||
xml_write_float(fil, team->stadium.safety, TAG_TEAM_STADIUM_SAFETY, I2);
|
||||
xml_write_float(fil, team->stadium.ticket_price, TAG_TEAM_STADIUM_TICKET_PRICE, I2);
|
||||
|
||||
fprintf(fil, "%s</_%d>\n", I1, TAG_TEAM_STADIUM);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user