bygfoot/src/user_struct.h

224 lines
6.6 KiB
C
Raw Normal View History

2005-10-20 17:45:00 +02:00
/*
2005-11-26 17:52:51 +01:00
user_struct.h
2005-10-20 17:45:00 +02:00
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 USER_STRUCT_H
#define USER_STRUCT_H
#include "bygfoot.h"
#include "enums.h"
#include "live_game_struct.h"
2005-03-23 20:03:26 +01:00
#include "option_struct.h"
2005-03-21 11:16:37 +01:00
#include "player_struct.h"
#include "team_struct.h"
2005-07-08 11:26:00 +02:00
#include "youth_academy_struct.h"
2005-03-16 21:48:25 +01:00
/** Indices for the money_in array. */
enum MonIn
{
MON_IN_PRIZE = 0,
MON_IN_TICKET,
2005-06-20 14:46:57 +02:00
MON_IN_SPONSOR,
2005-10-27 23:10:15 +02:00
MON_IN_BETS,
2005-06-20 14:46:57 +02:00
MON_IN_TRANSFERS,
2005-03-16 21:48:25 +01:00
MON_IN_END
};
/** Indices for the money_out array. */
enum MonOut
{
MON_OUT_WAGE = 0,
MON_OUT_PHYSIO,
MON_OUT_SCOUT,
2005-07-08 11:26:00 +02:00
MON_OUT_YC,
MON_OUT_YA,
2005-03-16 21:48:25 +01:00
MON_OUT_JOURNEY,
2005-03-27 19:59:57 +02:00
MON_OUT_COMPENSATIONS,
2005-10-27 23:10:15 +02:00
MON_OUT_BETS,
2005-11-01 22:20:24 +01:00
MON_OUT_BOOST,
2005-03-16 21:48:25 +01:00
MON_OUT_TRANSFERS,
2005-06-22 18:06:08 +02:00
MON_OUT_STADIUM_IMPROVEMENT,
MON_OUT_STADIUM_BILLS,
2007-01-18 18:39:10 +01:00
MON_OUT_TRAINING_CAMP,
2005-03-16 21:48:25 +01:00
MON_OUT_END
};
2005-03-17 21:26:01 +01:00
/** Indices for the counters variable in #User. */
enum CounterValue
{
COUNT_USER_LOAN = 0, /** How many weeks until user has to pay back his loan. */
COUNT_USER_OVERDRAWN, /**< How often the user overdrew his bank account. */
COUNT_USER_POSITIVE, /**< How many weeks until the bank account has to be positive
or at least not overdrawn). */
COUNT_USER_SUCCESS, /**< How successful the user is. */
COUNT_USER_WARNING, /**< Whether there was already a warning about rumours (new coach). */
COUNT_USER_INC_CAP, /**< How many weeks until the stadium capacity is increased. */
COUNT_USER_INC_SAF, /**< How often the stadium safety was increased (in a week). */
COUNT_USER_STADIUM_CAPACITY, /**< Counter for building stadium seats. */
COUNT_USER_STADIUM_SAFETY, /**< Counter for increasing stadium safety. */
2005-04-06 00:10:18 +02:00
COUNT_USER_SHOW_RES, /**< Whether the latest result is shown when the main window gets refreshed. */
2005-05-30 17:54:20 +02:00
COUNT_USER_TOOK_TURN, /**< Whether the user took his turn in a week round. */
2005-06-20 14:46:57 +02:00
COUNT_USER_NEW_SPONSOR, /**< A new sponsor offer has to be shown. */
2005-03-17 21:26:01 +01:00
COUNT_USER_END
};
2005-06-20 14:46:57 +02:00
/** User-related things that get recorded. */
enum UserHistoryType
{
USER_HISTORY_START_GAME = 0,
USER_HISTORY_FIRE_FINANCE,
2005-06-20 14:46:57 +02:00
USER_HISTORY_FIRE_FAILURE,
USER_HISTORY_JOB_OFFER_ACCEPTED,
USER_HISTORY_END_SEASON,
USER_HISTORY_PROMOTED,
USER_HISTORY_RELEGATED,
USER_HISTORY_WIN_FINAL,
USER_HISTORY_LOSE_FINAL,
USER_HISTORY_REACH_CUP_ROUND,
USER_HISTORY_CHAMPION,
USER_HISTORY_END
};
2005-08-20 21:39:36 +02:00
/** A memorable match (a recording of a live game) of a user. */
typedef struct
{
/** Name of the country the user was playing with. */
2005-10-09 11:35:44 +02:00
gchar *country_name;
2005-08-20 21:39:36 +02:00
/** The name of the competition, including
the cup round name. */
GString *competition_name;
/** Whether the match was on neutral ground. Only
relevant for MM list display. */
gboolean neutral;
/** 0 or 1, indicating which team was the user's. */
gint user_team;
/** The recording. */
LiveGame lg;
} MemMatch;
2005-06-20 14:46:57 +02:00
/** A structure holding an element of a user's history,
e.g. the event of being fired. */
typedef struct
{
/** When the event happened. */
gint season, week;
/** The type (see #UserHistoryType) of the history event. */
gint type;
/** The team of the user at the time. */
gchar *team_name;
/** These can hold various information like
team or league/cup ids. */
gchar *string[3];
2005-06-20 14:46:57 +02:00
} UserHistory;
/** A user sponsor. */
typedef struct
{
GString *name;
gint benefit; /**< Money per week. */
gint contract; /**< Contract length in weeks. */
} UserSponsor;
/** A structure representing a human player. */
typedef struct
{
/** Username. */
2005-10-09 11:35:44 +02:00
gchar *name;
/** The team the user manages. */
Team *tm;
2005-04-13 15:01:59 +02:00
/** The team id (needed when the team pointer gets invalid). */
gint team_id;
/** User options. */
2005-03-23 20:03:26 +01:00
OptionList options;
2005-03-18 23:03:23 +01:00
/** Events shown each week. */
GArray *events;
2005-04-16 09:46:04 +02:00
/** User history. */
GArray *history;
2005-03-17 21:26:01 +01:00
/** User counters (not changeable by the user),
like number of weeks until debt has to be paid back. */
gint counters[COUNT_USER_END];
2005-03-16 21:48:25 +01:00
/** The user's money, debt, income and expenses.
We have double arrays to store information about
the current and the past week. */
gint money, debt, money_in[2][MON_IN_END],
money_out[2][MON_OUT_END];
/** The user's scout and physio qualities.
@see #Quality */
gint scout, physio;
/** The variable for the latest user live game. @see #Game */
LiveGame live_game;
2005-07-08 11:26:00 +02:00
/** Sponsor of the user. */
2005-06-20 14:46:57 +02:00
UserSponsor sponsor;
2005-07-08 11:26:00 +02:00
/** Youth academy of the user. */
YouthAcademy youth_academy;
2005-08-20 21:39:36 +02:00
/** The currently used MM file. */
2005-10-09 11:35:44 +02:00
gchar *mmatches_file;
2005-08-20 21:39:36 +02:00
/** The array of MMs. */
GArray *mmatches;
2005-10-27 23:10:15 +02:00
/** Array of current and recent bets. */
GArray *bets[2];
} User;
2005-03-18 23:03:23 +01:00
enum EventType
{
2005-03-19 21:04:08 +01:00
EVENT_TYPE_WARNING = 0,
EVENT_TYPE_PLAYER_LEFT,
2005-03-18 23:03:23 +01:00
EVENT_TYPE_PAYBACK,
2005-03-19 21:04:08 +01:00
EVENT_TYPE_OVERDRAW,
2005-03-18 23:03:23 +01:00
EVENT_TYPE_JOB_OFFER,
EVENT_TYPE_FIRE_FINANCE,
2005-04-25 18:49:54 +02:00
EVENT_TYPE_FIRE_FAILURE,
2005-05-27 20:48:36 +02:00
EVENT_TYPE_TRANSFER_OFFER_USER,
EVENT_TYPE_TRANSFER_OFFER_CPU,
2005-05-26 11:51:28 +02:00
EVENT_TYPE_TRANSFER_OFFER_REJECTED_BETTER_OFFER,
EVENT_TYPE_TRANSFER_OFFER_REJECTED_FEE_WAGE,
EVENT_TYPE_TRANSFER_OFFER_REJECTED_FEE,
EVENT_TYPE_TRANSFER_OFFER_REJECTED_WAGE,
2005-03-19 21:04:08 +01:00
EVENT_TYPE_TRANSFER_OFFER_MONEY,
EVENT_TYPE_TRANSFER_OFFER_ROSTER,
2005-04-07 18:44:33 +02:00
EVENT_TYPE_PLAYER_CAREER_STOP,
2006-06-29 18:06:52 +02:00
EVENT_TYPE_CHARITY,
2005-03-19 21:04:08 +01:00
EVENT_TYPE_END
2005-03-18 23:03:23 +01:00
};
/** A structure representing an event for a user. This is used
to show information like a successful transfer or a job offer. */
typedef struct
{
/** Pointer to the user the event belongs to. */
User *user;
/** Type of the event. See #EventType. */
gint type;
/** Some values that are used for different purposes. */
gint value1, value2;
/** A pointer for different purposes. */
2005-03-19 21:04:08 +01:00
gpointer value_pointer;
2005-03-18 23:03:23 +01:00
/** A string for different purposes. */
2005-10-09 11:35:44 +02:00
gchar *value_string;
2005-03-18 23:03:23 +01:00
} Event;
2005-04-16 09:46:04 +02:00
#endif