forked from github/server
- Grundgerüst fast fertig, fehlen nur noch die tatsächlichen Bedingungen.
This commit is contained in:
parent
c923b268c1
commit
01e7b2b676
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -7347,5 +7347,14 @@
|
|||
<text locale="de">"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."</text>
|
||||
<text locale="en">"Attention: $faction($faction) has fulfilled the victory condition and will be declared winner in $if($eq($remain,1),"one week","$int($remain) weeks")."</text>
|
||||
</message>
|
||||
|
||||
<message name="victory_murder_complete" section="events">
|
||||
<type>
|
||||
<arg name="winners" type="string"></arg>
|
||||
<arg name="n" type="int"></arg>
|
||||
</type>
|
||||
<text locale="de">"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."</text>
|
||||
<text locale="en">"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."</text>
|
||||
</message>
|
||||
|
||||
</messages>
|
||||
|
|
Loading…
Reference in New Issue