Commit Graph

1670 Commits

Author SHA1 Message Date
Tom Stellard a643330f52 workflows: Run some simple tests 2021-03-05 16:22:09 -08:00
Tom Stellard fee600aa24 workflows: Fix Windows build 2021-03-05 16:10:51 -08:00
Tom Stellard fc972fd39f CMake: Copy support files into build directory
This makes it possible to run bygfoot from the build directory.
2021-03-05 16:06:42 -08:00
Tom Stellard 9b2c330170 Import all Europe definitions from forums
This includes all teams and also the uefa cup definitions.  All team
names have been replaced with bygfoot friendly names.
2021-03-05 16:06:42 -08:00
Tom Stellard dd29414608 Fix bug in query_cup_begins()
The function incorrectly assumed that cups where all the scheduled games
had been played wre complete, and did not take into account the fact
that games for later rounds may not have been scheduled yet.
2021-03-05 16:06:42 -08:00
Tom Stellard 07ce54cf32 Avoid infinite loop in job_pick_team_from_country()
This function was looping forever if all the national teams were added
to the job list.
2021-03-05 16:06:42 -08:00
Tom Stellard a1b1490afa Add optional tag 2021-03-05 16:06:42 -08:00
Tom Stellard 9e6cd2e8d7 Add cup sid to debug printfs 2021-03-05 16:06:42 -08:00
Tom Stellard 9e222697cf Iterate over cup rounds in reverse order when selecting teams
Some cups allow teams to qualify in multiple ways and we want to
always select teams into the highest round possible.
2021-03-05 16:06:42 -08:00
Tom Stellard 3d2e874dd4 Add alternatives tag to choose_team
This allows you to specify an alternative choose_team in the case the
first choose_team does not match any teams.  This can happen if a team
qualifies for another cup in the same cup group.  You may list an
unlimited number of alternatives with this new tag.  Here is an example of
how to use it:

<choose_team>
  <choose_team_sid>faroe_islands_cup</choose_team_sid>
  <number_of_teams>1</number_of_teams>
  <start_idx>1</start_idx>
  <end_idx>1</end_idx>
  <alternatives>
    <choose_team>
      <choose_team_sid>faroe_islands1</choose_team_sid>
      <number_of_teams>1</number_of_teams>
      <start_idx>1</start_idx>
      <end_idx>1</end_idx>
    </choose_team>
  </alternatives>
</choose_team>

This example chooses the winner of the faroe_islands_cup, but if that
team is not eligible for the cup, then it will choose the winner of the
faroe_islands1 league.
2021-03-05 16:06:42 -08:00
Tom Stellard 87944395a2 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 16:06:42 -08:00
Tom Stellard c1648270d1 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 16:06:42 -08:00
Tom Stellard 8f18bb3741 Refactor cup_reset() 2021-03-05 16:06:42 -08:00
Tom Stellard 40731b9a4a Refactor cup_load_choose_team_generate() 2021-03-05 16:06:42 -08:00
Tom Stellard 29484a860a 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 16:06:42 -08:00
Tom Stellard c710e6b6ce Refactor cup_get_team_pointers() 2021-03-05 16:06:42 -08:00
Tom Stellard 0524050959 Add json interface
This adds an initial version of a json interface to bygfoot.  This
is still in development so the interface may change in the future.  This
interface can be used for writing tests or for communication between a
client and server.

To use the interface, you can pass a json file with commands to bygfoot
using the --json option.
2021-03-05 16:06:42 -08:00
Tom Stellard 3097ed92bc Move country file validation out of main_init()
We only need to do this validation on program startup and main_init()
may be called multiple times (e.g. if someone starts multiple new games
without exiting)
2021-03-01 20:44:27 -08:00
Tom Stellard bb835e7fb5 Add Bygfoot* parameter to start_week* functions
In the future, this structure will hold the bygfoot global state.
2021-03-01 20:41:23 -08:00
Tom Stellard c6bf95c2cc Only add pixmap directories when using gtk2
add_pixmap_directory() assumes an X display is available.
2021-03-01 20:40:20 -08:00
Tom Stellard 1fb9f1dfae Use a callback for reporting progress of simulating games
This removes the gtk2 dependency from end_week_round_results() so it can
be potentially used with other frontends.
2021-03-01 10:56:24 -08:00
Tom Stellard e4fd1fef81 Factor some of the code for starting a game out of the UI 2021-03-01 10:26:07 -08:00
Tom Stellard df7b1e42ca Move some GUI related code out of start_end.c and into callback_func.c
This helps separate the core logic from the user interface.
2021-03-01 09:21:55 -08:00
Tom Stellard e87e420e53 Factor user creation code out from the gtk callbacks
Also introduce a new Bygfoot struct for holding all the global data.
This will eventually replace all the global variables in bygfoot, but
for now it is an empty struct that we are just passing it through to
functions that access global variables.
2021-03-01 09:21:51 -08:00
Tom Stellard f7271c40c2 Remove unused function find_pixmap_file() 2021-03-01 08:13:36 -08:00
Tom Stellard 7cb1258e3a Don't try to open the display when parsing command line arguments
I'm not sure why this was done in the first place, but it doesn't seem
to be necessary.  This change will make it easier to add alternative
user interfaces.
2021-03-01 08:13:28 -08:00
Tom Stellard 03b2d486be Remove unnecessary call to user_event_show_next()
This code path was only hit when query_user_events() returned false,
and user_vent_show_next() returns early and does nothing when this is
false.
2021-03-01 08:13:22 -08:00
Tom Stellard b01600b8b4 Remove reference to deleted picture 2021-03-01 08:11:31 -08:00
Tom Stellard a307d5d12f Faroe Islands: Move Super Cup to week 1
This is when it is actually played.
2021-03-01 08:11:11 -08:00
Tom Stellard af649489d8 Reformat CMakeLists.txt 2021-03-01 08:10:26 -08:00
Tom Stellard 671f311762 CMake: Generate a WinMain entrypoint on Windows 2020-12-24 10:43:39 -08:00
Tom Stellard 46a552f631 Update ChangeLog 2020-12-24 10:43:39 -08:00
Tom Stellard 8080a61bb6 Add action for building Windows package 2020-12-24 10:43:39 -08:00
Tom Stellard 1f6236e8f4 package-linux.sh: Package bygfoot the same way as previous versions 2020-12-24 10:43:39 -08:00
Tom Stellard 3aa903e07d CMake: Generate the translatons 2020-12-24 10:43:39 -08:00
Tom Stellard 734219fdfe Initial support for building binaires on push to github 2020-12-24 10:43:39 -08:00
Tom Stellard 80f57abba9 Fix build with glib < 2.62 2020-12-24 10:43:39 -08:00
Tom Stellard 3ca25bc3df Make VERS macro overrideable on the command line
This will allow custom version strings when building.
2020-12-24 10:43:39 -08:00
Tom Stellard 7abc20fd47 Update Faroe Islands schedule to match the real schedule 2020-12-24 10:43:39 -08:00
Tom Stellard 8421f3e8ba Update Faroe Islands definitions to include 3 divisions in 3. Delid
This is implemented using two sets of cups, one for the first half
of the year and one for the second half.

Also, fix a few mistakes in the team list.
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 a5363a98f5 league_argentina4b.xml: Fix xml tag 2020-12-24 10:43:39 -08:00
Tom Stellard e0401366f1 Update faroe islands with new tags for reserve teams
Also, fixup the cups and number of rounds for some leagues.
2020-12-24 10:43:39 -08:00
Tom Stellard 6061cd0938 cups: Fix a bug in cups with only 2 teams playing in the first round
A cup in wich all teams get byes except for two in the first round
would not have any additional rounds added, because the teams with
byes were not being counted in the total number of teams remaining.
2020-12-24 10:43:39 -08:00
Tom Stellard 9d2440be85 Exclude reserve teams from cups by default
If you need to define a cup that includes reserve teams, you can add the
include_reserve_teams property to the cup definition.
2020-12-24 10:43:39 -08:00
Tom Stellard 344bc82b53 Simplify some duplicated code in cup_load_choose_team_from_league() 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