bygfoot/src/live_game_struct.h

241 lines
7.5 KiB
C
Raw Normal View History

2005-10-20 17:45:00 +02:00
/*
2005-11-26 17:52:51 +01:00
live_game_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.
*/
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. Some of these events should always
be ordered in blocks as they can occur. For example LIVE_GAME_EVENT_POST
until LIVE_GAME_EVENT_CROSS_BAR is a group of actions that can all occur
in a scoring chance. We pick one of these randomly in this case.
2005-01-09 21:21:22 +01:00
@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. */
2005-08-27 18:17:50 +02:00
LIVE_GAME_EVENT_GENERAL = 0, /* 0 */
LIVE_GAME_EVENT_START_MATCH, /* 1 */
LIVE_GAME_EVENT_HALF_TIME, /* 2 */
LIVE_GAME_EVENT_EXTRA_TIME, /* 3 */
LIVE_GAME_EVENT_END_MATCH, /* 4 */
LIVE_GAME_EVENT_LOST_POSSESSION, /* 5 */
LIVE_GAME_EVENT_SCORING_CHANCE, /* 6 */
LIVE_GAME_EVENT_HEADER, /* 7 */
LIVE_GAME_EVENT_PENALTY, /* 8 */
LIVE_GAME_EVENT_FREE_KICK, /* 9 */
LIVE_GAME_EVENT_GOAL, /* 10 */
LIVE_GAME_EVENT_OWN_GOAL, /* 11 */
/* Start missed scoring chance block */
2005-08-27 18:17:50 +02:00
LIVE_GAME_EVENT_POST, /* 12 */
LIVE_GAME_EVENT_MISS, /* 13 */
LIVE_GAME_EVENT_SAVE, /* 14 */
LIVE_GAME_EVENT_KEEPER_PUSHED_IN_CORNER, /* 15 */
LIVE_GAME_EVENT_CROSS_BAR, /* 16 */
LIVE_GAME_EVENT_PLAYER_PUSHED_IN_CORNER, /* 17 */
/* End missed scoring chance block */
LIVE_GAME_EVENT_CORNER_KICK, /* 18 */
LIVE_GAME_EVENT_FOUL, /* 19 */
LIVE_GAME_EVENT_FOUL_YELLOW, /* 20 */
LIVE_GAME_EVENT_FOUL_RED, /* 21 */
LIVE_GAME_EVENT_FOUL_RED_INJURY, /* 22 */
LIVE_GAME_EVENT_SEND_OFF, /* 23 */
LIVE_GAME_EVENT_INJURY, /* 24 */
2005-01-09 21:21:22 +01:00
/** An injury that permits the player to
continue after some brief time. */
LIVE_GAME_EVENT_TEMP_INJURY, /* 25 */
LIVE_GAME_EVENT_PENALTIES, /* 26 */
LIVE_GAME_EVENT_STADIUM, /* 27 */
LIVE_GAME_EVENT_STADIUM_BREAKDOWN, /* 28 */
LIVE_GAME_EVENT_STADIUM_RIOTS, /* 29 */
LIVE_GAME_EVENT_STADIUM_FIRE, /* 30 */
LIVE_GAME_EVENT_SUBSTITUTION, /* 31 */
LIVE_GAME_EVENT_STRUCTURE_CHANGE, /* 32 */
LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_DEFEND, /* 33 */
LIVE_GAME_EVENT_STYLE_CHANGE_DEFEND, /* 34 */
LIVE_GAME_EVENT_STYLE_CHANGE_BALANCED, /* 35 */
LIVE_GAME_EVENT_STYLE_CHANGE_ATTACK, /* 36 */
LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_ATTACK, /* 37 */
LIVE_GAME_EVENT_BOOST_CHANGE_ANTI, /* 38 */
LIVE_GAME_EVENT_BOOST_CHANGE_OFF, /* 39 */
LIVE_GAME_EVENT_BOOST_CHANGE_ON, /* 40 */
LIVE_GAME_EVENT_END /* 41 */
2005-01-09 21:21:22 +01:00
};
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
{
2008-12-01 21:39:16 +01:00
LIVE_GAME_STAT_ARRAY_SCORERS_FOR_DISPLAY = 0,
LIVE_GAME_STAT_ARRAY_SCORERS,
2005-03-10 21:59:39 +01:00
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
{
2005-09-19 23:13:36 +02:00
GAME_TEAM_VALUE_GOALIE = 0,
GAME_TEAM_VALUE_DEFEND,
2005-03-21 11:16:37 +01:00
GAME_TEAM_VALUE_MIDFIELD,
GAME_TEAM_VALUE_ATTACK,
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. */
2005-10-09 11:35:44 +02:00
gchar *commentary;
2005-07-05 20:37:26 +02:00
/** Id of the commentary. */
gint commentary_id;
2005-01-09 21:21:22 +01:00
} 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;
/** 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-08-17 22:39:07 +02:00
/** The names of the teams stored for later use (when the fixture
already got freed). */
2005-10-09 11:35:44 +02:00
gchar *team_names[2];
/** Attendance stored for later use (when the fixture
already got freed). */
gint attendance;
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;
/** 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-10-27 23:10:15 +02:00
/** Ids of strategy actions applied.
Actions only get applied once. */
GArray *action_ids[2];
2005-01-09 21:21:22 +01:00
} LiveGame;
#endif