Commit Graph

88 Commits

Author SHA1 Message Date
Tom Stellard 25d9880da4 Generate a 'pre-history' for cups
We know generate cup results for each cup before starting the game.
This allows cups to select last year's winner without having to
special case cup selection for the first season.
2021-07-27 14:41:40 -04:00
Tom Stellard 3e4ead3aae Reset all cups at the beginning of each season
This fixes a bug in league fixture scheduling where league matches would
be scheduled around cup matches from the previous season.  This caused
league matches to be scheduled in later week rounds which in some cases
caused these matches to not be played.
2021-07-27 14:41:40 -04:00
Tom Stellard 801cb99b74 Remove team_id member from TableElement
This is no longer needed now that Team pointers always point to the same
team.
2021-07-27 14:41:40 -04:00
Tom Stellard 47b6d5c80d Use a GPtrArray to store teams in leagues
This allows us to have stable Team pointers throughout the game,
so we don't need to recompute pointers from Team IDs every time
the league order changes.
2021-07-27 14:41:40 -04:00
Tom Stellard 19d361fb82 Refactor league_season_start() 2021-07-27 14:41:40 -04:00
Tom Stellard 8a3100a28c Add support for specifying cups in choose_team_sid tag for generated teams
This makes it possible to include national cup winners in international
cups.
2021-03-05 23:38:28 -05:00
Tom Stellard 347d74a3c4 Load all league and team names at the beginning of the game
This way we don't have to reload the country xml definitions every time
we have to generate a new team.
2021-03-05 23:38:28 -05:00
Tom Stellard 4248c08b7a Allow the user's country's league sids in choose_team tags
This allows for consistent and accurate international cup definitions,
because the draws will be the same no matter what the country a user
has choosen.

So now if a user is playing Faroe Islands, for example, a choose_team with an
sid of faroe_islands1, will select a team from the Faroe Islands.
Previously, this sid would have been ignored and the only way for a
user team to play in an international cup was if it used the special
LEAGUE* or CUP* sid.

As a result of this change, the 'generate' property of CupChooseTeam is
now infered based on the sid, so the generated tag no longer has an
effect in the definition files.
2021-03-05 23:38:28 -05:00
Tom Stellard 80f57abba9 Fix build with glib < 2.62 2020-12-24 10:43:39 -08:00
Tom Stellard aca4039893 Fix reserve team promotion rules when using promotion games 2020-12-24 10:43:39 -08:00
Tom Stellard eb15df7cd9 Allow using rank_start and rank_end tags for prom_games
This adds the same functionality already supported by the prom_rel
tags to support reserve team promotion rules for promotion games.
This allows you to specify a larger range of teams to promte than
the number of teams defined with the number_of_teams tag, so that
if a team is ineligible for promotion than other teams can be
substituted.  For example, if you wanted to promote at most 2
of the top 3 teams, you could do:

<prom_games>
  <prom_games_number_of_advance>2</prom_games_number_of_advance>
  <rank_start>1</rank_start>
  <rank_end>3</rank_end>
</prom_games>

Note that the rank_start and rank_end tags are not supported when using
the prom_games_loser_sid tag.
2020-12-24 10:43:39 -08:00
Tom Stellard 996bccc739 Implement promotion and relegation rules for reserve teams
This adds some new rules for promoting and relegating reserve
teams:

+ Reserve teams will not be promoted into a league that contains its
  first team or a higher-level reserve team.
+ If a first team or higher-level reserve team is relegated to a league
  with a lower reserve team, then that reserve team will also be relegated.

In order to enable these rules, you must add the
<reserve_promotion_rules>default</reserve_promotion_rules> tag to your
contry xml file, and also define reserve teams in your league/team_defs
file using the <first_team> and <reserve_level> tags.
2020-12-24 10:43:39 -08:00
Tom Stellard f928273875 Add first_team and reserve_level tags to team element
The first_team tag can be used to indicate that a team is a 'reserve
team'.  The value for this new tag is the name of the first team
for this reserve team.  The reserve_level is used to indicate if this
is the 2nd, 3rd, 4th, etc. team for the first team. For example:

<team>
  <team_name>Blue</team_name>
</team>
<team>
  <team_name>Blue 2</team_name>
  <first_team>Blue</first_team>
  <reserve_level>2</reserve_level>
</team>
<team>
  <team_name>Blue 3</team_name>
  <first_team>Blue</first_team>
  <reserve_level>3</reserve_level>
</team>
2020-12-24 10:43:39 -08:00
Tom Stellard 8bca18d8a2 Add number_of_teams tag to prom_rel_element
This tag is intended to be used for leagues that may have some teams in
the league that are ineligible for promotions (e.g. reserve teams).
Often these leagues will promote 2 of the top 3 teams or something
similar, so if one team is ineligible, the league would still be able
to promote 2 teams.  Below is an example of how to model this scenario
with the new tag:

<prom_rel_element>
  <rank_start>1</rank_start>
  <rank_end>3</rank_end>
  <number_of_teams>2</number_of_teams>
</prom_rel_element>
2020-12-24 10:43:39 -08:00
gunnar_g cad59262ce Fix for tracker id 2942033: Spectator Bugs in Multiplayer-Games
Patch by rookie86
2010-01-29 07:38:11 +00:00
gyboth 078b70a1ea Added debug logging. 2009-04-29 17:18:54 +00:00
gyboth dd7c288da9 Added won/lost/drawn display in match preview. 2009-02-21 16:43:53 +00:00
gyboth a04940877b European cups. 2009-01-08 22:20:26 +00:00
gyboth 7324c289cc Fixture scheduling bugfix. 2008-12-28 10:24:54 +00:00
gyboth a76cae2a44 Week breaks introduced. 2008-12-26 15:59:46 +00:00
gyboth c3f2c238b8 Def improvements, Italian definition corrected. 2008-12-23 10:33:55 +00:00
gyboth fed258a749 Added custom round robin breaks to leagues and cups. 2008-12-14 10:37:10 +00:00
gyboth 64d556f3c1 Corrected pointer warnings. 2008-12-07 11:28:18 +00:00
gyboth 23cfbb3f0c Added function name output when compiled with DEBUG. 2008-11-25 13:50:07 +00:00
gyboth 945c4d1093 Added league properties and changed league active status to property. 2008-11-24 11:16:36 +00:00
gyboth c48a361342 Adjusted table highlight colours for multiple tables. 2008-11-23 11:48:36 +00:00
gyboth b9415b186e Multiple tables for leagues feature completed. 2008-11-22 16:51:31 +00:00
gyboth a535439936 Added multiple tables for leagues. 2008-11-21 17:00:47 +00:00
gyboth 73d4cc6795 Added joined leagues to defs system (e.g. for US conferences). 2008-11-20 20:20:18 +00:00
gyboth fc80db9dcb Added two match weeks for cup rounds. 2007-02-18 13:04:19 +00:00
gyboth 819358f291 Added two match weeks for leagues. 2007-02-17 12:06:30 +00:00
gyboth fdb268e001 "Added luck." 2006-12-10 14:43:16 +00:00
gyboth 8b539e28fe "Def system improvements." 2006-06-30 13:24:50 +00:00
gyboth 5de905d993 Season end team change improvement. 2006-05-25 19:54:01 +00:00
gyboth 94cd6f351a "Minor bugfixes." 2006-01-10 21:26:51 +00:00
gyboth e9abbc09c1 "Crash fixed." 2006-01-07 20:01:03 +00:00
gyboth 9cabaa9eb3 "Release 1.9.3" 2005-12-14 14:05:59 +00:00
gyboth d0c65d0bb3 Greece added, Brazil changed. 2005-12-04 16:41:25 +00:00
gyboth 15ad0cbb01 "Job exchange, first buggy draft with lots of debugging output." 2005-12-01 11:50:54 +00:00
gyboth 6f61b20f96 "Minor bugfix in query_cup_begins." 2005-11-26 16:52:51 +00:00
gyboth 54132543c4 "Betting bugfix." 2005-10-31 16:19:14 +00:00
gyboth 3b23bb353f "CPU strategies, first draft." 2005-10-24 20:50:48 +00:00
gyboth fa0b06f39d "Randomise teams option added." 2005-10-20 15:45:00 +00:00
gyboth 53131dd2e9 "Switched most GStrings to gchar." 2005-10-09 09:35:44 +00:00
gyboth 6c959586c7 "Minor string array improvements." 2005-10-05 19:59:37 +00:00
gyboth 0df6829fe0 "Minor bugfixes." 2005-10-01 08:12:06 +00:00
gyboth dc3b8bdc03 "Minor corrections." 2005-09-28 10:21:43 +00:00
gyboth 00ba7127c9 "Supernational league changes" 2005-09-19 21:13:36 +00:00
gyboth 08d169daf3 "Player skill system changed." 2005-09-14 21:16:22 +00:00
gyboth e436801289 Prom_rel improvements. 2005-08-15 13:18:28 +00:00