- OPTION ZEITUNG implementiert. Noch nicht ganz fertig, ich überlege

noch, die Optionsmimik komplett umzustricken, um Optionen mit
	einem Parameter auch ohne Hack möglich zu machen.
- Neue Spezialeigenschaft FS_UNDEAD. Wir sollten dringend darüber
	nachdenken, bestimmte Eigenschaften von Einheiten (etwa
	Untot-sein) besser zu generalisieren, so gibt es andauernd
	Inkonsistenzen.
This commit is contained in:
Christian Schlittchen 2001-02-28 18:25:25 +00:00
parent c5cd0ff666
commit 867d0f85ff
8 changed files with 94 additions and 25 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: attributes.c,v 1.8 2001/02/18 12:20:20 enno Exp $ * $Id: attributes.c,v 1.9 2001/02/28 18:25:23 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -26,6 +26,7 @@
#include "iceberg.h" #include "iceberg.h"
#include "hate.h" #include "hate.h"
#include "overrideroads.h" #include "overrideroads.h"
#include "option.h"
/* util includes */ /* util includes */
#include <attrib.h> #include <attrib.h>
@ -55,4 +56,5 @@ init_attributes(void)
init_hate(); init_hate();
/* at_reduceproduction */ /* at_reduceproduction */
init_reduceproduction(); init_reduceproduction();
init_option();
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: laws.c,v 1.29 2001/02/25 19:31:38 enno Exp $ * $Id: laws.c,v 1.30 2001/02/28 18:25:24 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -64,6 +64,9 @@
#include <goodies.h> #include <goodies.h>
#include <rand.h> #include <rand.h>
/* attributes includes */
#include <attributes/option.h>
/* libc includes */ /* libc includes */
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
@ -1689,6 +1692,27 @@ set_passw(void)
case K_SEND: case K_SEND:
s = getstrtoken(); s = getstrtoken();
o = findoption(s); o = findoption(s);
/* Sonderbehandlung Zeitungsoption */
if (o == O_NEWS) {
attrib *a = a_find(u->faction->attribs, &at_option_news);
if(a) a->data.i = 0;
while((s = getstrtoken())) {
if(findparam(s) == P_NOT) {
a_removeall(&u->faction->attribs, &at_option_news);
break;
} else {
int sec = atoi(s);
if(sec != 0) {
if(!a) a_add(&u->faction->attribs, a_new(&at_option_news));
a->data.i = a->data.i & (1<<(sec-1));
}
}
}
break;
}
if (o == -1) { if (o == -1) {
cmistake(u, S->s, 135, MSG_EVENT); cmistake(u, S->s, 135, MSG_EVENT);
} else { } else {
@ -2791,7 +2815,7 @@ monthly_healing(void)
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
int umhp; int umhp;
if((race[u->race].flags & RCF_NOHEAL) || fval(u, FL_HUNGER)) if((race[u->race].flags & RCF_NOHEAL) || fval(u, FL_HUNGER) || fspecial(u->faction, FS_UNDEAD))
continue; continue;
if(rterrain(r) == T_OCEAN && !u->ship && !(race[u->race].flags & RCF_SWIM)) if(rterrain(r) == T_OCEAN && !u->ship && !(race[u->race].flags & RCF_SWIM))

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: report.c,v 1.17 2001/02/24 12:50:47 enno Exp $ * $Id: report.c,v 1.18 2001/02/28 18:25:24 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -30,6 +30,7 @@
/* attributes includes */ /* attributes includes */
#include <attributes/overrideroads.h> #include <attributes/overrideroads.h>
#include <attributes/option.h>
/* gamecode includes */ /* gamecode includes */
#include "creation.h" #include "creation.h"
@ -1790,6 +1791,25 @@ report(FILE *F, faction * f)
if (f->options & (int) pow(2, op)) { if (f->options & (int) pow(2, op)) {
scat(" "); scat(" ");
scat(options[op]); scat(options[op]);
if(op == O_NEWS) {
attrib *a = a_find(f->attribs, &at_option_news);
if(!a) {
/* Zur Altlastenbeseitigung */
f->options = f->options & ~op;
} else {
int sec = a->data.i;
int i;
scat("(");
for(i=1; sec != 0; i *= 2) {
if(sec & i) {
icat(i);
sec = sec & ~i;
if(sec) scat(",");
}
}
scat(")");
}
}
flag++; flag++;
} }
} }
@ -3098,8 +3118,6 @@ writeadresses(void)
F = cfopen(zText, "w"); F = cfopen(zText, "w");
if (!F) return; if (!F) return;
/* adressen liste */
for (f = factions; f; f = f->next) { for (f = factions; f; f = f->next) {
if (f->no != MONSTER_FACTION) { if (f->no != MONSTER_FACTION) {
fprintf(F, "%s:%s:%s\n", factionname(f), f->email, f->banner); fprintf(F, "%s:%s:%s\n", factionname(f), f->email, f->banner);
@ -3108,6 +3126,28 @@ writeadresses(void)
fclose(F); fclose(F);
} }
static void
writenewssubscriptions(void)
{
char zText[MAX_PATH];
FILE *F;
faction *f;
sprintf(zText, "%s/news-subscriptions", basepath());
F = cfopen(zText, "w");
if (!F) return;
for(f=factions; f; f=f->next) {
attrib *a = a_find(f->attribs, &at_option_news);
if(!a) {
fprintf(F, "%s:0\n", f->email);
} else {
fprintf(F, "%s:%d\n", f->email, a->data.i);
}
}
fclose(F);
}
static void static void
writeforward(void) writeforward(void)
{ {
@ -3258,6 +3298,7 @@ report_summary(summary * s, summary * o, boolean full)
#endif #endif
printf("Schreibe Liste der Adressen (adressen)...\n"); printf("Schreibe Liste der Adressen (adressen)...\n");
writeadresses(); writeadresses();
writenewssubscriptions();
writeforward(); writeforward();
{ {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: eressea.c,v 1.23 2001/02/25 19:31:39 enno Exp $ * $Id: eressea.c,v 1.24 2001/02/28 18:25:24 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -240,7 +240,7 @@ const char *options[MAXOPTIONS] =
"STATISTIK", "STATISTIK",
"DEBUG", "DEBUG",
"ZIPPED", "ZIPPED",
"MERIAN", "ZEITUNG", /* Option hat Sonderbehandlung! */
"MATERIALPOOL", "MATERIALPOOL",
"ADRESSEN", "ADRESSEN",
"BZIP2", "BZIP2",

View File

@ -528,7 +528,7 @@ enum {
O_STATISTICS, /* 16 */ O_STATISTICS, /* 16 */
O_DEBUG, /* 32 */ O_DEBUG, /* 32 */
O_COMPRESS, /* 64 */ O_COMPRESS, /* 64 */
O_MERIAN, /* 128 */ O_NEWS, /* 128 */
O_MATERIALPOOL, /* 256 */ O_MATERIALPOOL, /* 256 */
O_ADRESSEN, /* 512 */ O_ADRESSEN, /* 512 */
O_BZIP2, /* 1024 - crkurz compatible flag */ O_BZIP2, /* 1024 - crkurz compatible flag */

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: karma.c,v 1.2 2001/01/26 16:19:39 enno Exp $ * $Id: karma.c,v 1.3 2001/02/28 18:25:25 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -238,6 +238,15 @@ struct fspecialdata fspecials[MAXFACTIONSPECIALS] = {
"Ein einmal erklärter Jihad kann nicht wieder rückgängig gemacht " "Ein einmal erklärter Jihad kann nicht wieder rückgängig gemacht "
"werden.", "werden.",
true true
},
/* TODO: is_undead() und Sonderbehandlungen von Untoten */
{
"Untot",
"Personen einer Partei mit dieser Eigenschaft bekommen automatisch doppelt "
"soviele Trefferpunkte wie normale Angehörige der entsprechenden Rasse, "
"verlieren jedoch ihre Fähigkeit zur Regeneration erlittenen Schadens "
"komplett.",
false
} }
}; };

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: karma.h,v 1.2 2001/01/26 16:19:39 enno Exp $ * $Id: karma.h,v 1.3 2001/02/28 18:25:25 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -34,6 +34,7 @@ typedef enum {
FS_MAGICIMMUNE, FS_MAGICIMMUNE,
FS_VARIEDMAGIC, FS_VARIEDMAGIC,
FS_JIHAD, FS_JIHAD,
FS_UNDEAD,
MAXFACTIONSPECIALS MAXFACTIONSPECIALS
} fspecial_t; } fspecial_t;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: race.c,v 1.7 2001/02/24 12:50:48 enno Exp $ * $Id: race.c,v 1.8 2001/02/28 18:25:25 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -39,6 +39,7 @@
#include "pathfinder.h" #include "pathfinder.h"
#include "ship.h" #include "ship.h"
#include "skill.h" #include "skill.h"
#include "karma.h"
/* util includes */ /* util includes */
#include <attrib.h> #include <attrib.h>
@ -1898,19 +1899,10 @@ unit_max_hp(const unit * u)
p = pow(effskill(u, SK_AUSDAUER) / 2.0, 1.5) * 0.2; p = pow(effskill(u, SK_AUSDAUER) / 2.0, 1.5) * 0.2;
h += (int) (h * p + 0.5); h += (int) (h * p + 0.5);
return h; if(fspecial(u->faction, FS_UNDEAD)) {
h *= 2;
} }
int
unit_old_max_hp(unit * u)
{
int h;
double p;
h = race[u->race].hitpoints / 2;
p = pow(effskill(u, SK_AUSDAUER) / 2.0, 1.5) * 0.2;
h += (int) (h * p + 0.5);
return h; return h;
} }