diff --git a/src/common/modules/victoryconditions.c b/src/common/modules/victoryconditions.c index df1386460..19df368b2 100644 --- a/src/common/modules/victoryconditions.c +++ b/src/common/modules/victoryconditions.c @@ -29,17 +29,42 @@ #if VICTORY_CONDITION == VICTORY_MURDER static void -print_winners_murder(void) +print_winners_murder(const int winners) { - /* Eine oder mehrere Parteien haben endgültig gewonnen. Ausgeben. */ + faction *f; + char winner_buf[DISPLAYSIZE+1]; + message *msg; + boolean first; + + winner_buf[0] = 0; + + first = true; + for(f=factions; f; f=f->next) { + if(f->no != 0 && f->victory_delay == VICTORY_DELAY) { + if(first == true) { + /* potential buffer overflow here */ + strcat(winner_buf, factionid(f)); + first = false; + } else { + /* potential buffer overflow here */ + strcat(winner_buf, ", "); + strcat(winner_buf, factionid(f)); + } + } + } + + msg = msg_message("victory_murder_complete", + "winners n", strdup(winner_buf), winners); + + for(f=factions; f; f=f->next) { + add_message(&f->messages, msg); + } + msg_release(msg); } static boolean is_winner_murder(const faction *f) { - /* Prüfen, ob Conditions erfüllt sind. */ - /* Wenn ja, counter erhöhen, sonst counter auf 0 */ - /* Wenn counter == VICTORY_DELAY: Partei hat gewonnen */ } static void @@ -62,22 +87,29 @@ check_victory_murder(void) if(winners > 0) { print_winners_murder(); + return true; } else if(condfulfilled > 0) { for(f=factions; f; f=f->next) { if(f->victory_delay > 0) { - /* Meldung an alle, dass Partei x die Siegbedingung in der n-ten Woche - * erfüllt */ + faction *f2; + message *msg = msg_message("victory_murder_cfulfilled", + "faction remain", f, VICTORY_DELAY - f->victory_delay); + for(f2=factions; f2; f2=f2->next) { + add_message(&f2->messages, msg); + } + msg_release(msg); } } } + return false; } #endif -void +boolean check_victory(void) { #if VICTORY_CONDITION == VICTORY_MURDER - check_victory_murder(); + return check_victory_murder(); #endif } diff --git a/src/res/de/messages.xml b/src/res/de/messages.xml index 9e5b8c9f6..685255438 100644 --- a/src/res/de/messages.xml +++ b/src/res/de/messages.xml @@ -7347,5 +7347,14 @@ "Achtung: $faction($faction) hat die Siegbedingungen erfüllt und wird in $if($eq($remain,1),"einer Woche","$int($remain) Wochen") zum Sieger erklärt werden." "Attention: $faction($faction) has fulfilled the victory condition and will be declared winner in $if($eq($remain,1),"one week","$int($remain) weeks")." + + + + + + + "SIEG! $if($eq($n,1), "Die Partei $winners hat", "Die Parteien $winners haben") die Siegbedingung für die erforderliche Zeit erfüllt. Das Spiel ist damit beendet." + "VICTORY! $if($eq($n,1), "The faction $winners has", "The factions $winners have") fulfilled the victory condition for the necessary time. The game is over." +