From fea1a8a1dbb2809e9a9211df147b2a21578ba72a Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Sun, 31 Mar 2002 09:42:39 +0000 Subject: [PATCH] =?UTF-8?q?-=20Grundger=C3=BCst=20f=C3=BCr=20Siegbedingung?= =?UTF-8?q?en=20-=20make=20depend=20funktioniert=20wieder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Makefile | 3 +- src/common/kernel/eressea.h | 5 ++ src/common/kernel/faction.h | 3 + src/common/modules/victoryconditions.c | 83 ++++++++++++++++++++++++++ src/common/modules/victoryconditions.h | 15 +++++ src/common/settings-vinyambar-murder.h | 35 +++++++++++ src/corwin.mk | 1 + src/res/de/messages.xml | 2 +- 8 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 src/common/modules/victoryconditions.c create mode 100644 src/common/modules/victoryconditions.h create mode 100644 src/common/settings-vinyambar-murder.h diff --git a/src/Makefile b/src/Makefile index 8f84a72a0..482691a93 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,8 +3,7 @@ TARGETS = subdirs SUBDIRS = \ common \ eressea \ - mapper \ - tools + mapper # askalon diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index ea899335b..b43c28e4a 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -711,6 +711,11 @@ enum { SEASON_AUTUMN }; +/* Siegbedingungen */ + +#define VICTORY_NONE 0 +#define VICTORY_MURDER 1 + /* ------------------------------------------------------------- */ #define MAXSPEED 21 diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index 75dd99935..69c44c136 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -55,6 +55,9 @@ typedef struct faction { int number; /* enno: unterschied zu num_people ? */ int money; int score; +#ifdef VICTORY_DELAY + unsigned char victory_delay; +#endif #ifndef FAST_REGION vset regions; #endif diff --git a/src/common/modules/victoryconditions.c b/src/common/modules/victoryconditions.c new file mode 100644 index 000000000..df1386460 --- /dev/null +++ b/src/common/modules/victoryconditions.c @@ -0,0 +1,83 @@ +/* vi: set ts=2: + * + * Eressea PB(E)M host Copyright (C) 1998-2000 + * Christian Schlittchen (corwin@amber.kn-bremen.de) + * Katja Zedel (katze@felidae.kn-bremen.de) + * Henning Peters (faroul@beyond.kn-bremen.de) + * Enno Rehling (enno@eressea-pbem.de) + * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) + * + * This program may not be used, modified or distributed without + * prior permission by the authors of Eressea. + */ + +#include +#include +#include "victoryconditions.h" + +/* kernel includes */ +#include +#include + +/* util includes */ +#include + +/* libc includes */ +#include +#include + +#if VICTORY_CONDITION == VICTORY_MURDER + +static void +print_winners_murder(void) +{ + /* Eine oder mehrere Parteien haben endgültig gewonnen. Ausgeben. */ +} + +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 +check_victory_murder(void) +{ + faction *f; + int condfulfilled = 0; + int winners = 0; + + for(f=factions; f; f=f->next) { + if(f->no != 0 && is_winner_murder(f)) { + f->victory_delay++; + condfulfilled++; + if(f->victory_delay == VICTORY_DELAY) + winners++; + } else { + f->victory_delay = 0; + } + } + + if(winners > 0) { + print_winners_murder(); + } 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 */ + } + } + } +} +#endif + +void +check_victory(void) +{ +#if VICTORY_CONDITION == VICTORY_MURDER + check_victory_murder(); +#endif +} + diff --git a/src/common/modules/victoryconditions.h b/src/common/modules/victoryconditions.h new file mode 100644 index 000000000..c35a21abb --- /dev/null +++ b/src/common/modules/victoryconditions.h @@ -0,0 +1,15 @@ +/* vi: set ts=2: + * + * Eressea PB(E)M host Copyright (C) 1998-2000 + * Christian Schlittchen (corwin@amber.kn-bremen.de) + * Katja Zedel (katze@felidae.kn-bremen.de) + * Henning Peters (faroul@beyond.kn-bremen.de) + * Enno Rehling (enno@eressea-pbem.de) + * Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de) + * + * This program may not be used, modified or distributed without + * prior permission by the authors of Eressea. + */ + +extern void check_victory(void); + diff --git a/src/common/settings-vinyambar-murder.h b/src/common/settings-vinyambar-murder.h new file mode 100644 index 000000000..623896c27 --- /dev/null +++ b/src/common/settings-vinyambar-murder.h @@ -0,0 +1,35 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. +*/ + +/* + * Contains defines for the "murder variant" game (vinyambar) . + * Include this file from settings.h to make eressea work. + */ +#define GAME_ID 0 +#define RESOURCE_CONVERSION 1 +#define NEW_RESOURCEGROWTH 1 +#define LARGE_CASTLES 1 +#define GROWING_TREES 1 +#define REMOVENMRNEWBIE 1 +#define NMRTIMEOUT 4 +#define HUNGER_DISABLES_LONGORDERS 1 +#define REDUCED_PEASANTGROWTH 1 +#define RACE_ADJUSTMENTS 1 +#define TEACHDIFFERENCE 2 +#define PEASANT_ADJUSTMENT 1 +#define SKILLPOINTS 0 +#define NEW_MIGRATION 1 +#define PEASANTS_DO_NOT_STARVE 0 + +#define VICTORY_CONDITION VICTORY_MURDER +#define VICTORY_DELAY 4 + diff --git a/src/corwin.mk b/src/corwin.mk index 524d435af..e4f0db164 100644 --- a/src/corwin.mk +++ b/src/corwin.mk @@ -5,6 +5,7 @@ endif # Hier definieren, damit nicht '@gcc' CC = gcc-3.0 -D_GNU_SOURCE +DEPEND = @gcc-3.0 -MM -MG -r # CC = gcc -D_GNU_SOURCE AR = ar CTAGS = ctags-exuberant diff --git a/src/res/de/messages.xml b/src/res/de/messages.xml index 44c8ca8cb..b827817b0 100644 --- a/src/res/de/messages.xml +++ b/src/res/de/messages.xml @@ -4535,7 +4535,7 @@ - "$faction($from) spendete $int($amount) Silber an $faction($to)." + "$faction($from) gibt $faction($to) ein Almosen von $int($amount) Silber."