We need to handle the case when the 2nd place slovenia1 team qualifies
for the champions league and the 3rd (or even 4th if the 3rd also
qualifies) place team needs to take its spot in uefa_el.
This way strategy_live_game_check() only needs to evaluate the condition
and does not need to reparse it over and over again.
This reduces the number of instructions reported by
./test/benchmark.sh --benchmark by ~35%.
team_get_fixture() is expensive and we can avoid this call in the
majority of cases.
This reduces the number of instructions reported by
./test/benchmark.sh --benchmark by ~40%.
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.
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.
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.
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.
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)