forked from github/server
Neue messages, kompiliert, aber ein linker-error (NEW_MESSAGES)AT_OPTIONS define - solange option.h noch fehlt
This commit is contained in:
parent
c76a605b19
commit
b9f413f6fc
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: attributes.c,v 1.9 2001/02/28 18:25:23 corwin Exp $
|
||||
* $Id: attributes.c,v 1.10 2001/02/28 22:14:56 enno Exp $
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
|
@ -26,7 +26,9 @@
|
|||
#include "iceberg.h"
|
||||
#include "hate.h"
|
||||
#include "overrideroads.h"
|
||||
#include "option.h"
|
||||
#ifdef AT_OPTION
|
||||
# include "option.h"
|
||||
#endif
|
||||
|
||||
/* util includes */
|
||||
#include <attrib.h>
|
||||
|
@ -56,5 +58,7 @@ init_attributes(void)
|
|||
init_hate();
|
||||
/* at_reduceproduction */
|
||||
init_reduceproduction();
|
||||
#ifdef AT_OPTION
|
||||
init_option();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: laws.c,v 1.31 2001/02/28 18:31:49 corwin Exp $
|
||||
* $Id: laws.c,v 1.32 2001/02/28 22:14:56 enno Exp $
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
|
@ -64,8 +64,10 @@
|
|||
#include <goodies.h>
|
||||
#include <rand.h>
|
||||
|
||||
#ifdef AT_OPTION
|
||||
/* attributes includes */
|
||||
#include <attributes/option.h>
|
||||
#endif
|
||||
|
||||
/* libc includes */
|
||||
#include <stdio.h>
|
||||
|
@ -1692,7 +1694,7 @@ set_passw(void)
|
|||
case K_SEND:
|
||||
s = getstrtoken();
|
||||
o = findoption(s);
|
||||
|
||||
#ifdef AT_OPTION
|
||||
/* Sonderbehandlung Zeitungsoption */
|
||||
if (o == O_NEWS) {
|
||||
attrib *a = a_find(u->faction->attribs, &at_option_news);
|
||||
|
@ -1714,7 +1716,7 @@ set_passw(void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (o == -1) {
|
||||
cmistake(u, S->s, 135, MSG_EVENT);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: report.c,v 1.18 2001/02/28 18:25:24 corwin Exp $
|
||||
* $Id: report.c,v 1.19 2001/02/28 22:14:56 enno Exp $
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
|
@ -30,7 +30,9 @@
|
|||
|
||||
/* attributes includes */
|
||||
#include <attributes/overrideroads.h>
|
||||
#include <attributes/option.h>
|
||||
#ifdef AT_OPTION
|
||||
# include <attributes/option.h>
|
||||
#endif
|
||||
|
||||
/* gamecode includes */
|
||||
#include "creation.h"
|
||||
|
@ -738,13 +740,22 @@ rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean
|
|||
#endif
|
||||
while (m) {
|
||||
boolean debug = viewer->options & want(O_DEBUG);
|
||||
if (m->type->section!=category) continue;
|
||||
#ifdef MSG_LEVELS
|
||||
if (!debug && get_msglevel(viewer->warnings, viewer->msglevels, m->type) < m->level) continue;
|
||||
#endif
|
||||
/* messagetype * mt = m->type; */
|
||||
if (m->receiver==NULL || !viewer || viewer==m->receiver) {
|
||||
#ifdef NEW_MESSAGES
|
||||
if (strcmp(nr_section(m->msg), category->name)==0)
|
||||
#else
|
||||
if (m->receiver==NULL || !viewer || viewer==m->receiver)
|
||||
#endif
|
||||
{
|
||||
#ifdef OLD_MESSAGES
|
||||
const char * s = render(m, viewer->locale);
|
||||
#else
|
||||
char buf[4096], *s = buf;
|
||||
nr_render(m->msg, viewer->locale, s);
|
||||
#endif
|
||||
if (!k && categorized) {
|
||||
const char * name;
|
||||
char cat_identifier[24];
|
||||
|
@ -771,6 +782,7 @@ rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean
|
|||
strcpy(buf+indent, s);
|
||||
s = buf;
|
||||
}
|
||||
#ifdef MSG_LEVELS
|
||||
if (debug) {
|
||||
int mylevel = get_msglevel(viewer->warnings, viewer->msglevels, m->type);
|
||||
int level = msg_level(m);
|
||||
|
@ -778,6 +790,7 @@ rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean
|
|||
sprintf(buf+strlen(s), " [%d:%d(%d)]", m->type->hashkey, level, mylevel);
|
||||
s = buf;
|
||||
}
|
||||
#endif
|
||||
rpsnr(F, s, 2);
|
||||
}
|
||||
m=m->next;
|
||||
|
@ -1791,6 +1804,7 @@ report(FILE *F, faction * f)
|
|||
if (f->options & (int) pow(2, op)) {
|
||||
scat(" ");
|
||||
scat(options[op]);
|
||||
#ifdef AT_OPTION
|
||||
if(op == O_NEWS) {
|
||||
attrib *a = a_find(f->attribs, &at_option_news);
|
||||
if(!a) {
|
||||
|
@ -1810,6 +1824,7 @@ report(FILE *F, faction * f)
|
|||
scat(")");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
flag++;
|
||||
}
|
||||
}
|
||||
|
@ -3136,7 +3151,7 @@ writenewssubscriptions(void)
|
|||
sprintf(zText, "%s/news-subscriptions", basepath());
|
||||
F = cfopen(zText, "w");
|
||||
if (!F) return;
|
||||
|
||||
#ifdef AT_OPTION
|
||||
for(f=factions; f; f=f->next) {
|
||||
attrib *a = a_find(f->attribs, &at_option_news);
|
||||
if(!a) {
|
||||
|
@ -3145,6 +3160,7 @@ writenewssubscriptions(void)
|
|||
fprintf(F, "%s:%d\n", f->email, a->data.i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fclose(F);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
#ifndef ERESSEA_H
|
||||
#define ERESSEA_H
|
||||
|
||||
#ifndef NEW_MESSAGES
|
||||
#define MSG_LEVELS /* msg-levels wieder aktiviert */
|
||||
#define OLD_MESSAGES
|
||||
#define message_type messagetype
|
||||
#define message_list message
|
||||
#define report_section message
|
||||
#else
|
||||
#undef MSG_LEVELS
|
||||
#endif
|
||||
|
||||
#ifndef NEW_MESSAGES
|
||||
#define OLD_MESSAGES
|
||||
#define message_type messagetype
|
||||
|
@ -89,7 +99,6 @@ struct building_type;
|
|||
#define DAEMON_HUNGER /* Dämonen hungern, statt mit 10% in ihre sphäre zurückzukehren */
|
||||
#define NO_FOREST /* Es gibt keinen Terraintyp "Wald" mehr */
|
||||
#define NEW_RECEIPIES /* Vereinfachte, besser verteilte Kräuterzutaten für Tränke */
|
||||
#define MSG_LEVELS /* msg-levels wieder aktiviert */
|
||||
#define NEW_TRIGGER
|
||||
#undef OLD_TRIGGER /* leave active for compatibility until conversion is implemented */
|
||||
#define NEW_TAVERN
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: message.c,v 1.8 2001/02/24 12:50:48 enno Exp $
|
||||
* $Id: message.c,v 1.9 2001/02/28 22:14:57 enno Exp $
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
|
@ -308,7 +308,7 @@ parse_message(char * b, const struct locale * deflocale)
|
|||
|
||||
/* add the messagetype */
|
||||
mtype = mt_register(mt_new(name, args));
|
||||
nrt_register(mtype, lang, message);
|
||||
nrt_register(mtype, lang, message, level, section);
|
||||
crt_register(mtype, lang);
|
||||
}
|
||||
|
||||
|
@ -323,6 +323,12 @@ read_messages(FILE * F, const struct locale * lang)
|
|||
}
|
||||
|
||||
#else
|
||||
void
|
||||
addmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
|
||||
{
|
||||
caddmessage(r, f, gc_add(strdup(translate_regions(s, f))), mtype, level);
|
||||
}
|
||||
|
||||
void
|
||||
caddmessage(region * r, faction * f, char *s, msg_t mtype, int level)
|
||||
{
|
||||
|
@ -370,12 +376,6 @@ caddmessage(region * r, faction * f, char *s, msg_t mtype, int level)
|
|||
if (m) m->level = level;
|
||||
}
|
||||
|
||||
void
|
||||
addmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
|
||||
{
|
||||
caddmessage(r, f, gc_add(strdup(translate_regions(s, f))), mtype, level);
|
||||
}
|
||||
|
||||
static messagetype * messagetypes;
|
||||
|
||||
void
|
||||
|
|
|
@ -10,7 +10,7 @@ include $(ERESSEA)/Makefile.include
|
|||
|
||||
## more definitions
|
||||
|
||||
INCLUDES += -I../util -I../kernel -I../gamecode -I..
|
||||
INCLUDES += -I../gamecode -I../kernel -I../util -I..
|
||||
|
||||
# library:
|
||||
$(BUILD_DIR)/$(LIBRARY):: $(BUILD_DIR) $(OBJECTS)
|
||||
|
|
|
@ -10,7 +10,7 @@ include $(ERESSEA)/Makefile.include
|
|||
|
||||
## more definitions
|
||||
|
||||
INCLUDES += -I../util -I../kernel -I../gamecode
|
||||
INCLUDES += -I../gamecode -I../kernel -I../util
|
||||
|
||||
# library:
|
||||
$(BUILD_DIR)/$(LIBRARY):: $(BUILD_DIR) $(OBJECTS)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
$Id: message.c,v 1.1 2001/02/24 12:50:50 enno Exp $
|
||||
$Id: message.c,v 1.2 2001/02/28 22:14:58 enno Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -30,8 +30,8 @@ mt_new(const char * name, const char * args[])
|
|||
|
||||
mtype->name = strdup(name);
|
||||
mtype->nparameters = nparameters;
|
||||
mtype->pnames = (char**)malloc(sizeof(char*) * nparameters);
|
||||
mtype->types = (char**)malloc(sizeof(char*) * nparameters);
|
||||
mtype->pnames = (const char**)malloc(sizeof(char*) * nparameters);
|
||||
mtype->types = (const char**)malloc(sizeof(char*) * nparameters);
|
||||
for (i=0;args[i];++i) {
|
||||
const char * x = args[i];
|
||||
const char * spos = strchr(x, ':');
|
||||
|
@ -128,4 +128,4 @@ msg_free(message *m)
|
|||
{
|
||||
free((void*)m->parameters);
|
||||
free(m);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
$Id: nrmessage.c,v 1.2 2001/02/25 20:10:43 enno Exp $
|
||||
$Id: nrmessage.c,v 1.3 2001/02/28 22:14:59 enno Exp $
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -26,6 +26,8 @@ typedef struct nrmessage_type {
|
|||
const char * string;
|
||||
const char * vars;
|
||||
struct nrmessage_type * next;
|
||||
int level;
|
||||
const char * section;
|
||||
} nrmessage_type;
|
||||
|
||||
static nrmessage_type * messagetypes;
|
||||
|
@ -47,7 +49,7 @@ nrt_find(const struct locale * lang, const struct message_type * mtype)
|
|||
}
|
||||
|
||||
void
|
||||
nrt_register(const struct message_type * mtype, const struct locale * lang, const char * string)
|
||||
nrt_register(const struct message_type * mtype, const struct locale * lang, const char * string, int level, const char * section)
|
||||
{
|
||||
nrmessage_type * nrt = messagetypes;
|
||||
while (nrt && (nrt->lang!=lang || nrt->mtype!=mtype)) {
|
||||
|
@ -61,6 +63,8 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons
|
|||
nrt->lang = lang;
|
||||
nrt->mtype = mtype;
|
||||
nrt->next = messagetypes;
|
||||
nrt->level=level;
|
||||
nrt->section = strdup(section);
|
||||
messagetypes = nrt;
|
||||
nrt->string = strdup(string);
|
||||
for (i=0;i!=mtype->nparameters;++i) {
|
||||
|
@ -68,7 +72,7 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons
|
|||
c+= strlen(strcpy(c, mtype->pnames[i]));
|
||||
}
|
||||
nrt->vars = strdup(zNames);
|
||||
/* TODO: really necessary to strdup them all? here? better to extend va_translate! */
|
||||
/* TODO: really necessary to strdup them all? here? better to extend the caller? hash? */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,3 +88,17 @@ nr_render(const struct message * msg, const struct locale * lang, char * buffer)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
nr_level(const struct message *msg)
|
||||
{
|
||||
nrmessage_type * nrt = nrt_find(NULL, msg->type);
|
||||
return nrt->level;
|
||||
}
|
||||
|
||||
const char *
|
||||
nr_section(const struct message *msg)
|
||||
{
|
||||
nrmessage_type * nrt = nrt_find(NULL, msg->type);
|
||||
return nrt->section;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,11 @@ struct nrmessage_type;
|
|||
extern int nr_render(const struct message * msg, const struct locale * lang,
|
||||
char * buffer);
|
||||
extern void nrt_register(const struct message_type * mtype,
|
||||
const struct locale * lang, const char * script);
|
||||
const struct locale * lang, const char * script,
|
||||
int level, const char * section);
|
||||
|
||||
extern int nr_level(const struct message *msg);
|
||||
extern const char * nr_section(const struct message *msg);
|
||||
|
||||
/* before:
|
||||
* fogblock;movement:0;de;{unit} konnte von {region} nicht nach {$dir direction} ausreisen, der Nebel war zu dicht.
|
||||
|
|
|
@ -175,7 +175,7 @@ find_function(const char * symbol)
|
|||
}
|
||||
|
||||
static const char * parse(const char* in);
|
||||
static const char * sample = "\"enno and $bool($if($eq($i,0),\"noone else\",\"$i other people\"))\"";
|
||||
/* static const char * sample = "\"enno and $bool($if($eq($i,0),\"noone else\",\"$i other people\"))\""; */
|
||||
|
||||
static const char *
|
||||
parse_symbol(const char* in)
|
||||
|
|
Loading…
Reference in New Issue