1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-01-31 07:54:50 +01:00

"Team definition system."

This commit is contained in:
gyboth 2005-06-21 13:33:16 +00:00
parent 1fe28d24ee
commit ce6564ef47
25 changed files with 1204 additions and 463 deletions

File diff suppressed because one or more lines are too long

View File

@ -100,7 +100,7 @@
<child>
<widget class="GtkHSeparator" id="hseparator10">
<property name="width_request">1</property>
<property name="height_request">10</property>
<property name="height_request">5</property>
<property name="visible">True</property>
</widget>
<packing>
@ -159,7 +159,7 @@
<child>
<widget class="GtkHSeparator" id="hseparator11">
<property name="width_request">1</property>
<property name="height_request">10</property>
<property name="height_request">5</property>
<property name="visible">True</property>
</widget>
<packing>
@ -204,7 +204,7 @@
<child>
<widget class="GtkHSeparator" id="hseparator12">
<property name="width_request">1</property>
<property name="height_request">10</property>
<property name="height_request">5</property>
<property name="visible">True</property>
</widget>
<packing>
@ -357,6 +357,94 @@
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox74">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkRadioButton" id="radiobutton_team_def_load">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Load teams from definition files (note that the official Bygfoot package doesn't contain team definition files, you have to get them from the homepage or via the bygfoot-update script)</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Load team definitions</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_team_def_names">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Load only the player names in the definition files</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Only names</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_team_def_load</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_team_def_dont">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Don't load team definitions at all</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Don't load definitions</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_team_def_load</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator16">
<property name="width_request">1</property>
<property name="height_request">5</property>
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
@ -539,87 +627,87 @@
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_startup_resume">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Load the last game that was saved or loaded.</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button_startup_resume_clicked" last_modification_time="Wed, 06 Apr 2005 10:52:45 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment21">
<widget class="GtkButton" id="button_startup_resume">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<property name="tooltip" translatable="yes">Load the last game that was saved or loaded.</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button_startup_resume_clicked" last_modification_time="Wed, 06 Apr 2005 10:52:45 GMT"/>
<child>
<widget class="GtkHBox" id="hbox70">
<widget class="GtkAlignment" id="alignment21">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkImage" id="image61">
<widget class="GtkHBox" id="hbox70">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkLabel" id="label114">
<property name="visible">True</property>
<property name="label" translatable="yes">_Resume last game</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<child>
<widget class="GtkImage" id="image61">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label114">
<property name="visible">True</property>
<property name="label" translatable="yes">_Resume last game</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
@ -1298,6 +1386,27 @@
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label_stadium_name">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
@ -2122,7 +2231,7 @@
<widget class="GtkWindow" id="window_sponsors">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">True</property>

File diff suppressed because it is too large Load Diff

251
po/de.po
View File

@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: bygfoot 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-06-20 14:42+0200\n"
"PO-Revision-Date: 2005-06-18 16:42+0200\n"
"POT-Creation-Date: 2005-06-20 19:08+0200\n"
"PO-Revision-Date: 2005-06-20 19:08+0200\n"
"Last-Translator: Gyz Both <gyboth@bygfoot.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -51,19 +51,19 @@ msgstr ""
msgid " "
msgstr " "
#: src/user.c:765
msgid " &amp; Co."
msgstr ""
#: src/user.c:770
msgid " &amp; Co."
msgstr " &amp; Co."
#: src/user.c:775
msgid " &amp; Daughters"
msgstr ""
msgstr " &amp; Töchter"
#: src/user.c:769
#: src/user.c:774
msgid " &amp; Sons"
msgstr ""
msgstr "&amp; Söhne"
#: src/game.c:866
#: src/game.c:868
msgid " (FK)"
msgstr " (FS)"
@ -71,11 +71,11 @@ msgstr " (FS)"
msgid " (NOTE: If you don't, the game is over for you.)"
msgstr "(BEMERKUNG: Wenn Du ablehnst, ist das Spiel vorbei für Dich.)"
#: src/game.c:868
#: src/game.c:870
msgid " (OG)"
msgstr " (ET)"
#: src/game.c:864 src/treeview_helper.c:963
#: src/game.c:866 src/treeview_helper.c:963
msgid " (P)"
msgstr " (E)"
@ -91,132 +91,121 @@ msgstr " -- Wiederholungsspiele"
msgid " -- Second leg"
msgstr " -- Rückspiel"
#: src/user.c:762
#: src/user.c:767
msgid " Assoc."
msgstr ""
msgstr " Holding"
#: src/options_interface.c:266
msgid " Autosave files "
msgstr "Dateien für Auto-Speichern"
#: src/user.c:752
#, fuzzy
#: src/user.c:757
msgid " Bank"
msgstr "Rang"
msgstr " Bank"
#: src/user.c:771
#: src/user.c:776
msgid " Bros."
msgstr ""
msgstr " Gebr."
#: src/user.c:750
#: src/user.c:755
msgid " Chemicals"
msgstr ""
msgstr " Chemie"
#: src/user.c:763
#: src/user.c:768
msgid " Co."
msgstr ""
msgstr " Ges."
#: src/user.c:743
#, fuzzy
#: src/user.c:748
msgid " Communications"
msgstr "Abfindungen"
#: src/user.c:746
msgid " Company"
msgstr ""
#: src/user.c:766
#, fuzzy
msgid " Corp."
msgstr " i.E."
#: src/user.c:759
#, fuzzy
msgid " Data Systems"
msgstr "System"
msgstr " Kommunikation"
#: src/user.c:751
msgid " Energy"
msgstr ""
msgid " Company"
msgstr " Gesellschaft"
#: src/user.c:771
msgid " Corp."
msgstr " AG"
#: src/user.c:764
#, fuzzy
msgid " Ent."
msgstr "Ereignis"
msgid " Data Systems"
msgstr " Datensysteme"
#: src/user.c:756
#, fuzzy
msgid " Energy"
msgstr " Energie"
#: src/user.c:769
msgid " Ent."
msgstr " Ges."
#: src/user.c:761
msgid " Financial"
msgstr "Endspiel"
msgstr " Finanzen"
#: src/user.c:481
msgid " Fortunately he's got a cousin who can help your team out."
msgstr "Glücklicherweise hat er einen Cousin, der einspringen kann."
#: src/user.c:767
#, fuzzy
#: src/user.c:772
msgid " Group"
msgstr "%s Gruppe %d"
msgstr " Gruppe"
#: src/user.c:744
#: src/user.c:749
msgid " Holdings"
msgstr ""
msgstr " Logistik"
#: src/user.c:745
#, fuzzy
#: src/user.c:750
msgid " Industries"
msgstr "Verletzungen"
#: src/user.c:748
msgid " Labs"
msgstr ""
#: src/user.c:761
#, fuzzy
msgid " Ltd."
msgstr " n.V."
#: src/user.c:757
msgid " Petroleum"
msgstr ""
msgstr " Pharma"
#: src/user.c:753
msgid " Products"
msgstr ""
msgid " Labs"
msgstr " Labore"
#: src/user.c:766
msgid " Ltd."
msgstr " GmbH"
#: src/user.c:762
msgid " Petroleum"
msgstr " Petroleum"
#: src/user.c:758
#, fuzzy
msgid " Products"
msgstr " Produkte"
#: src/user.c:763
msgid " Restaurants"
msgstr "Return"
msgstr " Gaststätten"
#: src/interface.c:958
msgid " Round "
msgstr " Runde "
#: src/user.c:755
#: src/user.c:760
msgid " Scientific"
msgstr ""
msgstr " Scientific"
#: src/interface.c:940
msgid " Season "
msgstr " Saison "
#: src/user.c:754
#: src/user.c:759
msgid " Software"
msgstr ""
#: src/user.c:742
#, fuzzy
msgid " Systems"
msgstr "System"
#: src/user.c:749
msgid " Technologies"
msgstr ""
msgstr " Software"
#: src/user.c:747
msgid " Systems"
msgstr " Systeme"
#: src/user.c:754
msgid " Technologies"
msgstr " Technologien"
#: src/user.c:752
msgid " Telecommunications"
msgstr ""
msgstr " Telekommunikation"
#: src/interface.c:949
msgid " Week "
@ -247,9 +236,9 @@ msgid " seats"
msgstr " Plätze"
#: src/treeview.c:1338
#, fuzzy, c-format
#, c-format
msgid "%.1f months / %s"
msgstr " Monaten"
msgstr "%.1f Monate / %s"
#: src/team.c:976
#, c-format
@ -283,7 +272,7 @@ msgstr ""
"%s konnte sich %s nicht leisten, oder er hatte keinen Platz mehr in der "
"Mannschaft."
#: src/user.c:668
#: src/user.c:673
#, c-format
msgid ""
"%s fires you because of financial mismanagement.\n"
@ -292,7 +281,7 @@ msgstr ""
"%s feuert Dich wegen wirtschaftlicher Unfähigkeit.\n"
"Du bekommst eine neue Arbeit mit %s in der %s."
#: src/user.c:674
#: src/user.c:679
#, c-format
msgid ""
"%s fires you because of unsuccessfulness.\n"
@ -320,7 +309,7 @@ msgstr ""
"%s von %s hat dein Angebot (%s / %s) abgelehnt. Er war mit dem angebotenen "
"Gehalt unzufrieden."
#: src/user.c:680
#: src/user.c:685
#, c-format
msgid ""
"%s offer you a job in the %s.\n"
@ -494,10 +483,9 @@ msgstr "ANGRIFF"
msgid "About"
msgstr "Über"
#: src/misc_interface.c:1162
#, fuzzy
#: src/misc_interface.c:1161
msgid "Accept"
msgstr "Einverstanden?"
msgstr "Annehmen"
#: src/game_gui.c:520
msgid "Accept?"
@ -529,7 +517,7 @@ msgstr "Alter "
#: src/window.c:125
msgid "All Files"
msgstr ""
msgstr "Alle Dateien"
#: src/interface.c:460
msgid "All Out Attack"
@ -756,7 +744,7 @@ msgstr "Mannschaften durchstöbern"
#: src/window.c:119
msgid "Bygfoot Save Files"
msgstr ""
msgstr "Bygfoot Save-Dateien"
#: src/misc2_interface.c:904
msgid ""
@ -842,9 +830,8 @@ msgid "Commentary"
msgstr "Kommentar"
#: src/treeview.c:2391
#, fuzzy
msgid "Company"
msgstr "Abfindungen"
msgstr "Firma"
#: src/treeview.c:1252
msgid "Compensations"
@ -879,15 +866,16 @@ msgid "Contract "
msgstr "Vertrag "
#: src/treeview.c:1340
#, fuzzy
msgid "Contract / Money"
msgstr "Vertragsangebot "
msgstr "Vertrag / Zahlungen"
#: src/treeview.c:2392
msgid ""
"Contract length\n"
"(Months)"
msgstr ""
"Vertragslaufzeit\n"
"(Monate)"
#: src/window.c:475
msgid "Contract offer"
@ -1296,11 +1284,13 @@ msgstr ""
"Wenn ausgewählt, Wochen ohne Benutzermannschaftenbeteiligung werden "
"automatisch berechnet (ohne dass man auf 'Neue Woche' klicken muss)"
#: src/misc_interface.c:1169
#: src/misc_interface.c:1168
msgid ""
"If you don't like any of the sponsors, you can go a few weeks without "
"sponsor and wait for new offers."
msgstr ""
"Wenn Du keinen der Angebote schätzt, kannst Du einige Wochen ohne Sponsor "
"bleiben und auf neue Angebote warten."
#: src/misc_interface.c:965
msgid "Improve!"
@ -1578,9 +1568,8 @@ msgid "Money (approx.)"
msgstr "Kontostand (ungefähr)"
#: src/treeview.c:2393
#, fuzzy
msgid "Money / week"
msgstr "Kontostand "
msgstr "Zahlung / Woche"
#: src/interface.c:380
msgid "My league results"
@ -1632,9 +1621,8 @@ msgid "No match stored."
msgstr "Kein Spiel gespeichert."
#: src/misc_callbacks.c:353
#, fuzzy
msgid "None"
msgstr "Kontostand"
msgstr "Kein"
#: src/window.c:408
msgid "Numbers..."
@ -2138,10 +2126,9 @@ msgstr "Sortiere Mannschaft"
msgid "Reds"
msgstr "Rote K."
#: src/misc_interface.c:1183
#, fuzzy
#: src/misc_interface.c:1182
msgid "Reject for now"
msgstr "Schriftart auswählen"
msgstr "Erstmal überlegen"
#: src/options_interface.c:348
msgid "Reload"
@ -2404,16 +2391,15 @@ msgstr "Geschwindigkeit"
#: src/treeview.c:1334
msgid "Sponsor"
msgstr ""
msgstr "Sponsor"
#: src/treeview.c:1244
msgid "Sponsorship"
msgstr ""
msgstr "Sponsor"
#: src/window.c:514
#, fuzzy
msgid "Sponsorship offers"
msgstr "Zeige Jobangebote"
msgstr "Sponsorenangebote"
#: src/treeview.c:1251
msgid "Stadium bills"
@ -2723,11 +2709,13 @@ msgstr "Die Transferfrist ist vorbei."
msgid "The two teams are greeted by a wall of noise as they take to the pitch"
msgstr "Die Mannschaften werden durch eine ohrenbetäubende Lärmkulisse begrüßt"
#: src/misc_interface.c:1127
#: src/misc_interface.c:1126
msgid ""
"There are a few companies interested in sponsoring your team. Please select "
"one:"
msgstr ""
"Es gibt einige Firmen, die Sponsor Deines Teams werden möchten. Bitte "
"auswählen:"
#: src/callbacks.c:174
msgid "There are injured or banned players in one of the user teams. Continue?"
@ -2740,13 +2728,12 @@ msgid "There are no offers for the player."
msgstr "Es liegen keine Angebote für den Spieler vor."
#: src/callback_func.c:344
#, fuzzy
msgid ""
"There are some offers for the player which you rejected or will see next "
"week."
msgstr ""
"Es gibt einige Angebote für den Spieler; du wirst sie nächste Woche auf dem "
"Tisch haben."
"Es gibt einige Angebote für den Spieler; du hast sie abgelehnt oder wirst "
"sie nächste Woche auf dem Tisch haben."
#: src/lg_commentary.c:194
msgid "There are two teams out there and only one of them is playing football"
@ -2999,7 +2986,7 @@ msgstr "Gelbe Karten (Obergrenze)\n"
msgid "Yellows"
msgstr "Gelbe K."
#: src/user.c:715
#: src/user.c:720
#, c-format
msgid "You are champion of the %s!"
msgstr "Du bist Meister der %s!"
@ -3009,16 +2996,14 @@ msgid "You are free from debt."
msgstr "Du bist schuldenfrei."
#: src/callback_func.c:455
#, fuzzy, c-format
#, c-format
msgid ""
"You are making an offer for %s again. Your previous values for fee and wage "
"are preset."
msgstr ""
"Du bietest für %s. Die Empfehlungen Deines Spielerbeobachters sind "
"voreingestellt."
msgstr "Du bietest erneut für %s. Dein vorheriges Angebot ist voreingestellt."
#: src/callback_func.c:447
#, fuzzy, c-format
#, c-format
msgid ""
"You are making an offer for %s. Your scout's recommendations for fee and "
"wage are preset."
@ -3089,17 +3074,17 @@ msgstr "Du hast nicht genügend Geld um zurückzuzahlen."
msgid "You don't have the money."
msgstr "Du hast nicht genügend Geld."
#: src/user.c:686
#: src/user.c:691
#, c-format
msgid "You finish the season in the %s on rank %d."
msgstr "Du beendest die Saison in der %s auf Rang %d."
#: src/user.c:691
#: src/user.c:696
#, c-format
msgid "You get promoted to the %s."
msgstr "Du steigst in die %s auf."
#: src/user.c:695
#: src/user.c:700
#, c-format
msgid "You get relegated to the %s."
msgstr "Du steigst in die %s ab."
@ -3156,7 +3141,7 @@ msgstr "Du hast kein Angebot für den Spieler abgegeben."
msgid "You haven't selected a player."
msgstr "Du hast keinen Spieler ausgewählt."
#: src/user.c:704
#: src/user.c:709
#, c-format
msgid "You lose in the %s final against %s."
msgstr "Du verlierst das %s-Finale gegen %.s"
@ -3171,12 +3156,12 @@ msgstr ""
"Besitzer und der Spieler sind zufrieden mit Deinem Angebot. Willst Du den "
"Spieler nun kaufen?"
#: src/user.c:710
#: src/user.c:715
#, c-format
msgid "You reach the %s (round %d) of the %s."
msgstr "Du erreichst das %s (Runde %d) des %s."
#: src/user.c:663
#: src/user.c:668
#, c-format
msgid "You start the game with %s in the %s."
msgstr "Du beginnst das Spiel mit %s in der %s."
@ -3194,7 +3179,7 @@ msgstr ""
"Du willst %s feuern. Da sein Vertrag in %.1f Jahren ausläuft, verlangt er %s "
"Abfindung. Einverstanden?"
#: src/user.c:699
#: src/user.c:704
#, c-format
msgid "You win the %s final against %s."
msgstr "Du gewinnst das %s Finale gegen %s."
@ -3203,11 +3188,13 @@ msgstr "Du gewinnst das %s Finale gegen %s."
msgid "Your bank account has to be above your drawing credit limit next week."
msgstr "Dein Konto muss nächste Woche Deinen Dispokredit übersteigen."
#: src/user.c:851
#: src/user.c:856
msgid ""
"Your current sponsor is satisfied with your results and would like to renew "
"the contract."
msgstr ""
"Dein gegenwärtiger Sponsor ist zufrieden mit Deinen Ergebnissen und würde "
"die Zusammenarbeit gerne fortsetzen."
#: src/treeview.c:1467
msgid "Your next opponent"
@ -3295,10 +3282,6 @@ msgstr "_Mannschaft"
msgid "_User"
msgstr "_Benutzer"
#: src/misc_interface.c:1118
msgid "window1"
msgstr ""
#~ msgid " (A) "
#~ msgstr " (A) "

View File

@ -12,7 +12,7 @@ bygfoot_SOURCES = \
callback_func.c callback_func.h callbacks.h cup.h finance.h fixture.h game_gui.h league.h live_game.h maths.h misc.h option.h player.h start_end.h team.h transfer.h treeview.h treeview_helper.h user.h window.h \
callbacks.c callback_func.h callbacks.h debug.h free.h game_gui.h game.h gui.h load_save.h main.h option.h player.h team.h transfer.h treeview.h treeview_helper.h user.h window.h \
cup.c cup.h fixture.h free.h league.h main.h maths.h misc.h option.h table.h team.h variables.h xml_league.h \
debug.c debug.h game_gui.h option.h user.h variables.h \
debug.c debug.h game_gui.h option.h support.h user.h variables.h \
file.c file.h free.h main.h misc.h option.h support.h variables.h \
finance.c callbacks.h finance.h game_gui.h maths.h option.h player.h team.h user.h \
fixture.c cup.h fixture.h free.h league.h main.h maths.h misc.h option.h table.h team.h user.h variables.h \
@ -45,7 +45,7 @@ bygfoot_SOURCES = \
stat.c cup.h free.h league.h option.h player.h stat.h table_struct.h team.h variables.h \
support.c support.h \
table.c cup.h league.h misc.h table.h variables.h \
team.c cup.h fixture.h game_gui.h game.h league.h main.h maths.h misc.h option.h player.h team.h transfer.h user.h \
team.c cup.h file.h fixture.h game_gui.h game.h league.h main.h maths.h misc.h option.h player.h team.h transfer.h user.h xml_team.h \
transfer.c cup.h finance.h free.h game_gui.h main.h maths.h misc.h option.h player.h support.h team.h transfer.h treeview.h user.h \
treeview.c cup.h finance.h fixture.h free.h game.h language.h league.h live_game.h maths.h misc.h option.h player.h support.h team.h transfer.h treeview.h treeview_helper.h user.h \
treeview_helper.c cup.h file.h fixture.h free.h league.h misc.h option.h player.h support.h team.h transfer.h treeview.h treeview_helper.h user.h variables.h \
@ -66,7 +66,8 @@ bygfoot_SOURCES = \
xml_cup.c cup.h file.h main.h misc.h option.h variables.h xml_cup.h \
xml_country.c file.h free.h misc.h variables.h xml_country.h xml_cup.h xml_league.h \
xml_league.c cup_struct.h file.h free.h league.h misc.h table.h team.h variables.h xml_cup.h xml_league.h \
xml_name.c file.h free.h misc.h name.h variables.h xml_name.h
xml_name.c file.h free.h misc.h name.h variables.h xml_name.h \
xml_team.c file.h free.h main.h misc.h option.h player.h team.h variables.h xml_team.h
bygfoot_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)

View File

@ -16,7 +16,7 @@
/**
* Program version number.
*/
#define VERS "1.9.0"
#define VERS "1.9.1"
/** Home dir name */
#define HOMEDIRNAME ".bygfoot-1.9"
@ -83,6 +83,8 @@ enum ExitCodes
EXIT_INT_NOT_FOUND, /**< We didn't find an integer value (mostly indices). */
EXIT_NO_SUPPORT_DIR, /**< No support directory found. */
EXIT_CUP_ROUND_ERROR, /**< Too few cup rounds. */
EXIT_LOAD_TEAM_DEF, /**< Error loading a team definition file. */
EXIT_DEF_SORT, /**< Error sorting a team after loading the definition. */
EXIT_END
};

View File

@ -87,7 +87,7 @@ file_find_support_file (const gchar *filename, gboolea
gboolean
file_my_system(const gchar *command)
{
if(system(command) == -1)
if(system(command) != 0)
{
g_warning("file_my_system: system returned -1 when executing '%s'.", command);
return FALSE;

View File

@ -345,8 +345,11 @@ free_team(Team *tm)
{
gint i;
free_g_string(&tm->stadium.name);
free_g_string(&tm->name);
free_g_string(&tm->names_file);
free_g_string(&tm->symbol);
free_g_string(&tm->def_file);
if(tm->players != NULL)
{
@ -365,6 +368,7 @@ free_player(Player *pl)
free_g_string(&pl->name);
free_g_array(&pl->cards);
free_g_array(&pl->games_goals);
}
/**

View File

@ -1,3 +1,5 @@
#include <time.h>
#include "main.h"
#include "maths.h"
#include "misc.h"
@ -314,3 +316,17 @@ misc_string_replace_token(gchar *string, const gchar *token, const gchar *replac
}
}
}
/** Get a float representation of someone's age
based on his birth year and month. */
gfloat
misc_get_age_from_birth(gint birth_year, gint birth_month)
{
GDate *current_date = g_date_new();
GDate *birth_date = g_date_new();
g_date_set_time(current_date, time(NULL));
g_date_set_dmy(birth_date, 15, birth_month, birth_year);
return (gfloat)g_date_days_between(birth_date, current_date) / 365.25;
}

View File

@ -45,4 +45,7 @@ query_misc_integer_is_in_g_array(gint item, GArray *array);
void
misc_string_replace_token(gchar *string, const gchar *token, const gchar *replacement);
gfloat
misc_get_age_from_birth(gint birth_year, gint birth_month);
#endif

View File

@ -37,9 +37,20 @@ void
misc_callback_start_game(void)
{
gint i;
GtkToggleButton *radio_load =
GTK_TOGGLE_BUTTON(lookup_widget(window.startup, "radiobutton_team_def_load"));
GtkToggleButton *radio_names =
GTK_TOGGLE_BUTTON(lookup_widget(window.startup, "radiobutton_team_def_names"));
stat0 = STATUS_MAIN;
if(gtk_toggle_button_get_active(radio_load))
opt_set_int("int_opt_load_defs", 1);
else if(gtk_toggle_button_get_active(radio_names))
opt_set_int("int_opt_load_defs", 2);
else
opt_set_int("int_opt_load_defs", 0);
start_new_game();
for(i=0;i<users->len;i++)

View File

@ -53,6 +53,12 @@ create_window_startup (void)
GtkWidget *image59;
GtkWidget *label76;
GtkWidget *hseparator13;
GtkWidget *hbox74;
GtkWidget *radiobutton_team_def_load;
GSList *radiobutton_team_def_load_group = NULL;
GtkWidget *radiobutton_team_def_names;
GtkWidget *radiobutton_team_def_dont;
GtkWidget *hseparator16;
GtkWidget *hbox3;
GtkWidget *team_selection_ok;
GtkWidget *alignment18;
@ -118,7 +124,7 @@ create_window_startup (void)
hseparator10 = gtk_hseparator_new ();
gtk_widget_show (hseparator10);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator10, FALSE, FALSE, 0);
gtk_widget_set_size_request (hseparator10, 1, 10);
gtk_widget_set_size_request (hseparator10, 1, 5);
vbox34 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox34);
@ -136,7 +142,7 @@ create_window_startup (void)
hseparator11 = gtk_hseparator_new ();
gtk_widget_show (hseparator11);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator11, FALSE, FALSE, 0);
gtk_widget_set_size_request (hseparator11, 1, 10);
gtk_widget_set_size_request (hseparator11, 1, 5);
label4 = gtk_label_new (_("Start in"));
gtk_widget_show (label4);
@ -149,7 +155,7 @@ create_window_startup (void)
hseparator12 = gtk_hseparator_new ();
gtk_widget_show (hseparator12);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator12, FALSE, FALSE, 0);
gtk_widget_set_size_request (hseparator12, 1, 10);
gtk_widget_set_size_request (hseparator12, 1, 5);
hbox54 = gtk_hbox_new (FALSE, 5);
gtk_widget_show (hbox54);
@ -190,6 +196,36 @@ create_window_startup (void)
gtk_box_pack_start (GTK_BOX (vbox2), hseparator13, FALSE, TRUE, 0);
gtk_widget_set_size_request (hseparator13, 1, 10);
hbox74 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox74);
gtk_box_pack_start (GTK_BOX (vbox2), hbox74, FALSE, FALSE, 0);
radiobutton_team_def_load = gtk_radio_button_new_with_mnemonic (NULL, _("Load team definitions"));
gtk_widget_show (radiobutton_team_def_load);
gtk_box_pack_start (GTK_BOX (hbox74), radiobutton_team_def_load, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, radiobutton_team_def_load, _("Load teams from definition files (note that the official Bygfoot package doesn't contain team definition files, you have to get them from the homepage or via the bygfoot-update script)"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_team_def_load), radiobutton_team_def_load_group);
radiobutton_team_def_load_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_team_def_load));
radiobutton_team_def_names = gtk_radio_button_new_with_mnemonic (NULL, _("Only names"));
gtk_widget_show (radiobutton_team_def_names);
gtk_box_pack_start (GTK_BOX (hbox74), radiobutton_team_def_names, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, radiobutton_team_def_names, _("Load only the player names in the definition files"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_team_def_names), radiobutton_team_def_load_group);
radiobutton_team_def_load_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_team_def_names));
radiobutton_team_def_dont = gtk_radio_button_new_with_mnemonic (NULL, _("Don't load definitions"));
gtk_widget_show (radiobutton_team_def_dont);
gtk_box_pack_start (GTK_BOX (hbox74), radiobutton_team_def_dont, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, radiobutton_team_def_dont, _("Don't load team definitions at all"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_team_def_dont), radiobutton_team_def_load_group);
radiobutton_team_def_load_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_team_def_dont));
hseparator16 = gtk_hseparator_new ();
gtk_widget_show (hseparator16);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator16, FALSE, FALSE, 0);
gtk_widget_set_size_request (hseparator16, 1, 5);
hbox3 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox3);
gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, TRUE, 0);
@ -256,7 +292,7 @@ create_window_startup (void)
button_startup_resume = gtk_button_new ();
gtk_widget_show (button_startup_resume);
gtk_box_pack_start (GTK_BOX (vbox2), button_startup_resume, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox3), button_startup_resume, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, button_startup_resume, _("Load the last game that was saved or loaded."), NULL);
alignment21 = gtk_alignment_new (0.5, 0.5, 0, 0);
@ -331,6 +367,11 @@ create_window_startup (void)
GLADE_HOOKUP_OBJECT (window_startup, image59, "image59");
GLADE_HOOKUP_OBJECT (window_startup, label76, "label76");
GLADE_HOOKUP_OBJECT (window_startup, hseparator13, "hseparator13");
GLADE_HOOKUP_OBJECT (window_startup, hbox74, "hbox74");
GLADE_HOOKUP_OBJECT (window_startup, radiobutton_team_def_load, "radiobutton_team_def_load");
GLADE_HOOKUP_OBJECT (window_startup, radiobutton_team_def_names, "radiobutton_team_def_names");
GLADE_HOOKUP_OBJECT (window_startup, radiobutton_team_def_dont, "radiobutton_team_def_dont");
GLADE_HOOKUP_OBJECT (window_startup, hseparator16, "hseparator16");
GLADE_HOOKUP_OBJECT (window_startup, hbox3, "hbox3");
GLADE_HOOKUP_OBJECT (window_startup, team_selection_ok, "team_selection_ok");
GLADE_HOOKUP_OBJECT (window_startup, alignment18, "alignment18");
@ -713,6 +754,7 @@ create_window_stadium (void)
{
GtkWidget *window_stadium;
GtkWidget *vbox39;
GtkWidget *label_stadium_name;
GtkWidget *table1;
GtkWidget *label106;
GtkWidget *label_stadium_status;
@ -770,6 +812,10 @@ create_window_stadium (void)
gtk_widget_show (vbox39);
gtk_container_add (GTK_CONTAINER (window_stadium), vbox39);
label_stadium_name = gtk_label_new ("");
gtk_widget_show (label_stadium_name);
gtk_box_pack_start (GTK_BOX (vbox39), label_stadium_name, FALSE, FALSE, 0);
table1 = gtk_table_new (5, 2, FALSE);
gtk_widget_show (table1);
gtk_box_pack_start (GTK_BOX (vbox39), table1, FALSE, FALSE, 0);
@ -999,6 +1045,7 @@ create_window_stadium (void)
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (window_stadium, window_stadium, "window_stadium");
GLADE_HOOKUP_OBJECT (window_stadium, vbox39, "vbox39");
GLADE_HOOKUP_OBJECT (window_stadium, label_stadium_name, "label_stadium_name");
GLADE_HOOKUP_OBJECT (window_stadium, table1, "table1");
GLADE_HOOKUP_OBJECT (window_stadium, label106, "label106");
GLADE_HOOKUP_OBJECT (window_stadium, label_stadium_status, "label_stadium_status");
@ -1115,7 +1162,6 @@ create_window_sponsors (void)
window_sponsors = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window_sponsors), 5);
gtk_window_set_title (GTK_WINDOW (window_sponsors), _("window1"));
gtk_window_set_position (GTK_WINDOW (window_sponsors), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (window_sponsors), TRUE);
gtk_window_set_default_size (GTK_WINDOW (window_sponsors), 450, 350);

View File

@ -78,6 +78,64 @@ player_new(Team *tm, gfloat average_skill, gboolean new_id)
return new;
}
/** Complete the player structure (some values have been read
from a team def file). */
void
player_complete_def(Player *pl, gfloat average_skill)
{
gint i;
gfloat skill_factor =
math_rnd(1 - const_float("float_player_average_skill_variance"),
1 + const_float("float_player_average_skill_variance"));
pl->peak_age = math_rnd(const_float("float_player_peak_age_lower") +
(pl->pos == PLAYER_POS_GOALIE) *
const_float("float_player_peak_age_goalie_addition"),
const_float("float_player_peak_age_upper") +
(pl->pos == PLAYER_POS_GOALIE) *
const_float("float_player_peak_age_goalie_addition"));
if(opt_int("int_opt_load_defs") == 2)
{
pl->age = math_gauss_dist(const_float("float_player_age_lower"),
const_float("float_player_age_upper"));
pl->skill = CLAMP(average_skill * skill_factor, 0,
const_float("float_player_max_skill"));
pl->talent = player_new_talent(pl->skill);
if(pl->peak_age - pl->age > const_float("float_player_peak_age_diff_younger1") ||
pl->peak_age - pl->age < const_float("float_player_peak_age_diff_older1"))
pl->skill = pl->skill * (1 - const_float("float_player_skill_reduction1"));
else if(pl->peak_age - pl->age > const_float("float_player_peak_age_diff_younger2") ||
pl->peak_age - pl->age < const_float("float_player_peak_age_diff_peak_older"))
pl->skill = pl->skill * (1 - const_float("float_player_skill_reduction2"));
}
pl->cpos = pl->pos;
player_estimate_talent(pl);
pl->cskill = pl->skill;
pl->fitness = math_rnd(const_float("float_player_fitness_lower"),
const_float("float_player_fitness_upper"));
pl->health = pl->recovery = 0;
pl->value = player_assign_value(pl);
pl->wage = player_assign_wage(pl);
pl->contract = math_rnd(const_float("float_player_contract_lower"),
const_float("float_player_contract_upper"));
pl->lsu = math_rnd(const_float("float_player_lsu_lower"),
const_float("float_player_lsu_upper"));
pl->cards = g_array_new(FALSE, FALSE, sizeof(PlayerCard));
pl->games_goals = g_array_new(FALSE, FALSE, sizeof(PlayerGamesGoals));
for(i=0;i<PLAYER_VALUE_END;i++)
pl->career[i] = 0;
pl->participation = FALSE;
pl->offers = 0;
}
/** Return the appropriate position for the player with the given number.
The position depends on the team structure if the player number is < 11
and on some constants otherwise.

View File

@ -127,4 +127,7 @@ player_season_start(Player *pl, gfloat skill_change);
gchar*
player_get_last_name(const gchar *name);
void
player_complete_def(Player *pl, gfloat average_skill);
#endif

View File

@ -1,4 +1,5 @@
#include "cup.h"
#include "file.h"
#include "fixture.h"
#include "game.h"
#include "game_gui.h"
@ -11,6 +12,7 @@
#include "team.h"
#include "transfer.h"
#include "user.h"
#include "xml_team.h"
/**
Generate a team with default values, e.g.
@ -26,6 +28,8 @@ team_new(gboolean new_id)
new.name = g_string_new("");
new.names_file = g_string_new("");
new.symbol = g_string_new("");
new.def_file = NULL;
new.stadium.name = NULL;
new.clid = -1;
new.id = (new_id) ? team_id_new : -1;
@ -95,8 +99,14 @@ team_generate_players_stadium(Team *tm)
gfloat skill_factor = math_rnd(1 - const_float("float_team_skill_variance"),
1 + const_float("float_team_skill_variance"));
Player new;
gfloat average_skill;
gfloat wages = 0;
gfloat wages = 0, average_skill;
gchar *def_file = team_has_def_file(tm);
tm->stadium.average_attendance = tm->stadium.possible_attendance =
tm->stadium.games = 0;
tm->stadium.safety =
math_rnd(const_float("float_team_stadium_safety_lower"),
const_float("float_team_stadium_safety_upper"));
if(tm->clid < ID_CUP_START)
average_skill =
@ -106,23 +116,25 @@ team_generate_players_stadium(Team *tm)
average_skill =
skill_factor * team_get_average_skills(lig(0).teams) *
(1 + ((gfloat)cup_from_clid(tm->clid)->skill_diff / 10000));
average_skill = CLAMP(average_skill, 0, const_float("float_player_max_skill"));
average_skill = CLAMP(average_skill, 0, const_float("float_player_max_skill"));
for(i=0;i<const_int("int_team_cpu_players");i++)
if(def_file == NULL)
{
new = player_new(tm, average_skill, TRUE);
g_array_append_val(tm->players, new);
if(i > 2)
wages += new.wage;
for(i=0;i<const_int("int_team_cpu_players");i++)
{
new = player_new(tm, average_skill, TRUE);
g_array_append_val(tm->players, new);
}
}
else
{
xml_team_read(tm, def_file);
g_free(def_file);
}
tm->stadium.average_attendance = tm->stadium.possible_attendance =
tm->stadium.games = 0;
tm->stadium.safety =
math_rnd(const_float("float_team_stadium_safety_lower"),
const_float("float_team_stadium_safety_upper"));
for(i=0;i<const_int("int_team_cpu_players") - 2;i++)
wages += g_array_index(tm->players, Player, i).wage;
tm->stadium.capacity =
math_round_integer((gint)rint((wages / (gfloat)const_int("int_team_stadium_ticket_price")) *
@ -1060,3 +1072,163 @@ query_team_is_in_teams_array(const Team *tm, const GPtrArray *teams)
return FALSE;
}
/** Check whether we find a definition file for the
given team. */
gchar*
team_has_def_file(const Team *tm)
{
gchar *return_value = NULL;
gchar buf[SMALL];
if(tm->def_file != NULL && opt_int("int_opt_load_defs") != 0)
{
sprintf(buf, "team_%s.xml", tm->def_file->str);
return_value = file_find_support_file(buf, FALSE);
}
return return_value;
}
/** Complete the definition of the team (add players,
calculate wages etc. Called after reading a team def file. */
void
team_complete_def(Team *tm, gfloat average_skill)
{
gint i, new_pos, pos_sum;
gint positions[4] = {0, 0, 0, 0};
Player new_player;
gint add = const_int("int_team_cpu_players") - tm->players->len;
gboolean is_user = (team_is_user(tm) != -1);
for(i=0;i<tm->players->len;i++)
{
player_complete_def(&g_array_index(tm->players, Player, i), average_skill);
positions[g_array_index(tm->players, Player, i).pos]++;
/** This is so we don't remove loaded players
from the team at startup. */
if(is_user)
g_array_index(tm->players, Player, i).recovery = 1;
}
for(i=0;i<add;i++)
{
pos_sum = math_sum_int_array(positions, 4);
new_player = player_new(tm, average_skill, TRUE);
if(positions[0] < 2)
new_pos = 0;
else if((gfloat)positions[1] / (gfloat)pos_sum <
const_float("float_player_pos_bound1"))
new_pos = 1;
else if((gfloat)positions[2] / (gfloat)pos_sum <
const_float("float_player_pos_bound1"))
new_pos = 2;
else
new_pos = 3;
new_player.pos = new_player.cpos = new_pos;
positions[new_pos]++;
g_array_append_val(tm->players, new_player);
}
team_complete_def_sort(tm);
}
/** Sort the players in the team according to the team structure
and the player positions. */
void
team_complete_def_sort(Team *tm)
{
gint i, j;
gint positions[4] = {0, 0, 0, 0};
gint structure[4] = {1,
math_get_place(tm->structure, 3),
math_get_place(tm->structure, 2),
math_get_place(tm->structure, 1)};
Player player_tmp, player_tmp2;
gchar buf[SMALL];
for(i=0;i<11;i++)
positions[g_array_index(tm->players, Player, i).pos]++;
for(i=0;i<4;i++)
{
while(positions[i] > structure[i])
{
for(j=0;j<11;j++)
if(g_array_index(tm->players, Player, j).pos == i)
{
player_tmp = g_array_index(tm->players, Player, j);
g_array_remove_index(tm->players, j);
break;
}
for(j=10;j<tm->players->len;j++)
{
if(g_array_index(tm->players, Player, j).pos != i)
{
player_tmp2 = g_array_index(tm->players, Player, j);
g_array_remove_index(tm->players, j);
break;
}
}
if(j == tm->players->len)
{
sprintf(buf, "team_complete_def_sort (1): cannot sort according to structure %d (team %s).",
tm->structure, tm->name->str);
main_exit_program(EXIT_DEF_SORT, buf);
}
positions[i]--;
positions[player_tmp2.pos]++;
g_array_append_val(tm->players, player_tmp);
g_array_prepend_val(tm->players, player_tmp2);
}
while(positions[i] < structure[i])
{
for(j=0;j<11;j++)
if(g_array_index(tm->players, Player, j).pos > i)
{
player_tmp = g_array_index(tm->players, Player, j);
g_array_remove_index(tm->players, j);
break;
}
if(j == 11)
{
sprintf(buf, "team_complete_def_sort (2): cannot sort according to structure %d (team %s).",
tm->structure, tm->name->str);
main_exit_program(EXIT_DEF_SORT, buf);
}
for(j=10;j<tm->players->len;j++)
if(g_array_index(tm->players, Player, j).pos == i)
{
player_tmp2 = g_array_index(tm->players, Player, j);
g_array_remove_index(tm->players, j);
break;
}
if(j == tm->players->len)
{
sprintf(buf, "team_complete_def_sort (3): cannot sort according to structure %d (team %s).",
tm->structure, tm->name->str);
main_exit_program(EXIT_DEF_SORT, buf);
}
positions[i]++;
positions[player_tmp.pos]--;
g_array_append_val(tm->players, player_tmp);
g_array_prepend_val(tm->players, player_tmp2);
}
}
team_rearrange(tm);
}

View File

@ -141,4 +141,13 @@ team_write_own_results(const Team *tm, gchar *buf, gboolean sort);
gboolean
query_team_is_in_teams_array(const Team *tm, const GPtrArray *teams);
gchar*
team_has_def_file(const Team *tm);
void
team_complete_def(Team *tm, gfloat average_skill);
void
team_complete_def_sort(Team *tm);
#endif

View File

@ -32,6 +32,7 @@ enum TeamAttribute
/** The stadium of a team. */
typedef struct
{
GString *name;
gint capacity, /**< How many people fit in. Default: -1 (depends on league). */
average_attendance, /**< How many people watched on average. Default: 0. */
possible_attendance, /**< How many people would've watched if every game had been
@ -50,6 +51,7 @@ typedef struct
/** File the team takes the
player names from. */
GString *names_file;
GString *def_file;
gint clid, /**< Numerical id of the league or cup the team belongs to. */
id, /**< Id of the team. */

View File

@ -1207,6 +1207,13 @@ treeview_create_stadium_summary(GtkListStore *ls)
gchar buf[SMALL];
GtkTreeIter iter;
if(current_user.tm->stadium.name != NULL)
{
gtk_list_store_append(ls, &iter);
gtk_list_store_set(ls, &iter, 0, _("Stadium"),
1, current_user.tm->stadium.name->str, 2, "", -1);
}
gtk_list_store_append(ls, &iter);
misc_print_grouped_int(current_user.tm->stadium.capacity, buf, FALSE);
gtk_list_store_set(ls, &iter, 0, _("Stadium capacity"), 1, buf, 2, "", -1);

View File

@ -84,12 +84,16 @@ user_set_up_team(User *user)
for(i=PLAYER_POS_DEFENDER; i<=PLAYER_POS_FORWARD; i++)
for(j=user->tm->players->len - 1; j > 10; j--)
if(g_array_index(user->tm->players, Player, j).pos == i)
if(g_array_index(user->tm->players, Player, j).pos == i &&
g_array_index(user->tm->players, Player, j).recovery != 1)
{
player_remove_from_team(user->tm, j);
break;
}
for(i=0;i<user->tm->players->len;i++)
g_array_index(user->tm->players, Player, i).recovery = 0;
user->scout = user->physio = QUALITY_AVERAGE;
user->tm->style = 0;
@ -496,7 +500,6 @@ void
user_change_team(User *user, Team *tm)
{
gint i;
UserSponsor sponsor;
user->tm = tm;
user->team_id = tm->id;

View File

@ -235,7 +235,8 @@ window_show_stadium(void)
gchar buf[SMALL];
const Team *tm = current_user.tm;
GtkLabel *label_capacity,
*label_stadium_status, *label_average_attendance;
*label_stadium_status, *label_average_attendance,
*label_name;
GtkProgressBar *progressbar_safety,
*progressbar_average_attendance;
gfloat average_attendance_perc = 0;
@ -245,6 +246,7 @@ window_show_stadium(void)
label_capacity = GTK_LABEL(lookup_widget(window.stadium, "label_capacity"));
label_stadium_status = GTK_LABEL(lookup_widget(window.stadium, "label_stadium_status"));
label_average_attendance = GTK_LABEL(lookup_widget(window.stadium, "label_average_attendance"));
label_name = GTK_LABEL(lookup_widget(window.stadium, "label_stadium_name"));
progressbar_safety = GTK_PROGRESS_BAR(lookup_widget(window.stadium, "progressbar_safety"));
progressbar_average_attendance = GTK_PROGRESS_BAR(lookup_widget(window.stadium, "progressbar_average_attendance"));
@ -252,6 +254,8 @@ window_show_stadium(void)
gui_label_set_text_from_int(label_capacity, tm->stadium.capacity, FALSE);
gui_label_set_text_from_int(label_average_attendance, tm->stadium.average_attendance, FALSE);
if(tm->stadium.name != NULL)
gtk_label_set_text(label_name, tm->stadium.name->str);
if(tm->stadium.games > 0)
average_attendance_perc =

View File

@ -38,6 +38,7 @@
#define TAG_TEAMS "teams"
#define TAG_TEAM "team"
#define TAG_TEAM_NAME "team_name"
#define TAG_TEAM_DEF_FILE "def_file"
/**
* Enum with the states used in the XML parser functions.
@ -70,6 +71,7 @@ enum XmlLeagueStates
STATE_TEAMS,
STATE_TEAM,
STATE_TEAM_NAME,
STATE_TEAM_DEF_FILE,
STATE_END
};
@ -164,6 +166,8 @@ xml_league_read_start_element (GMarkupParseContext *context,
}
else if(strcmp(element_name, TAG_TEAM_NAME) == 0)
state = STATE_TEAM_NAME;
else if(strcmp(element_name, TAG_TEAM_DEF_FILE) == 0)
state = STATE_TEAM_DEF_FILE;
else
g_warning("xml_league_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
@ -210,7 +214,8 @@ xml_league_read_end_element (GMarkupParseContext *context,
state = STATE_PROM_REL_ELEMENT;
else if(strcmp(element_name, TAG_TEAM) == 0)
state = STATE_TEAMS;
else if(strcmp(element_name, TAG_TEAM_NAME) == 0)
else if(strcmp(element_name, TAG_TEAM_NAME) == 0 ||
strcmp(element_name, TAG_TEAM_DEF_FILE) == 0)
state = STATE_TEAM;
else if(strcmp(element_name, TAG_LEAGUE) != 0)
g_warning("xml_league_end_start_element: unknown tag: %s; I'm in state %d\n",
@ -297,6 +302,9 @@ xml_league_read_text (GMarkupParseContext *context,
else if(state == STATE_TEAM_NAME)
g_string_printf(g_array_index(new_league.teams, Team,
new_league.teams->len - 1).name, "%s", buf);
else if(state == STATE_TEAM_DEF_FILE)
g_array_index(new_league.teams, Team, new_league.teams->len - 1).def_file =
g_string_new(buf);
}
/**

View File

@ -15,6 +15,7 @@ enum
TAG_TEAM_BOOST,
TAG_TEAM_CLID,
TAG_TEAM_STADIUM,
TAG_TEAM_STADIUM_NAME,
TAG_TEAM_STADIUM_CAPACITY,
TAG_TEAM_STADIUM_AVERAGE_ATTENDANCE,
TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE,
@ -127,7 +128,8 @@ xml_loadsave_teams_end_element (GMarkupParseContext *context,
if(tag == TAG_TEAM_PLAYER)
g_array_append_val(new_team.players, new_player);
}
else if(tag == TAG_TEAM_STADIUM_CAPACITY ||
else if(tag == TAG_TEAM_STADIUM_NAME ||
tag == TAG_TEAM_STADIUM_CAPACITY ||
tag == TAG_TEAM_STADIUM_AVERAGE_ATTENDANCE ||
tag == TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE ||
tag == TAG_TEAM_STADIUM_GAMES ||
@ -213,6 +215,8 @@ xml_loadsave_teams_text (GMarkupParseContext *context,
new_team.style = int_value;
else if(state == TAG_TEAM_BOOST)
new_team.boost = int_value;
else if(state == TAG_TEAM_STADIUM_NAME)
new_team.stadium.name = g_string_new(buf);
else if(state == TAG_TEAM_STADIUM_CAPACITY)
new_team.stadium.capacity = int_value;
else if(state == TAG_TEAM_STADIUM_AVERAGE_ATTENDANCE)
@ -356,6 +360,9 @@ xml_loadsave_teams_write_team(FILE *fil, const Team* team)
fprintf(fil, "%s<_%d>\n", I1, TAG_TEAM_STADIUM);
if(team->stadium.name != NULL)
xml_write_g_string(fil, team->stadium.name, TAG_TEAM_STADIUM_NAME, I2);
xml_write_int(fil, team->stadium.capacity, TAG_TEAM_STADIUM_CAPACITY, I2);
xml_write_int(fil, team->stadium.average_attendance, TAG_TEAM_STADIUM_AVERAGE_ATTENDANCE, I2);
xml_write_int(fil, team->stadium.possible_attendance, TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE, I2);

234
src/xml_team.c Normal file
View File

@ -0,0 +1,234 @@
#include "file.h"
#include "free.h"
#include "main.h"
#include "misc.h"
#include "option.h"
#include "player.h"
#include "team.h"
#include "variables.h"
#include "xml_team.h"
/**
* The tags used in the XML files defining teams.
*/
#define TAG_TEAM "team"
#define TAG_TEAM_NAME "team_name"
#define TAG_STADIUM_NAME "stadium_name"
#define TAG_SYMBOL "symbol"
#define TAG_AVERAGE_SKILL "average_skill"
#define TAG_FORMATION "formation"
#define TAG_NAMES_FILE "names_file"
#define TAG_PLAYER "player"
#define TAG_PLAYER_NAME "player_name"
#define TAG_PLAYER_BIRTH_YEAR "birth_year"
#define TAG_PLAYER_BIRTH_MONTH "birth_month"
#define TAG_PLAYER_SKILL "skill"
#define TAG_PLAYER_TALENT "talent"
#define TAG_PLAYER_POSITION "position"
enum XmlTeamStates
{
STATE_TEAM = 0,
STATE_TEAM_NAME,
STATE_STADIUM_NAME,
STATE_SYMBOL,
STATE_AVERAGE_SKILL,
STATE_FORMATION,
STATE_NAMES_FILE,
STATE_PLAYER,
STATE_PLAYER_NAME,
STATE_PLAYER_BIRTH_YEAR,
STATE_PLAYER_BIRTH_MONTH,
STATE_PLAYER_SKILL,
STATE_PLAYER_TALENT,
STATE_PLAYER_POSITION,
STATE_END
};
gint state, birth_year;
Player new_player;
gfloat average_skill;
Team *team;
const gchar *d_file;
void
xml_team_read_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
{
if(strcmp(element_name, TAG_TEAM) == 0)
state = STATE_TEAM;
else if(strcmp(element_name, TAG_TEAM_NAME) == 0)
state = STATE_TEAM_NAME;
else if(strcmp(element_name, TAG_STADIUM_NAME) == 0)
state = STATE_STADIUM_NAME;
else if(strcmp(element_name, TAG_SYMBOL) == 0)
state = STATE_SYMBOL;
else if(strcmp(element_name, TAG_AVERAGE_SKILL) == 0)
state = STATE_AVERAGE_SKILL;
else if(strcmp(element_name, TAG_FORMATION) == 0)
state = STATE_FORMATION;
else if(strcmp(element_name, TAG_NAMES_FILE) == 0)
state = STATE_NAMES_FILE;
else if(strcmp(element_name, TAG_PLAYER) == 0)
{
state = STATE_PLAYER;
new_player = player_new(team, average_skill, TRUE);
}
else if(strcmp(element_name, TAG_PLAYER_NAME) == 0)
state = STATE_PLAYER_NAME;
else if(strcmp(element_name, TAG_PLAYER_BIRTH_YEAR) == 0)
state = STATE_PLAYER_BIRTH_YEAR;
else if(strcmp(element_name, TAG_PLAYER_BIRTH_MONTH) == 0)
state = STATE_PLAYER_BIRTH_MONTH;
else if(strcmp(element_name, TAG_PLAYER_SKILL) == 0)
state = STATE_PLAYER_SKILL;
else if(strcmp(element_name, TAG_PLAYER_TALENT) == 0)
state = STATE_PLAYER_TALENT;
else if(strcmp(element_name, TAG_PLAYER_POSITION) == 0)
state = STATE_PLAYER_POSITION;
else
g_warning("xml_team_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
/**
* The function called by the parser when a closing tag is read.
* The state variable is changed in this function.
* @see The GLib manual (Simple XML parser).
*/
void
xml_team_read_end_element (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
GError **error)
{
gchar buf[SMALL];
if(strcmp(element_name, TAG_TEAM_NAME) == 0 ||
strcmp(element_name, TAG_STADIUM_NAME) == 0 ||
strcmp(element_name, TAG_SYMBOL) == 0 ||
strcmp(element_name, TAG_AVERAGE_SKILL) == 0 ||
strcmp(element_name, TAG_FORMATION) == 0 ||
strcmp(element_name, TAG_NAMES_FILE) == 0 ||
strcmp(element_name, TAG_PLAYER) == 0)
{
state = STATE_TEAM;
if(strcmp(element_name, TAG_PLAYER) == 0)
{
if(team->players->len == const_int("int_team_cpu_players"))
{
free_player(&new_player);
sprintf(buf, "xml_team_read_end_element: too many players in team definition '%s' (only %d allowed).",
d_file, const_int("int_team_cpu_players"));
main_exit_program(EXIT_LOAD_TEAM_DEF, buf);
}
else
g_array_append_val(team->players, new_player);
}
}
else if(strcmp(element_name, TAG_PLAYER_NAME) == 0 ||
strcmp(element_name, TAG_PLAYER_BIRTH_YEAR) == 0 ||
strcmp(element_name, TAG_PLAYER_BIRTH_MONTH) == 0 ||
strcmp(element_name, TAG_PLAYER_SKILL) == 0 ||
strcmp(element_name, TAG_PLAYER_TALENT) == 0 ||
strcmp(element_name, TAG_PLAYER_POSITION) == 0)
state = STATE_PLAYER;
else if(strcmp(element_name, TAG_TEAM) != 0)
g_warning("xml_team_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
/**
* The function called by the parser when the text between tags is read.
* This function is responsible for filling in the variables (e.g. team names)
* when a file gets loaded.
* @see The GLib manual (Simple XML parser).
*/
void
xml_team_read_text (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
GError **error)
{
gchar buf[text_len + 1];
gint int_value;
strncpy(buf, text, text_len);
buf[text_len] = '\0';
int_value = (gint)g_ascii_strtod(buf, NULL);
if(state == STATE_TEAM_NAME)
g_string_printf(team->name, "%s", buf);
else if(state == STATE_STADIUM_NAME)
{
free_g_string(&team->stadium.name);
team->stadium.name = g_string_new(buf);
}
else if(state == STATE_SYMBOL)
g_string_printf(team->symbol, "%s", buf);
else if(state == STATE_AVERAGE_SKILL && opt_int("int_opt_load_defs") == 1)
average_skill = int_value;
else if(state == STATE_FORMATION)
team->structure = int_value;
else if(state == STATE_PLAYER_NAME)
g_string_printf(new_player.name, "%s", buf);
else if(state == STATE_PLAYER_BIRTH_YEAR && opt_int("int_opt_load_defs") == 1)
birth_year = int_value;
else if(state == STATE_PLAYER_BIRTH_MONTH && opt_int("int_opt_load_defs") == 1)
new_player.age = misc_get_age_from_birth(birth_year, int_value);
else if(state == STATE_PLAYER_SKILL && opt_int("int_opt_load_defs") == 1)
new_player.skill = ((gfloat)int_value / 10000) *
const_float("float_player_max_skill");
else if(state == STATE_PLAYER_TALENT && opt_int("int_opt_load_defs") == 1)
new_player.talent = ((gfloat)int_value / 10000) *
const_float("float_player_max_skill");
else if(state == STATE_PLAYER_POSITION)
new_player.pos = int_value;
}
/** Parse a team definition file and write the team accordingly. */
void
xml_team_read(Team *tm, const gchar *def_file)
{
GMarkupParser parser = {xml_team_read_start_element,
xml_team_read_end_element,
xml_team_read_text, NULL, NULL};
GMarkupParseContext *context;
gchar *file_contents;
gint length;
GError *error = NULL;
team = tm;
d_file = def_file;
context =
g_markup_parse_context_new(&parser, 0, NULL, NULL);
if(!g_file_get_contents(def_file, &file_contents, &length, &error))
{
g_warning("xml_team_read: error reading file %s\n", def_file);
misc_print_error(&error, FALSE);
return;
}
if(g_markup_parse_context_parse(context, file_contents, length, &error))
{
g_markup_parse_context_end_parse(context, NULL);
g_markup_parse_context_free(context);
g_free(file_contents);
}
else
{
g_critical("xml_team_read: error parsing file %s\n", def_file);
misc_print_error(&error, TRUE);
}
team_complete_def(tm, ((gfloat)average_skill / 10000) *
const_float("float_player_max_skill"));
}

32
src/xml_team.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef XML_TEAM_H
#define XML_TEAM_H
#include "bygfoot.h"
void
xml_team_read(Team *tm, const gchar *def_file);
void
xml_team_read_text (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
GError **error);
void
xml_team_read_end_element (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
GError **error);
void
xml_team_read_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error);
#endif

View File

@ -197,7 +197,7 @@ float_player_pos_bound1 3755
float_player_pos_bound2 7510
# maximum number of players in a user team.
int_team_max_players 100
int_team_max_players 22
# number of players in cpu teams. should be
# less or equal int_team_max_players
int_team_cpu_players 20