mapper kompiliert wieder. neue messages kompilieren und linken

This commit is contained in:
Enno Rehling 2001-02-28 23:28:55 +00:00
parent b9f413f6fc
commit 2ccf6631e5
7 changed files with 217 additions and 199 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: eressea.c,v 1.24 2001/02/28 18:25:24 corwin Exp $ * $Id: eressea.c,v 1.25 2001/02/28 23:28:53 enno 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)
@ -56,7 +56,9 @@
#include <base36.h> #include <base36.h>
#include <event.h> #include <event.h>
#include <umlaut.h> #include <umlaut.h>
#ifdef NEW_MESSAGES
# include <translation.h>
#endif
/* libc includes */ /* libc includes */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -1851,7 +1853,11 @@ kernel_done(void)
/* calling this function releases memory assigned to static variables, etc. /* calling this function releases memory assigned to static variables, etc.
* calling it is optional, e.g. a release server will most likely not do it. * calling it is optional, e.g. a release server will most likely not do it.
*/ */
#ifdef OLD_MESSAGES
render_cleanup(); render_cleanup();
#else
translation_done();
#endif
skill_done(); skill_done();
gc_done(); gc_done();
} }
@ -1859,6 +1865,30 @@ kernel_done(void)
extern void attrib_init(void); extern void attrib_init(void);
extern void render_init(void); extern void render_init(void);
void
read_strings(FILE * F)
{
char rbuf[8192];
while (fgets(rbuf, sizeof(rbuf), F)) {
char * b = rbuf;
locale * lang;
char * key = b;
char * language;
if (rbuf[0]=='#') continue;
rbuf[strlen(rbuf)-1] = 0; /* \n weg */
while (*b && *b!=';') ++b;
if (!*b) continue;
*b++ = 0;
language = b;
while (*b && *b!=';') ++b;
*b++ = 0;
lang = find_locale(language);
if (!lang) lang = make_locale(language);
locale_setstring(lang, key, b);
}
}
void void
kernel_init(void) kernel_init(void)
{ {
@ -1866,7 +1896,11 @@ kernel_init(void)
skill_init(); skill_init();
attrib_init(); attrib_init();
init_locales(); init_locales();
#ifdef OLD_MESSAGES
render_init(); render_init();
#else
translation_init();
#endif
if (!turn) turn = lastturn(); if (!turn) turn = lastturn();
if (turn == 0) if (turn == 0)
srand(time((time_t *) NULL)); srand(time((time_t *) NULL));

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: message.c,v 1.9 2001/02/28 22:14:57 enno Exp $ * $Id: message.c,v 1.10 2001/02/28 23:28:54 enno 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)
@ -307,7 +307,7 @@ parse_message(char * b, const struct locale * deflocale)
args[i] = NULL; args[i] = NULL;
/* add the messagetype */ /* add the messagetype */
mtype = mt_register(mt_new(name, args)); mtype = mt_register(mt_new(name, (const char**)args));
nrt_register(mtype, lang, message, level, section); nrt_register(mtype, lang, message, level, section);
crt_register(mtype, lang); crt_register(mtype, lang);
} }
@ -322,7 +322,8 @@ read_messages(FILE * F, const struct locale * lang)
} }
} }
#else #endif
void void
addmessage(region * r, faction * f, const char *s, msg_t mtype, int level) addmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
{ {
@ -373,11 +374,11 @@ caddmessage(region * r, faction * f, char *s, msg_t mtype, int level)
default: default:
fprintf(stderr, "Warnung: Ungültige Msg-Klasse!"); fprintf(stderr, "Warnung: Ungültige Msg-Klasse!");
} }
#ifdef OLD_MESSAGES
if (m) m->level = level; if (m) m->level = level;
#endif
} }
static messagetype * messagetypes;
void void
xmistake(const unit * u, const char *s, const char *comment, int mtype) xmistake(const unit * u, const char *s, const char *comment, int mtype)
{ {
@ -417,6 +418,9 @@ old_hashstring(const char* s)
} }
#ifdef OLD_MESSAGES
static messagetype * messagetypes;
void void
debug_messagetypes(FILE * out) debug_messagetypes(FILE * out)
{ {
@ -582,6 +586,13 @@ get_msglevel(const struct warning * warnings, const msglevel * levels, const mes
return 0x7F; return 0x7F;
} }
int
msg_level(const message * m)
{
return m->level;
}
#endif
void void
set_msglevel(struct warning ** warnings, const char * type, int level) set_msglevel(struct warning ** warnings, const char * type, int level)
{ {
@ -603,13 +614,6 @@ set_msglevel(struct warning ** warnings, const char * type, int level)
} }
} }
int
msg_level(const message * m)
{
return m->level;
}
#endif /* NEW_MESSAGES */
message * message *
add_message(message_list** pm, message * m) add_message(message_list** pm, message * m)
{ {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: render.c,v 1.7 2001/02/24 12:50:48 enno Exp $ * $Id: render.c,v 1.8 2001/02/28 23:28:54 enno 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)
@ -129,31 +129,6 @@ add_evalfun(const char * name, localizer * l, eval_fun fun)
else assert(!strcmp(find->name, name)); else assert(!strcmp(find->name, name));
} }
char rbuf[8192];
void
read_strings(FILE * F)
{
while (fgets(rbuf, 8192, F)) {
char * b = rbuf;
locale * lang;
char * key = b;
char * language;
if (rbuf[0]=='#') continue;
rbuf[strlen(rbuf)-1] = 0; /* \n weg */
while (*b && *b!=';') ++b;
if (!*b) continue;
*b++ = 0;
language = b;
while (*b && *b!=';') ++b;
*b++ = 0;
lang = find_locale(language);
if (!lang) lang = make_locale(language);
locale_setstring(lang, key, b);
}
}
void void
render_cleanup(void) render_cleanup(void)
{ {
@ -239,6 +214,8 @@ v_dir(const locale * l, void * data) {
return locale_string(l, dres[i]); return locale_string(l, dres[i]);
} }
static char rbuf[8192];
static char * static char *
render_immediate(const message * m, const char * find, localizer * l) render_immediate(const message * m, const char * find, localizer * l)
{ {
@ -579,159 +556,4 @@ read_messages(FILE * F, const struct locale * deflocale)
} }
} }
#include "skill.h"
#include "magic.h"
void
spy_message(int spy, unit *u, unit *target)
{
const char *c;
region * r = u->region;
if (spy < 0) {
sprintf(buf, "%s konnte nichts über ", unitname(u));
scat(unitname(target));
scat(" herausbekommen.");
addmessage(r, u->faction, buf, MSG_EVENT, ML_WARN);
} else if (spy == 0) {
sprintf(buf, "%s gelang es, Informationen über ", unitname(u));
scat(unitname(target));
scat(" herausbekommen: Partei '");
scat(factionname(target->faction));
scat("', Talente: ");
change_skill(u, SK_SPY, PRODUCEEXP / 2);
{
int first = 1;
int found = 0;
skill_t sk;
for (sk = 0; sk != MAXSKILLS; sk++) {
if (get_skill(target, sk)) {
found++;
if (first == 1) {
first = 0;
} else {
scat(", ");
}
scat(skillnames[sk]);
}
}
if (found == 0) {
scat("Keine");
}
}
scat(".");
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
/* Spionage > Wahrnehmung:
* Talente mit Werten, Gegenstände und Kampfstatus */
} else if (spy > 0) {
sprintf(buf, "%s gelang es, Informationen über ", unitname(u));
scat(unitname(target));
scat(" herauszubekommen: Partei '");
scat(factionname(target->faction));
scat("', Talente: ");
change_skill(u, SK_SPY, PRODUCEEXP);
{
int first = 1;
int found = 0;
skill_t sk;
for (sk = 0; sk != MAXSKILLS; sk++) {
if (get_skill(target, sk)) {
found++;
if (first == 1) {
first = 0;
} else {
scat(", ");
}
scat(skillnames[sk]);
scat(" ");
icat(eff_skill(target, sk, target->region));
}
}
if (found == 0) {
scat("Keine");
}
}
scat("; Kampfstatus: ");
scat(report_kampfstatus(target) + 2);
c = hp_status(target);
if (c && strlen(c))
sprintf(buf, "%s (%s)", buf, c);
scat("; ");
icat(get_money(target));
scat(" Silber;");
scat(" Im Gepäck sind");
{
boolean first = true;
int found = 0;
item * itm;
for (itm=target->items;itm;itm=itm->next) {
if (itm->number>0) {
resource_type * rtype = itm->type->rtype;
++found;
if (first) {
first = false;
scat(": ");
} else {
scat(", ");
}
if (itm->number == 1) {
scat("1 ");
scat(locale_string(u->faction->locale, resourcename(rtype, 0)));
} else {
icat(itm->number);
scat(" ");
scat(locale_string(u->faction->locale, resourcename(rtype, NMF_PLURAL)));
}
}
}
if (found == 0) {
scat(" keine verborgenen Gegenstände");
}
scat(".");
}
/* magische Spionage:
* zusätzlich Magiegebiet und Zauber */
if (spy > 1){
if (eff_skill(target, SK_MAGIC, target->region) > 0){
spell_ptr *spt;
spell *sp;
int first = 1;
int found = 0;
scat(" Magiegebiet: ");
scat(magietypen[find_magetype(target)]);
if (get_mage(target)) {
scat(", Sprüche: ");
for (spt = get_mage(target)->spellptr;spt; spt = spt->next){
sp = find_spellbyid(spt->spellid);
found++;
if (first == 1){
first = 0;
} else {
scat(", ");
}
scat(sp->name);
}
if (found == 0) {
scat("Keine");
}
}
}
}
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
}
}
#endif #endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: reports.c,v 1.6 2001/02/19 14:19:24 corwin Exp $ * $Id: reports.c,v 1.7 2001/02/28 23:28:54 enno 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)
@ -22,6 +22,8 @@
#include "eressea.h" #include "eressea.h"
#include "reports.h" #include "reports.h"
/* kernel includes */
#include "skill.h"
#include "unit.h" #include "unit.h"
#include "item.h" #include "item.h"
#include "group.h" #include "group.h"
@ -483,3 +485,157 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden
assert(SP); assert(SP);
lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-'))); lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-')));
} }
void
spy_message(int spy, unit *u, unit *target)
{
const char *c;
struct region * r = u->region;
if (spy < 0) {
sprintf(buf, "%s konnte nichts über ", unitname(u));
scat(unitname(target));
scat(" herausbekommen.");
addmessage(r, u->faction, buf, MSG_EVENT, ML_WARN);
} else if (spy == 0) {
sprintf(buf, "%s gelang es, Informationen über ", unitname(u));
scat(unitname(target));
scat(" herausbekommen: Partei '");
scat(factionname(target->faction));
scat("', Talente: ");
change_skill(u, SK_SPY, PRODUCEEXP / 2);
{
int first = 1;
int found = 0;
skill_t sk;
for (sk = 0; sk != MAXSKILLS; sk++) {
if (get_skill(target, sk)) {
found++;
if (first == 1) {
first = 0;
} else {
scat(", ");
}
scat(skillnames[sk]);
}
}
if (found == 0) {
scat("Keine");
}
}
scat(".");
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
/* Spionage > Wahrnehmung:
* Talente mit Werten, Gegenstände und Kampfstatus */
} else if (spy > 0) {
sprintf(buf, "%s gelang es, Informationen über ", unitname(u));
scat(unitname(target));
scat(" herauszubekommen: Partei '");
scat(factionname(target->faction));
scat("', Talente: ");
change_skill(u, SK_SPY, PRODUCEEXP);
{
int first = 1;
int found = 0;
skill_t sk;
for (sk = 0; sk != MAXSKILLS; sk++) {
if (get_skill(target, sk)) {
found++;
if (first == 1) {
first = 0;
} else {
scat(", ");
}
scat(skillnames[sk]);
scat(" ");
icat(eff_skill(target, sk, target->region));
}
}
if (found == 0) {
scat("Keine");
}
}
scat("; Kampfstatus: ");
scat(report_kampfstatus(target) + 2);
c = hp_status(target);
if (c && strlen(c))
sprintf(buf, "%s (%s)", buf, c);
scat("; ");
icat(get_money(target));
scat(" Silber;");
scat(" Im Gepäck sind");
{
boolean first = true;
int found = 0;
item * itm;
for (itm=target->items;itm;itm=itm->next) {
if (itm->number>0) {
resource_type * rtype = itm->type->rtype;
++found;
if (first) {
first = false;
scat(": ");
} else {
scat(", ");
}
if (itm->number == 1) {
scat("1 ");
scat(locale_string(u->faction->locale, resourcename(rtype, 0)));
} else {
icat(itm->number);
scat(" ");
scat(locale_string(u->faction->locale, resourcename(rtype, NMF_PLURAL)));
}
}
}
if (found == 0) {
scat(" keine verborgenen Gegenstände");
}
scat(".");
}
/* magische Spionage:
* zusätzlich Magiegebiet und Zauber */
if (spy > 1){
if (eff_skill(target, SK_MAGIC, target->region) > 0){
spell_ptr *spt;
spell *sp;
int first = 1;
int found = 0;
scat(" Magiegebiet: ");
scat(magietypen[find_magetype(target)]);
if (get_mage(target)) {
scat(", Sprüche: ");
for (spt = get_mage(target)->spellptr;spt; spt = spt->next){
sp = find_spellbyid(spt->spellid);
found++;
if (first == 1){
first = 0;
} else {
scat(", ");
}
scat(sp->name);
}
if (found == 0) {
scat("Keine");
}
}
}
}
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
}
}

View File

@ -24,7 +24,7 @@ typedef struct message {
const void ** parameters; const void ** parameters;
} message; } message;
extern struct message_type * mt_new(const char * name, const char * args[]); extern struct message_type * mt_new(const char * name, const char ** args);
extern struct message_type * mt_new_va(const char * name, ...); extern struct message_type * mt_new_va(const char * name, ...);
/* mt_new("simple_sentence", "subject:string", "predicate:string", /* mt_new("simple_sentence", "subject:string", "predicate:string",
* "object:string", "lang:locale", NULL); */ * "object:string", "lang:locale", NULL); */

View File

@ -4,6 +4,8 @@
#CONVERT_TRIGGERS = 1 #CONVERT_TRIGGERS = 1
CFLAGS += -DNEW_MESSAGES
LD=gcc LD=gcc
AR=ar AR=ar
CC=@colorgcc CC=@colorgcc

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_partei.c,v 1.4 2001/02/09 13:53:53 corwin Exp $ * $Id: map_partei.c,v 1.5 2001/02/28 23:28:55 enno 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)
@ -318,7 +318,7 @@ addplayer(region *r, char *email, race_t frace)
set_ursprung(f, 0, r->x, r->y); set_ursprung(f, 0, r->x, r->y);
f->options = Pow(O_REPORT) | Pow(O_STATISTICS) | Pow(O_ZUGVORLAGE) | f->options = Pow(O_REPORT) | Pow(O_STATISTICS) | Pow(O_ZUGVORLAGE) |
Pow(O_SILBERPOOL) | Pow(O_MERIAN); Pow(O_SILBERPOOL);
f->no = unused_faction_id(); f->no = unused_faction_id();
register_faction_id(f->no); register_faction_id(f->no);