2005-01-09 21:21:22 +01:00
|
|
|
#ifndef LIVE_GAME_STRUCT_H
|
|
|
|
#define LIVE_GAME_STRUCT_H
|
|
|
|
|
|
|
|
#include "bygfoot.h"
|
2005-03-21 11:16:37 +01:00
|
|
|
#include "fixture_struct.h"
|
2005-01-09 21:21:22 +01:00
|
|
|
|
|
|
|
/** Events happening during a live game.
|
|
|
|
@see #LiveGameEvent
|
|
|
|
@see #LiveGameUnit */
|
|
|
|
enum LiveGameEventType
|
|
|
|
{
|
|
|
|
/** This is the 'main' event, nothing in
|
|
|
|
particular is happening; one of the teams
|
|
|
|
is in possession of the ball. */
|
|
|
|
LIVE_GAME_EVENT_GENERAL = 0,
|
|
|
|
LIVE_GAME_EVENT_START_MATCH,
|
|
|
|
LIVE_GAME_EVENT_HALF_TIME,
|
|
|
|
LIVE_GAME_EVENT_EXTRA_TIME,
|
|
|
|
LIVE_GAME_EVENT_END_MATCH,
|
|
|
|
LIVE_GAME_EVENT_LOST_POSSESSION,
|
|
|
|
LIVE_GAME_EVENT_SCORING_CHANCE,
|
2005-05-09 16:00:43 +02:00
|
|
|
LIVE_GAME_EVENT_HEADER,
|
2005-01-09 21:21:22 +01:00
|
|
|
LIVE_GAME_EVENT_PENALTY,
|
|
|
|
LIVE_GAME_EVENT_FREE_KICK,
|
|
|
|
LIVE_GAME_EVENT_GOAL,
|
|
|
|
LIVE_GAME_EVENT_OWN_GOAL,
|
|
|
|
LIVE_GAME_EVENT_POST,
|
|
|
|
LIVE_GAME_EVENT_MISSED,
|
|
|
|
LIVE_GAME_EVENT_SAVE,
|
|
|
|
LIVE_GAME_EVENT_CROSS_BAR,
|
|
|
|
LIVE_GAME_EVENT_FOUL,
|
|
|
|
LIVE_GAME_EVENT_FOUL_YELLOW,
|
|
|
|
LIVE_GAME_EVENT_FOUL_RED,
|
|
|
|
LIVE_GAME_EVENT_FOUL_RED_INJURY,
|
|
|
|
LIVE_GAME_EVENT_SEND_OFF,
|
|
|
|
LIVE_GAME_EVENT_INJURY,
|
|
|
|
/** An injury that permits the player to
|
|
|
|
continue after some brief time. */
|
|
|
|
LIVE_GAME_EVENT_TEMP_INJURY,
|
|
|
|
LIVE_GAME_EVENT_PENALTIES,
|
|
|
|
LIVE_GAME_EVENT_STADIUM,
|
|
|
|
LIVE_GAME_EVENT_STADIUM_BREAKDOWN,
|
|
|
|
LIVE_GAME_EVENT_STADIUM_RIOTS,
|
2005-03-16 21:48:25 +01:00
|
|
|
LIVE_GAME_EVENT_STADIUM_FIRE,
|
2005-01-09 21:21:22 +01:00
|
|
|
LIVE_GAME_EVENT_SUBSTITUTION,
|
|
|
|
LIVE_GAME_EVENT_STRUCTURE_CHANGE,
|
2005-03-10 21:59:39 +01:00
|
|
|
LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_DEFEND,
|
|
|
|
LIVE_GAME_EVENT_STYLE_CHANGE_DEFEND,
|
|
|
|
LIVE_GAME_EVENT_STYLE_CHANGE_BALANCED,
|
|
|
|
LIVE_GAME_EVENT_STYLE_CHANGE_ATTACK,
|
|
|
|
LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_ATTACK,
|
|
|
|
LIVE_GAME_EVENT_BOOST_CHANGE_ANTI,
|
|
|
|
LIVE_GAME_EVENT_BOOST_CHANGE_OFF,
|
|
|
|
LIVE_GAME_EVENT_BOOST_CHANGE_ON,
|
2005-01-09 21:21:22 +01:00
|
|
|
LIVE_GAME_EVENT_END
|
|
|
|
};
|
|
|
|
|
2005-03-21 11:16:37 +01:00
|
|
|
enum LiveGameUnitArea
|
|
|
|
{
|
|
|
|
LIVE_GAME_UNIT_AREA_DEFEND = 0,
|
|
|
|
LIVE_GAME_UNIT_AREA_MIDFIELD,
|
|
|
|
LIVE_GAME_UNIT_AREA_ATTACK,
|
|
|
|
LIVE_GAME_UNIT_AREA_END
|
|
|
|
};
|
|
|
|
|
2005-01-09 21:21:22 +01:00
|
|
|
/** Indices for the time variable of th
|
|
|
|
#LiveGameUnit struct. */
|
|
|
|
enum LiveGameUnitTime
|
|
|
|
{
|
|
|
|
LIVE_GAME_UNIT_TIME_FIRST_HALF = 0,
|
|
|
|
LIVE_GAME_UNIT_TIME_SECOND_HALF,
|
|
|
|
LIVE_GAME_UNIT_TIME_EXTRA_TIME,
|
|
|
|
LIVE_GAME_UNIT_TIME_PENALTIES,
|
|
|
|
LIVE_GAME_UNIT_TIME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Indices for the values in #LiveGameStats. */
|
|
|
|
enum LiveGameStatValue
|
|
|
|
{
|
2005-03-10 21:59:39 +01:00
|
|
|
LIVE_GAME_STAT_VALUE_GOALS_REGULAR = 0,
|
2005-01-09 21:21:22 +01:00
|
|
|
LIVE_GAME_STAT_VALUE_SHOTS,
|
2005-03-10 21:59:39 +01:00
|
|
|
LIVE_GAME_STAT_VALUE_SHOT_PERCENTAGE,
|
2005-01-09 21:21:22 +01:00
|
|
|
LIVE_GAME_STAT_VALUE_POSSESSION,
|
|
|
|
LIVE_GAME_STAT_VALUE_PENALTIES,
|
|
|
|
LIVE_GAME_STAT_VALUE_FOULS,
|
|
|
|
LIVE_GAME_STAT_VALUE_CARDS,
|
|
|
|
LIVE_GAME_STAT_VALUE_REDS,
|
|
|
|
LIVE_GAME_STAT_VALUE_INJURIES,
|
|
|
|
LIVE_GAME_STAT_VALUE_END
|
|
|
|
};
|
|
|
|
|
2005-03-10 21:59:39 +01:00
|
|
|
enum LiveGameStatArray
|
|
|
|
{
|
|
|
|
LIVE_GAME_STAT_ARRAY_SCORERS = 0,
|
|
|
|
LIVE_GAME_STAT_ARRAY_YELLOWS,
|
2005-03-11 18:18:51 +01:00
|
|
|
LIVE_GAME_STAT_ARRAY_REDS,
|
2005-03-10 21:59:39 +01:00
|
|
|
LIVE_GAME_STAT_ARRAY_INJURED,
|
|
|
|
LIVE_GAME_STAT_ARRAY_END
|
|
|
|
};
|
|
|
|
|
2005-03-21 11:16:37 +01:00
|
|
|
/** 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
|
|
|
|
};
|
|
|
|
|
2005-01-09 21:21:22 +01:00
|
|
|
/** Some stats for a live game like ball possession,
|
|
|
|
shots on goal etc. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gfloat possession;
|
|
|
|
gint values[2][LIVE_GAME_STAT_VALUE_END];
|
2005-03-11 13:17:48 +01:00
|
|
|
GPtrArray *players[2][LIVE_GAME_STAT_ARRAY_END];
|
2005-01-09 21:21:22 +01:00
|
|
|
} LiveGameStats;
|
|
|
|
|
|
|
|
/** A struct telling us what's happening at
|
|
|
|
a certain moment in a game. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** @see #LiveGameEventType */
|
|
|
|
gint type;
|
2005-05-19 10:31:47 +02:00
|
|
|
/** Verbosity value. The lower the more important
|
|
|
|
the event. */
|
|
|
|
gint verbosity;
|
2005-05-19 20:13:14 +02:00
|
|
|
/** Information about a team and two players
|
|
|
|
involved in the event. */
|
|
|
|
gint team, player, player2;
|
2005-01-09 21:21:22 +01:00
|
|
|
/** The commentary for the event. */
|
|
|
|
GString *commentary;
|
|
|
|
|
|
|
|
} LiveGameEvent;
|
|
|
|
|
|
|
|
/** A struct representing a fraction of a live game. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** Tells us which of the teams is in possession
|
2005-01-24 19:01:55 +01:00
|
|
|
of the ball. */
|
|
|
|
gint possession;
|
|
|
|
/** The area of the pitch the ball is currently in. */
|
|
|
|
gint area;
|
2005-01-09 21:21:22 +01:00
|
|
|
/** Which minute of the game and which part of
|
|
|
|
the game. If 'minute' is -1 we have an event
|
|
|
|
like a substitution that doesn't count as a
|
|
|
|
match time consuming event. @see #GameUnitTime */
|
|
|
|
gint minute, time;
|
2005-03-03 13:46:48 +01:00
|
|
|
|
|
|
|
/** The match result at the time of this unit. */
|
|
|
|
gint result[2];
|
2005-01-09 21:21:22 +01:00
|
|
|
|
|
|
|
/** The event belonging to the game unit. */
|
|
|
|
LiveGameEvent event;
|
|
|
|
|
|
|
|
} LiveGameUnit;
|
|
|
|
|
2005-03-08 09:25:46 +01:00
|
|
|
/** A structure storing team settings during a live game
|
|
|
|
pause (so that we know what users have changed in pauses. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint structure, style;
|
|
|
|
gboolean boost;
|
|
|
|
gint player_ids[11];
|
|
|
|
|
|
|
|
} LiveGameTeamState;
|
|
|
|
|
2005-01-09 21:21:22 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** The fixture that belongs to the game. */
|
|
|
|
Fixture *fix;
|
2005-05-31 16:42:20 +02:00
|
|
|
/** Integer determining the fixture (needed because fixture pointers
|
2005-04-09 21:18:28 +02:00
|
|
|
can change when new fixtures are added to the fixtures array). */
|
2005-05-31 16:42:20 +02:00
|
|
|
gint fix_id;
|
2005-01-09 21:21:22 +01:00
|
|
|
/** Substitutions left for the teams. */
|
|
|
|
gint subs_left[2];
|
|
|
|
/** The team that started the game, 0 or 1. */
|
|
|
|
gint started_game;
|
|
|
|
/** We keep track of the stadium events because
|
|
|
|
there shouldn't be more than one of them in a game. */
|
2005-03-19 21:04:08 +01:00
|
|
|
gint stadium_event;
|
2005-01-09 21:21:22 +01:00
|
|
|
/** Attacking, defending etc. values for both teams.
|
|
|
|
@see #GameTeamValue */
|
|
|
|
gfloat team_values[2][GAME_TEAM_VALUE_END];
|
|
|
|
/** The home advantage factor. */
|
|
|
|
gfloat home_advantage;
|
|
|
|
/** The array of units. @see #GameUnit */
|
2005-03-11 13:17:48 +01:00
|
|
|
GArray *units;
|
2005-03-03 13:46:48 +01:00
|
|
|
/** Match statistics. @see #LiveGameStats */
|
2005-01-09 21:21:22 +01:00
|
|
|
LiveGameStats stats;
|
2005-03-08 09:25:46 +01:00
|
|
|
LiveGameTeamState team_state[2];
|
2005-01-09 21:21:22 +01:00
|
|
|
} LiveGame;
|
|
|
|
|
|
|
|
#endif
|