1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2024-12-16 10:21:15 +01:00

German news, news improvements.

This commit is contained in:
gyboth 2008-12-18 12:07:59 +00:00
parent 8d84952511
commit 3773475c0e
5 changed files with 101 additions and 23 deletions

View File

@ -40,7 +40,7 @@
/**
* Program version number and year (copyright).
*/
#define VERS "2.3.0"
#define VERS "2.3.1"
#define YEAR "2005 - 2008"
/** Home dir name */

View File

@ -109,6 +109,7 @@ news_select(const GArray *news_array, gchar *title, gchar *subtitle,
gint i;
const NewsArticle *article;
gint order_articles[news_array->len];
gint to_check;
news_articles_get_order(news_array, order_articles);
@ -136,13 +137,31 @@ news_select(const GArray *news_array, gchar *title, gchar *subtitle,
news_titles_get_order(article->titles, order_titles);
news_titles_get_order(article->subtitles, order_subtitles);
*title_id = news_get_title(article->titles, title, order_titles, TRUE, FALSE);
*title_id = news_get_title(article->titles, title, order_titles, TRUE, FALSE,
const_int("int_news_repetition_max_check_number"));
if(*title_id == -1)
*title_id = news_get_title(article->titles, title, order_titles, TRUE, TRUE);
for(to_check = const_int("int_news_repetition_max_check_number") - 1;
to_check >= const_int("int_news_repetition_min_check_number");
to_check--)
{
*title_id = news_get_title(article->titles, title, order_titles, TRUE,
(to_check == const_int("int_news_repetition_min_check_number")), to_check);
if(*title_id == -1)
break;
}
*subtitle_id = news_get_title(article->subtitles, subtitle, order_subtitles, FALSE, FALSE);
*subtitle_id = news_get_title(article->subtitles, subtitle, order_subtitles, FALSE, FALSE,
const_int("int_news_repetition_max_check_number"));
if(*subtitle_id == -1)
*subtitle_id = news_get_title(article->subtitles, subtitle, order_subtitles, FALSE, TRUE);
for(to_check = const_int("int_news_repetition_max_check_number") - 1;
to_check >= const_int("int_news_repetition_min_check_number");
to_check--)
{
*subtitle_id = news_get_title(article->subtitles, subtitle, order_subtitles, FALSE,
(to_check == const_int("int_news_repetition_min_check_number")), to_check);
if(*subtitle_id == -1)
break;
}
return;
}
@ -150,7 +169,7 @@ news_select(const GArray *news_array, gchar *title, gchar *subtitle,
/** Try to find a news article title with valid tokens. */
gint
news_get_title(const GArray *titles, gchar *title, gint *order,
gboolean is_title, gboolean ignore_repetition)
gboolean is_title, gboolean ignore_repetition, gint to_check)
{
#ifdef DEBUG
printf("news_get_title\n");
@ -165,8 +184,8 @@ news_get_title(const GArray *titles, gchar *title, gint *order,
misc_string_replace_all_tokens(token_rep_news, g_array_index(titles, NewsText, order[i]).text, title))
{
result = g_array_index(titles, NewsText, order[i]).id;
if(ignore_repetition || !news_check_title_for_repetition(result, is_title))
return result;
if(ignore_repetition || !news_check_title_for_repetition(result, is_title, to_check))
return result;
else
continue;
}
@ -177,7 +196,7 @@ news_get_title(const GArray *titles, gchar *title, gint *order,
/** Check whether a news article text has occurred in the paper recently. */
gboolean
news_check_title_for_repetition(gint id, gboolean is_title)
news_check_title_for_repetition(gint id, gboolean is_title, gint to_check)
{
#ifdef DEBUG
printf("news_check_title_for_repetition\n");
@ -186,8 +205,8 @@ news_check_title_for_repetition(gint id, gboolean is_title)
gint i;
gint end;
end = (newspaper.articles->len < const_int("int_news_repetition_check_number")) ?
0 : newspaper.articles->len - const_int("int_news_repetition_check_number");
end = (newspaper.articles->len < to_check) ?
0 : newspaper.articles->len - to_check;
for(i = newspaper.articles->len - 1; i >= end; i--)
if((is_title && g_array_index(newspaper.articles, NewsPaperArticle, i).title_id == id) ||
@ -208,8 +227,8 @@ news_check_article_for_repetition(gint id)
gint i;
gint end;
end = (newspaper.articles->len < const_int("int_news_repetition_check_number")) ?
0 : newspaper.articles->len - const_int("int_news_repetition_check_number");
end = (newspaper.articles->len < const_int("int_news_repetition_max_check_number")) ?
0 : newspaper.articles->len - const_int("int_news_repetition_max_check_number");
for(i = newspaper.articles->len - 1; i >= end; i--)
if(g_array_index(newspaper.articles, NewsPaperArticle, i).id == id)
@ -614,7 +633,7 @@ news_set_fixture_tokens(const Fixture *fix)
option_int("string_token_result", &tokens),
g_strdup(buf));
misc_print_grouped_int(fix->attendance, buf);
misc_print_grouped_int(math_round_integer(fix->attendance, 2), buf);
misc_token_add(token_rep_news,
option_int("string_token_attendance", &tokens),
g_strdup(buf));

View File

@ -44,13 +44,13 @@ news_select(const GArray *news_array, gchar *title, gchar *subtitle,
gint
news_get_title(const GArray *titles, gchar *title, gint *order,
gboolean is_title, gboolean ignore_repetition);
gboolean is_title, gboolean ignore_repetition, gint to_check);
gboolean
news_check_article_for_repetition(gint id);
gboolean
news_check_title_for_repetition(gint id, gboolean is_title);
news_check_title_for_repetition(gint id, gboolean is_title, gint to_check);
void
news_load_news_file_from_option(void);

View File

@ -1000,4 +1000,5 @@ int_training_camps_week 2
# how many news articles to check backwards
# to avoid news repetitions
int_news_repetition_check_number 10
int_news_repetition_min_check_number 3
int_news_repetition_max_check_number 10

View File

@ -2,25 +2,83 @@
<news_article>
<type>match</type>
<condition>_LAYERDIFF_ = 0 and _GD_ G 3</condition>
<title>_TL_ chancenlos gegen _TW_</title>
<title condition="_TWN_ = 0">_TL_ ohne Chance bei _TW_</title>
<title>_TL_ völlig chancenlos gegen _TW_</title>
<title>Kantersieg für _TW_</title>
<title>_TL_ unterliegt _TW_ eindeutig</title>
<title>_TW_ beherrscht _TL_ nach Belieben</title>
<title>[Glanzvorstellung|Galavorstellung|Glanzleistung] von _TW_</title>
<title>_TW_ besiegt _TL_ mit [Glanzvorstellung|Galavorstellung|Glanzleistung]</title>
<title>Torreigen bei _T0_ gegen _T1_</title>
<title condition="_TWN_ = 1">_TW_ dominiert auswärts</title>
<subtitle>_TL_ wird durch die gnadenlose Tormaschine von _TW_ zerstört.</subtitle>
<subtitle condition="_TWN_ = 0">_TW_ fertigt _TL_ zuhause _RE_ ab.</subtitle>
<subtitle condition="_TWN_ = 0">_TL_ kommt bei _TW_ unter die Räder.</subtitle>
<subtitle condition="_TWN_ = 1">_TW_ siegt _RE_ im Auswärtsspiel.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1">In einem torreichen Spiel behält _TW_ die Oberhand.</subtitle>
<subtitle condition="_GOALS_TLN__ = 0">_TL_ zeigt sich sowohl in der Offensive als auch in der Defensive hoffnungslos schwach.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1">_TL_ unterliegt in einem Spiel der Offensivabteilungen.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ and _TWN_ = 0">_SCORERS_TWN__ erzielen die Tore beim haushohen Heimsieg.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_TL_ wird durch Tore von _SCORERS_TWN__ regelrecht auseinandergenommen.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_TL_ kommt durch Tore von _SCORERS_TWN__ unter die Räder.</subtitle>
<subtitle condition="_HIGHGOALS_TWN__ > 1">_HIGHSCORER_TWN__ erzielt _HIGHGOALS_TWN__ Tore bei sensationellem Sieg.</subtitle>
<subtitle condition="_HIGHGOALS_TWN__ = 3">_HIGHSCORER_TWN__ erzielt Hattrick in unterhaltsamem Spiel.</subtitle>
<subtitle condition="_HIGHGOALS_TLN__ > 1">_HIGHGOALS_TLN__ Tore von _HIGHSCORER_TLN__ können die Niederlage von _TL_ nicht verhindern.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1 and _MULTIPLESCORERS_TWL__">Tore von _SCORERS_TLN__ sind nicht genug für _TL_ bei der _RE_ Niederlage.</subtitle>
</news_article>
<news_article>
<type>match</type>
<condition>_LAYERDIFF_ = 0 and _GD_ G 2</condition>
<title>_TL_ chancenlos gegen _TW_</title>
<title>Klarer Sieg für _TW_</title>
<title condition="_TWN_ = 0">Klarer Heimsieg für _TW_</title>
<title>_TL_ unterliegt _TW_ [klar|eindeutig]</title>
<title condition="_TWN_ = 0">_TL_ unterliegt auswärts [klar|eindeutig]</title>
<title>_TW_ dominiert _TL_</title>
<title condition="_TWN_ = 1">_TW_ dominiert bei _TL_</title>
<title condition="_TWN_ = 1">_TW_ dominiert auswärts</title>
<title condition="_GOALS_TWL__ > 1">_TW_ siegt trotz _GOALS_TLN__ Gegentoren</title>
<title condition="_GOALS_TWL__ > 1">_GOALS_TWL__ nicht genug für _TL_</title>
<title condition="_TWN_ = 1">_TW_ dominiert bei _TL_</title>
<subtitle>_TW_ beherrscht _TL_ deutlich beim _RE_ Sieg.</subtitle>
<subtitle condition="_TWN_ = 0">_TW_ fertigt _TL_ zuhause _RE_ ab.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1">In einem torreichen Spiel behält _TW_ die Oberhand.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1">_TL_ unterliegt in einem Spiel der Offensivabteilungen.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_SCORERS_TWN__ treffen beim hohen Sieg von _TW_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_SCORERS_TWN__ erzielen die Tore beim überlegenen Heimsieg.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_TL_ wird durch Tore von _SCORERS_TWN__ regelrecht auseinandergenommen.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ and _TWN_ = 0">_SCORERS_TWN__ erzielen die Tore beim ungefährdeten Heimsieg von _TW_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ and _TWN_ = 1">_SCORERS_TWN__ erzielen die Tore beim ungefährdeten Auswärtssieg von _TW_.</subtitle>
<subtitle condition="_HIGHGOALS_TWN__ > 1">_HIGHSCORER_TWN__ erzielt _HIGHGOALS_TWN__ Tore beim überlegenen Sieg.</subtitle>
<subtitle condition="_HIGHGOALS_TWN__ > 1">_HIGHSCORER_TWN__ trifft _HIGHGOALS_TWN__-mal.</subtitle>
<subtitle condition="_HIGHGOALS_TWN__ = 3">_HIGHSCORER_TWN__ erzielt Hattrick in unterhaltsamem Spiel.</subtitle>
<subtitle condition="_HIGHGOALS_TWN__ = 3">Hattrick von _HIGHSCORER_TWN__ lässt _TL_ ohne Chance.</subtitle>
<subtitle condition="_HIGHGOALS_TLN__ > 1">_HIGHGOALS_TLN__ Tore von _HIGHSCORER_TLN__ können die Niederlage von _TL_ nicht verhindern.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1 and _MULTIPLESCORERS_TWL__">Tore von _SCORERS_TLN__ sind nicht genug bei der _RE_ Niederlage.</subtitle>
<subtitle condition="_HIGHGOALS_TLN__ > 1">_HIGHGOALS_TLN__ Tore von _HIGHSCORER_TLN__ können die Niederlage von _TL_ nicht abwenden.</subtitle>
<subtitle condition="_HIGHGOALS_TLN__ > 1">_TL_ verliert trotz _HIGHGOALS_TLN__ Treffer von _HIGHSCORER_TLN__.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1 and _MULTIPLESCORERS_TWL__">Tore von _SCORERS_TLN__ sind nicht genug für _TL_ bei der _RE_ Niederlage.</subtitle>
</news_article>
<news_article>
<type>match</type>
<condition>_LAYERDIFF_ = 0 and _GOALS0_ != _GOALS1_</condition>
<title>_TW_ besiegt _TL_ mit _RE_</title>
<title>_TL_ unterliegt _TW_ _RE_</title>
<title condition="_TWN_ = 0">_TW_ siegt zuhause gegen _TL_</title>
<title condition="_TWN_ = 0">Heimsieg von _TW_</title>
<title condition="_TWN_ = 0">_TW_ zuhause erfolgreich</title>
<title condition="_TWN_ = 1">_TW_ siegt bei _TL_</title>
<title condition="_TWN_ = 1">Auswärtssieg von _TW_</title>
<title condition="_TWN_ = 1">_TW_ auswärts erfolgreich</title>
<title condition="_WON_TWN__ > 3">_WON_TWN__-ter Sieg in Folge für _TW_</title>
<title condition="_LOST_TLN__ > 3">_LOST_TLN__-te Niederlage in Folge für _TL_</title>
<title condition="_UNBEATEN_TWN__ > 3">_TW_ seit _UNBEATEN_TWN__ Spielen ungeschlagen</title>
<subtitle condition="_MULTIPLESCORERS_TWN__">_SCORERS_TWN__ erzielen die Tore gegen _TL_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_SCORERS_TWN__ treffen gegen _TL_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__">_TW_ behält die Oberhand dank Toren von _SCORERS_TWN__.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ and _TWN_ = 1">_SCORERS_TWN__ erzielen die Tore in _TL_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ = 0">_SCORERS_TWN__ sichert Sieg gegen _TL_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ = 0">_SCORERS_TWN__ alleiniger Torschütze gegen _TL_.</subtitle>
<subtitle condition="_MULTIPLESCORERS_TWN__ = 0">_SCORERS_TWN__ besiegt _TL_ im Alleingang.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1">_GOALS_TLN__ Treffer reichen nicht zum Sieg für _TL_.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1 and _MULTIPLESCORERS_TWN__">_TW_ siegt dank Toren von _SCORERS_TWN__ in unterhaltsamem Spiel.</subtitle>
<subtitle condition="_GOALS_TLN__ > 1">_TL_ unterliegt in torreichem Spiel gegen _TW_.</subtitle>
</news_article>
</news>