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)
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.
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.