* OLD_TRIGGERS entfernt

* CONVERT_SKILLPOINTS entfernt - wird jetzt beim laden gemacht
* Neue Funktion change_level()
* Bugfixes Rekrutierung
* Neue Option --noreports
* Bugfix negative Talente
* Konvertierung AT_DRAIN
* Neue Save-Version
* Bugfixes save.c, kaputtes Datenfile
* Skillpoint-Konvertierung beim Laden
* wspace() Funktion eliminiert
* sk_find crasht nicht mehr bei Nullpointern
* Endlosschleife gefixt
* Einheiten mergen
* learn_skill implementeiert.
* Eternath Koordinaten-Bugfix
* Neue Funktion change_level()
* Mapper angepasst
This commit is contained in:
Enno Rehling 2002-02-16 10:37:18 +00:00
parent 1aa45368a5
commit fc079d4394
29 changed files with 205 additions and 489 deletions

View File

@ -18,10 +18,6 @@
#include <config.h> #include <config.h>
#include <eressea.h> #include <eressea.h>
#ifndef NEW_TRIGGER
# error "new triggers not activated"
#endif
/* triggers includes */ /* triggers includes */
#include <triggers/changefaction.h> #include <triggers/changefaction.h>
#include <triggers/changerace.h> #include <triggers/changerace.h>

View File

@ -240,6 +240,19 @@ expandorders(region * r, request * requests)
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static void
change_level(unit * u, skill_t sk, int bylevel)
{
skill * sv = get_skill(u, sk);
assert(bylevel>0);
if (sv==0) set_skill(u, sk, bylevel, 0);
else {
sv->level = (unsigned char)(sv->level+bylevel);
sv->learning = 0;
}
}
static void static void
expandrecruit(region * r, request * recruitorders) expandrecruit(region * r, request * recruitorders)
{ {
@ -322,16 +335,19 @@ expandrecruit(region * r, request * recruitorders)
change_level(unew, SK_AUSDAUER, i); change_level(unew, SK_AUSDAUER, i);
} }
if (unew!=u) { if (unew!=u) {
faction * f = u->faction;
unit ** up=&u->next; unit ** up=&u->next;
transfermen(unew, u, unew->number); transfermen(unew, u, unew->number);
while (*up!=unew) up=&(*up)->next; while (*up!=unew) up=&(*up)->next;
assert(unew->next==NULL); assert(unew->next==NULL);
*up = NULL; *up = NULL;
if (f->units==unew) f->units = unew->nextF;
uunhash(unew);
free(unew); free(unew);
} }
if (u->n < u->wants) { if (u->n < u->wants) {
ADDMSG(&unew->faction->msgs, msg_message("recruit", ADDMSG(&u->faction->msgs, msg_message("recruit",
"unit region amount want", unew, r, u->n, u->wants)); "unit region amount want", u, r, u->n, u->wants));
} }
} }
} }

View File

@ -26,10 +26,6 @@
#include <modules/gmcmd.h> #include <modules/gmcmd.h>
#include <modules/infocmd.h> #include <modules/infocmd.h>
#ifdef OLD_TRIGGER
# include "old/trigger.h"
#endif
/* gamecode includes */ /* gamecode includes */
#include "creation.h" #include "creation.h"
#include "economy.h" #include "economy.h"
@ -107,9 +103,6 @@ destroyfaction(faction * f)
faction *ff; faction *ff;
if( !f->alive ) return; if( !f->alive ) return;
#ifdef OLD_TRIGGER
do_trigger(f, TYP_FACTION, TR_DESTRUCT);
#endif
for (u=f->units;u;u=u->nextF) { for (u=f->units;u;u=u->nextF) {
region * r = u->region; region * r = u->region;
@ -173,12 +166,7 @@ destroyfaction(faction * f)
set_number(u, 0); set_number(u, 0);
} }
f->alive = 0; f->alive = 0;
#ifdef NEW_TRIGGER
handle_event(&f->attribs, "destroy", f); handle_event(&f->attribs, "destroy", f);
#endif
#ifdef OLD_TRIGGER
change_all_pointers(f, TYP_FACTION, NULL);
#endif
for (ff = factions; ff; ff = ff->next) { for (ff = factions; ff; ff = ff->next) {
group *g; group *g;
ally *sf, *sfn; ally *sf, *sfn;
@ -2913,10 +2901,6 @@ ageing(void)
if (b==*bp) bp = &(*bp)->next; if (b==*bp) bp = &(*bp)->next;
} }
} }
#ifdef OLD_TRIGGER
/* timeouts */
countdown_timeouts();
#endif
} }
static int static int

View File

@ -87,6 +87,7 @@ extern int quiet;
boolean nocr = false; boolean nocr = false;
boolean nonr = false; boolean nonr = false;
boolean nomer = false; boolean nomer = false;
boolean noreports = false;
/* /*
* ------------------------------------------------------------- * -------------------------------------------------------------

View File

@ -652,12 +652,13 @@ learn(void)
change_skill(u, (skill_t)i, days); change_skill(u, (skill_t)i, days);
#else #else
while (days) { while (days) {
if (days>u->number*30) { if (days>=u->number*30) {
learn_skill(u, (skill_t)i, 1.0); learn_skill(u, (skill_t)i, 1.0);
days -= u->number*30; days -= u->number*30;
} else { } else {
double chance = (double)days/u->number/30; double chance = (double)days/u->number/30;
learn_skill(u, (skill_t)i, chance); learn_skill(u, (skill_t)i, chance);
days = 0;
} }
} }
#endif #endif

View File

@ -680,7 +680,7 @@ weapon_skill(const weapon_type * wtype, const unit * u, boolean attacking)
if (wtype==NULL) { if (wtype==NULL) {
skill = effskill(u, SK_WEAPONLESS); skill = effskill(u, SK_WEAPONLESS);
if (skill==0) { if (skill<=0) {
/* wenn kein waffenloser kampf, dann den rassen-defaultwert */ /* wenn kein waffenloser kampf, dann den rassen-defaultwert */
if(u->race == new_race[RC_URUK]) { if(u->race == new_race[RC_URUK]) {
int sword = effskill(u, SK_SWORD); int sword = effskill(u, SK_SWORD);
@ -989,7 +989,16 @@ drain_exp(unit *u, int n)
} }
} }
if (sk != NOSKILL) { if (sk != NOSKILL) {
change_skillpoints(u, sk, -n); skill * sv = get_skill(u, sk);
while (n>0) {
if (n>=30*u->number) {
reduce_skill(sv, 1);
n-=30;
} else {
if (rand()%(30*u->number)<n) reduce_skill(sv, 1);
n = 0;
}
}
} }
} }
#endif #endif

View File

@ -22,10 +22,6 @@
#include "eressea.h" #include "eressea.h"
#include "build.h" #include "build.h"
#ifdef OLD_TRIGGER
#include <old/trigger.h>
#endif
/* kernel includes */ /* kernel includes */
#include "alchemy.h" #include "alchemy.h"
#include "border.h" #include "border.h"
@ -296,7 +292,7 @@ destroy_road(unit *u, int n, const char *cmd)
#if 0 #if 0
int salvage, divy = 2; int salvage, divy = 2;
#endif #endif
int willdo = min(n, (1+get_skill(u, SK_ROAD_BUILDING))*u->number); int willdo = min(n, eff_skill(u, SK_ROAD_BUILDING, r)*u->number);
int road = rroad(r, d); int road = rroad(r, d);
region * r2 = rconnect(r,d); region * r2 = rconnect(r,d);
willdo = min(willdo, road); willdo = min(willdo, road);
@ -513,7 +509,7 @@ build_road(region * r, unit * u, int size, direction_t d)
scale_number(u,u->number - golemsused); scale_number(u,u->number - golemsused);
} else { } else {
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */ /* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
change_skill(u, SK_ROAD_BUILDING, min(n, u->number) * PRODUCEEXP); produceexp(u, SK_ROAD_BUILDING, min(n, u->number));
} }
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "buildroad%r:region%u:unit%i:size", r, u, n)); u->faction, "buildroad%r:region%u:unit%i:size", r, u, n));
@ -696,7 +692,7 @@ build(unit * u, const construction * ctype, int completed, int want)
completed = completed + n; completed = completed + n;
} }
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */ /* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
change_skill(u, ctype->skill, min(made, u->number) * PRODUCEEXP); produceexp(u, ctype->skill, min(made, u->number));
return made; return made;
} }
@ -853,7 +849,7 @@ build_building(unit * u, const building_type * btype, int want)
if( want == INT_MAX ) if( want == INT_MAX )
sprintf(buffer, "%s %s %s", locale_string(u->faction->locale, keywords[K_MAKE]), string2, buildingid(b)); sprintf(buffer, "%s %s %s", locale_string(u->faction->locale, keywords[K_MAKE]), string2, buildingid(b));
else if( want-built <= 0 ) else if( want-built <= 0 )
strcpy(buffer, locale_string(u->faction->locale, keywords[K_WORK])); strcpy(buffer, locale_string(u->faction->locale, "defaultorder"));
else else
sprintf(buffer, "%s %d %s %s", locale_string(u->faction->locale, keywords[K_MAKE]), want-built, string2, buildingid(b)); sprintf(buffer, "%s %d %s %s", locale_string(u->faction->locale, keywords[K_MAKE]), want-built, string2, buildingid(b));
set_string(&u->lastorder, buffer); set_string(&u->lastorder, buffer);

View File

@ -954,9 +954,6 @@ destroy_building(building * b)
unit *u; unit *u;
if(!bfindhash(b->no)) return; if(!bfindhash(b->no)) return;
#ifdef OLD_TRIGGER
do_trigger(b, TYP_BUILDING, TR_DESTRUCT);
#endif
for(u=b->region->units; u; u=u->next) { for(u=b->region->units; u; u=u->next) {
if(u->building == b) leave(b->region, u); if(u->building == b) leave(b->region, u);
} }
@ -965,9 +962,6 @@ destroy_building(building * b)
if (b->type == &bt_lighthouse) update_lighthouse(b); if (b->type == &bt_lighthouse) update_lighthouse(b);
bunhash(b); bunhash(b);
#ifdef OLD_TRIGGER
change_all_pointers(b, TYP_BUILDING, NULL);
#endif
#if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */ #if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */
removelist(&b->region->buildings, b); removelist(&b->region->buildings, b);
#endif #endif

View File

@ -539,10 +539,20 @@ sp_mindblast(fighter * fi, int level, int power, spell * sp)
sk = random_skill(du); sk = random_skill(du);
if (sk != NOSKILL) { if (sk != NOSKILL) {
/* Skill abziehen */ /* Skill abziehen */
int n = 30+rand()%61;
#if SKILLPOINTS #if SKILLPOINTS
change_skill(du, sk, -(30+rand()%61)); change_skill(du, sk, -n);
#else #else
change_skillpoints(du, sk, -(30+rand()%61)); skill * sv = get_skill(du, sk);
while (n>0) {
if (n>=30*du->number) {
reduce_skill(sv, 1);
n-=30;
} else {
if (rand()%(30*du->number)<n) reduce_skill(sv, 1);
n = 0;
}
}
#endif #endif
--enemies; --enemies;
} else { } else {

View File

@ -494,9 +494,6 @@ stripunit(unit * u)
i_free(u->items); i_free(u->items);
u->items = it; u->items = it;
} }
#ifdef OLD_TRIGGER
change_all_pointers(u, TYP_UNIT, NULL); /* vor Zerstoeren der Attribs! */
#endif
while (u->attribs) a_remove (&u->attribs, u->attribs); while (u->attribs) a_remove (&u->attribs, u->attribs);
} }
@ -2267,13 +2264,6 @@ attrib_init(void)
at_register(&at_effect); at_register(&at_effect);
at_register(&at_private); at_register(&at_private);
#if defined(OLD_TRIGGER)
at_register(&at_pointer_tag);
at_register(&at_relation);
at_register(&at_relbackref);
at_register(&at_trigger);
at_register(&at_action);
#endif
at_register(&at_icastle); at_register(&at_icastle);
at_register(&at_guard); at_register(&at_guard);
at_register(&at_lighthouse); at_register(&at_lighthouse);
@ -2524,51 +2514,6 @@ init_used_faction_ids(void)
} }
#if defined(OLD_TRIGGER) || defined(CONVERT_TRIGGER)
# include <eressea/old/trigger.h>
# include <resolve.h>
typedef struct unresolved {
struct unresolved * next;
void ** ptrptr;
/* pointer to the location where the unresolved object
* should be, or NULL if special handling is required */
void * data;
/* information on how to resolve the missing object */
resolve_fun resolve;
/* function to resolve the unknown object */
typ_t typ;
tag_t tag;
} unresolved;
static unresolved * ur_list;
void
ur_add2(int id, void ** ptrptr, typ_t typ, tag_t tag, resolve_fun fun) {
/* skip this for the moment */
unresolved * ur = calloc(1, sizeof(unresolved));
ur->data = (void *)id;
ur->resolve = fun;
ur->ptrptr = ptrptr;
ur->typ = typ;
ur->tag = tag;
ur->next = ur_list;
ur_list = ur;
}
void
resolve2(void)
{
while (ur_list) {
unresolved * ur = ur_list;
ur_list = ur->next;
if (ur->ptrptr) *ur->ptrptr = ur->resolve(ur->data);
else ur->resolve(ur->data);
free(ur);
}
}
#endif
unit * unit *
make_undead_unit(region * r, faction * f, int n, const struct race * rc) make_undead_unit(region * r, faction * f, int n, const struct race * rc)
{ {
@ -3060,7 +3005,7 @@ produceexp(struct unit * u, skill_t sk, int n)
change_skill(u, sk, PRODUCEEXP * n); change_skill(u, sk, PRODUCEEXP * n);
return 1; return 1;
#else #else
learn_skill(u, sk, 30.0/PRODUCEEXP); learn_skill(u, sk, PRODUCEEXP/30.0);
return 0; return 0;
#endif #endif
} }

View File

@ -96,8 +96,6 @@ struct xml_stack;
#define HUNGER_REDUCES_SKILL /* Hunger reduziert den Talentwert auf die Hälfte */ #define HUNGER_REDUCES_SKILL /* Hunger reduziert den Talentwert auf die Hälfte */
#define DAEMON_HUNGER /* Dämonen hungern, statt mit 10% in ihre sphäre zurückzukehren */ #define DAEMON_HUNGER /* Dämonen hungern, statt mit 10% in ihre sphäre zurückzukehren */
#define NEW_RECEIPIES /* Vereinfachte, besser verteilte Kräuterzutaten für Tränke */ #define NEW_RECEIPIES /* Vereinfachte, besser verteilte Kräuterzutaten für Tränke */
#define NEW_TRIGGER
#undef OLD_TRIGGER /* leave active for compatibility until conversion is implemented */
#define NEW_TAVERN #define NEW_TAVERN
#define GOBLINKILL #define GOBLINKILL
#undef HELFE_WAHRNEHMUNG #undef HELFE_WAHRNEHMUNG
@ -152,9 +150,14 @@ struct xml_stack;
#define GROWTREE_VERSION 305 #define GROWTREE_VERSION 305
#define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */ #define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */
#define NEWRACE_VERSION 307 #define NEWRACE_VERSION 307
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */ #define NEWSKILL_VERSION 308
#define RELEASE_VERSION NEWRACE_VERSION #if SKILLPOINTS
# define RELEASE_VERSION NEWRACE_VERSION
#else
# define RELEASE_VERSION NEWSKILL_VERSION
#endif
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
/* /*
#if RELEASE_VERSION >= UGROUPS_VERSION #if RELEASE_VERSION >= UGROUPS_VERSION

View File

@ -2102,7 +2102,7 @@ tagbegin(struct xml_stack * stack)
state->rtype->flags |= RTF_ITEM; state->rtype->flags |= RTF_ITEM;
state->itype = new_itemtype(state->rtype, flags, weight, capacity); state->itype = new_itemtype(state->rtype, flags, weight, capacity);
} else if (strcmp(tag->name, "weapon")==0) { } else if (strcmp(tag->name, "weapon")==0) {
skill_t sk = sk_find(xml_value(tag, "sk")); skill_t sk = sk_find(xml_value(tag, "skill"));
int minskill = xml_ivalue(tag, "minskill"); int minskill = xml_ivalue(tag, "minskill");
int offmod = xml_ivalue(tag, "offmod"); int offmod = xml_ivalue(tag, "offmod");
int defmod = xml_ivalue(tag, "defmod"); int defmod = xml_ivalue(tag, "defmod");
@ -2139,7 +2139,7 @@ tagbegin(struct xml_stack * stack)
if (xml_bvalue(tag, "offensive")) flags|=WMF_OFFENSIVE; if (xml_bvalue(tag, "offensive")) flags|=WMF_OFFENSIVE;
if (xml_bvalue(tag, "defensive")) flags|=WMF_DEFENSIVE; if (xml_bvalue(tag, "defensive")) flags|=WMF_DEFENSIVE;
if (xml_bvalue(tag, "damage")) flags|=WMF_DAMAGE; if (xml_bvalue(tag, "damage")) flags|=WMF_DAMAGE;
if (xml_bvalue(tag, "sk")) flags|=WMF_SKILL; if (xml_bvalue(tag, "skill")) flags|=WMF_SKILL;
if (xml_bvalue(tag, "missile_target")) flags|=WMF_MISSILE_TARGET; if (xml_bvalue(tag, "missile_target")) flags|=WMF_MISSILE_TARGET;
if (state->wmods) { if (state->wmods) {
memcpy(mods, state->wtype->modifiers, sizeof(weapon_mod)*state->wmods); memcpy(mods, state->wtype->modifiers, sizeof(weapon_mod)*state->wmods);

View File

@ -40,10 +40,6 @@
#include "pathfinder.h" #include "pathfinder.h"
#include "karma.h" #include "karma.h"
#ifdef OLD_TRIGGER
#include "old/trigger.h"
#endif
/* util includes */ /* util includes */
#include <resolve.h> #include <resolve.h>
#include <base36.h> #include <base36.h>
@ -1456,7 +1452,6 @@ do_fumble(castorder *co)
/* Kröte */ /* Kröte */
duration = rand()%level/2; duration = rand()%level/2;
if (duration<2) duration = 2; if (duration<2) duration = 2;
#ifdef NEW_TRIGGER
{ {
/* one or two things will happen: the toad changes her race back, /* one or two things will happen: the toad changes her race back,
* and may or may not get toadslime. * and may or may not get toadslime.
@ -1467,15 +1462,6 @@ do_fumble(castorder *co)
if (rand()%10>2) t_add(&trestore, trigger_giveitem(u, olditemtype[I_TOADSLIME], 1)); if (rand()%10>2) t_add(&trestore, trigger_giveitem(u, olditemtype[I_TOADSLIME], 1));
add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore)); add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore));
} }
#else
{
action *a1;
timeout *t1;
t1 = create_timeout(duration);
a1 = action_changerace(u, TYP_UNIT, SPREAD_ALWAYS, u->race, u->irace);
link_action_timeout(a1, t1); /* converted */
}
#endif
u->race = new_race[RC_TOAD]; u->race = new_race[RC_TOAD];
u->irace = new_race[RC_TOAD]; u->irace = new_race[RC_TOAD];
sprintf(buf, "Eine Botschaft von %s: 'Ups! Quack, Quack!'", unitname(u)); sprintf(buf, "Eine Botschaft von %s: 'Ups! Quack, Quack!'", unitname(u));

View File

@ -59,11 +59,6 @@ read_ID(FILE *f)
/****** Not implemented ******/ /****** Not implemented ******/
obj_ID default_ID; obj_ID default_ID;
/* die müssen schon ein value zurückliefern... */ /* die müssen schon ein value zurückliefern... */
#ifdef OLD_TRIGGER
static obj_ID notimplemented_ID(void *p) { unused(p); assert(0); return default_ID; }
static void * notimplemented_find(obj_ID id) { unused(id); assert(0); return 0; }
static void notimplemented_destroy(void *p) { unused(p); assert(0); }
#endif
static char * notimplemented_desc(void *p) { unused(p); assert(0); return 0; } static char * notimplemented_desc(void *p) { unused(p); assert(0); return 0; }
static void cannot_destroy(void *p) { static void cannot_destroy(void *p) {
@ -156,45 +151,6 @@ static void faction_set( void *pp, void *p ) {
*(faction **)pp = (faction *)p; *(faction **)pp = (faction *)p;
} }
#ifdef OLD_TRIGGER
/****** Action ******/
static attrib ** action_attribs( void *p ) {
return &((action *)p)->attribs;
}
static void * action_deref( void *pp ) {
return (void *) (*((action **)pp));
}
static void action_set( void *pp, void *p ) {
if( (*(action **)pp)->magic != ACTION_MAGIC ) {
fprintf(stderr, "Error: action_set(pp=%p, p=%p): (*pp)->magic ungueltig!\n", pp, p);
return;
}
*(action **)pp = (action *)p;
}
/****** old_trigger ******/
static attrib ** trigger_attribs( void *p ) {
return &((old_trigger *)p)->attribs;
}
static void * trigger_deref( void *pp ) {
return (void *) (*((old_trigger **)pp));
}
static void trigger_set( void *pp, void *p ) {
*(old_trigger **)pp = (old_trigger *)p;
}
/****** timeout ******/
static attrib ** timeout_attribs( void *p ) {
return &((timeout *)p)->attribs;
}
static void * timeout_deref( void *pp ) {
return (void *) (*((timeout **)pp));
}
static void timeout_set( void *pp, void *p ) {
*(timeout **)pp = (timeout *)p;
}
#endif
/******* Typ-Funktionstabelle ********/ /******* Typ-Funktionstabelle ********/
typdata_t typdata[] = { typdata_t typdata[] = {
@ -243,46 +199,12 @@ typdata_t typdata[] = {
(deref_fun)faction_deref, (deref_fun)faction_deref,
(set_fun)faction_set, (set_fun)faction_set,
}, },
#ifdef OLD_TRIGGER
/* TYP_ACTION */ {
(ID_fun)notimplemented_ID,
(find_fun)notimplemented_find,
(desc_fun)notimplemented_desc,
(attrib_fun)action_attribs,
(destroy_fun)notimplemented_destroy,
(deref_fun)action_deref,
(set_fun)action_set,
},
/* TYP_TRIGGER */ {
(ID_fun)notimplemented_ID,
(find_fun)notimplemented_find,
(desc_fun)notimplemented_desc,
(attrib_fun)trigger_attribs,
(destroy_fun)notimplemented_destroy,
(deref_fun)trigger_deref,
(set_fun)trigger_set,
},
/* TYP_TIMEOUT */ {
(ID_fun)notimplemented_ID,
(find_fun)notimplemented_find,
(desc_fun)notimplemented_desc,
(attrib_fun)timeout_attribs,
(destroy_fun)notimplemented_destroy,
(deref_fun)timeout_deref,
(set_fun)timeout_set,
},
#endif
}; };
/******** Resolver-Funktionen für obj_ID ********/ /******** Resolver-Funktionen für obj_ID ********/
#ifdef OLD_TRIGGER
#include "old/pointertags.h"
#include "old/trigger.h"
#else
#define tag_t int #define tag_t int
#define TAG_NOTAG (-1) #define TAG_NOTAG (-1)
#endif
typedef struct unresolved2 { typedef struct unresolved2 {
struct unresolved2 *next; struct unresolved2 *next;
@ -326,10 +248,6 @@ resolve_IDs(void)
robj = typdata[ur->typ].find(ur->id); robj = typdata[ur->typ].find(ur->id);
typdata[ur->typ].ppset(ur->objPP, robj); typdata[ur->typ].ppset(ur->objPP, robj);
#ifdef OLD_TRIGGER
if( ur->tag != TAG_NOTAG )
tag_pointer(ur->objPP, ur->typ, ur->tag);
#endif
free(ur); free(ur);
} }
} }

View File

@ -68,11 +68,6 @@
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
#if defined(OLD_TRIGGER) || defined(CONVERT_TRIGGER)
# include <eressea/old/trigger.h>
extern void resolve2(void);
#endif
#define xisdigit(c) (((c) >= '0' && (c) <= '9') || (c) == '-') #define xisdigit(c) (((c) >= '0' && (c) <= '9') || (c) == '-')
#define COMMENT_CHAR ';' #define COMMENT_CHAR ';'
@ -135,7 +130,6 @@ cfopen(const char *filename, const char *mode)
/* Dummy-Funktion für die Kompatibilität */ /* Dummy-Funktion für die Kompatibilität */
#define rid(F) ((global.data_version<BASE36_VERSION)?ri(F):ri36(F)) #define rid(F) ((global.data_version<BASE36_VERSION)?ri(F):ri36(F))
#define wid(F, i) fprintf(F, itoa36(i))
int nextc; int nextc;
@ -1452,24 +1446,28 @@ readgame(boolean backup)
assert(u->number >= 0); assert(u->number >= 0);
assert(u->race); assert(u->race);
#ifdef CONVERT_SKILLPOINTS #if SKILLPOINTS
while ((sk = (skill_t) ri(F)) != NOSKILL) { assert(global.data_version<NEWSKILL_VERSION);
int skill = ri(F) / u->number;
int lvl = level(skill);
int weeks = (skill - level_days(lvl))/30;
if (weeks || lvl) {
set_skill(u, sk, lvl, weeks);
}
}
#elif SKILLPOINTS
while ((sk = (skill_t) ri(F)) != NOSKILL) { while ((sk = (skill_t) ri(F)) != NOSKILL) {
set_skill(u, sk, ri(F)); set_skill(u, sk, ri(F));
} }
#else #else
while ((sk = (skill_t) ri(F)) != NOSKILL) { if (global.data_version<NEWSKILL_VERSION) {
int level = ri(F); /* convert old data */
int weeks = ri(F); while ((sk = (skill_t) ri(F)) != NOSKILL) {
set_skill(u, sk, level, weeks); int skill = ri(F) / u->number;
int lvl = level(skill);
int weeks = (skill - level_days(lvl))/30;
if (weeks || lvl) {
set_skill(u, sk, lvl, 2*weeks);
}
}
} else {
while ((sk = (skill_t) ri(F)) != NOSKILL) {
int level = ri(F);
int weeks = ri(F);
set_skill(u, sk, level, weeks);
}
} }
#endif #endif
if (global.data_version>=ITEMTYPE_VERSION) { if (global.data_version>=ITEMTYPE_VERSION) {
@ -1530,9 +1528,6 @@ readgame(boolean backup)
if (global.data_version >= BORDER_VERSION) read_borders(F); if (global.data_version >= BORDER_VERSION) read_borders(F);
#ifdef USE_UGROUPS #ifdef USE_UGROUPS
if (global.data_version >= UGROUPS_VERSION) read_ugroups(F); if (global.data_version >= UGROUPS_VERSION) read_ugroups(F);
#endif
#if defined(OLD_TRIGGER) || defined(CONVERT_TRIGGER)
if (global.data_version >= TIMEOUT_VERSION) load_timeouts(F);
#endif #endif
} }
@ -1568,9 +1563,6 @@ readgame(boolean backup)
/* Unaufgeloeste Zeiger initialisieren */ /* Unaufgeloeste Zeiger initialisieren */
printf("\n - Referenzen initialisieren...\n"); printf("\n - Referenzen initialisieren...\n");
resolve(); resolve();
#if defined(OLD_TRIGGER) || defined (CONVERT_TRIGGER)
resolve2();
#endif
resolve_IDs(); resolve_IDs();
printf("\n - Leere Gruppen löschen...\n"); printf("\n - Leere Gruppen löschen...\n");
@ -1654,8 +1646,8 @@ int space=0;
#define wc(F, c) { putc(c, F); UNSPACE } #define wc(F, c) { putc(c, F); UNSPACE }
#define wnl(F) { putc('\n', F); DOSPACE } #define wnl(F) { putc('\n', F); DOSPACE }
#define wspace(F) { assert (!space); putc(' ', F); UNSPACE } /* #define wspace(F) { assert(space); putc(' ', F); DOSPACE } */
#define whs(F, s) { fputs(s, F); UNSPACE } #define whs(F, s) { fputs(s, F); putc(' ', F); DOSPACE }
void void
wsn(FILE * F, const char *s) wsn(FILE * F, const char *s)
@ -1677,14 +1669,14 @@ ws(FILE * F, const char *s)
void void
wi(FILE * F, int n) wi(FILE * F, int n)
{ {
sprintf(buf, "%d ", n); fprintf(F, "%d ", n);
wsn(F, buf); DOSPACE DOSPACE
} }
void wi36(FILE * F, int n) void wi36(FILE * F, int n)
{ {
sprintf(buf, "%s ", itoa36(n)); fprintf(F, "%s ", itoa36(n));
wsn(F, buf); DOSPACE DOSPACE
} }
void void
@ -1693,9 +1685,7 @@ write_items(FILE *F, item *ilist)
item * itm; item * itm;
for (itm=ilist;itm;itm=itm->next) if (itm->number) { for (itm=ilist;itm;itm=itm->next) if (itm->number) {
whs(F, resourcename(itm->type->rtype, 0)); whs(F, resourcename(itm->type->rtype, 0));
wspace(F);
wi(F, itm->number); wi(F, itm->number);
wspace(F);
} }
fputs("end", F); fputs("end", F);
} }
@ -1710,15 +1700,11 @@ write_ugroups(FILE *file)
for(f=factions; f; f=f->next) if(f->ugroups) { for(f=factions; f; f=f->next) if(f->ugroups) {
wi(file, f->no); wi(file, f->no);
wspace(file);
for(ug = f->ugroups; ug; ug=ug->next) { for(ug = f->ugroups; ug; ug=ug->next) {
wi(file, ug->id); wi(file, ug->id);
wspace(file);
wi(file, ug->members); wi(file, ug->members);
wspace(file);
for(i=0; i<ug->members; i++) { for(i=0; i<ug->members; i++) {
wid(file, ug->unit_array[i]->no); wi36(file, ug->unit_array[i]->no);
wspace(file);
} }
} }
fputs("-1\n", file); fputs("-1\n", file);
@ -1810,9 +1796,7 @@ writegame(char *path, char quiet)
wnl(F); wnl(F);
#endif #endif
wi(F, turn); wi(F, turn);
wspace(F);
wi(F, max_unique_id); wi(F, max_unique_id);
wspace(F);
wi(F, nextborder); wi(F, nextborder);
/* Write planes */ /* Write planes */
@ -1822,19 +1806,12 @@ writegame(char *path, char quiet)
for(pl = planes; pl; pl=pl->next) { for(pl = planes; pl; pl=pl->next) {
wi(F, pl->id); wi(F, pl->id);
wspace(F);
ws(F, pl->name); ws(F, pl->name);
wspace(F);
wi(F, pl->minx); wi(F, pl->minx);
wspace(F);
wi(F, pl->maxx); wi(F, pl->maxx);
wspace(F);
wi(F, pl->miny); wi(F, pl->miny);
wspace(F);
wi(F, pl->maxy); wi(F, pl->maxy);
wspace(F);
wi(F, pl->flags); wi(F, pl->flags);
wspace(F);
a_write(F, pl->attribs); a_write(F, pl->attribs);
wnl(F); wnl(F);
} }
@ -1848,49 +1825,33 @@ writegame(char *path, char quiet)
printf(" - Schreibe %d Parteien...\n",n); printf(" - Schreibe %d Parteien...\n",n);
for (f = factions; f; f = f->next) { for (f = factions; f; f = f->next) {
wid(F, f->no); wi36(F, f->no);
wspace(F);
wi(F, f->unique_id); wi(F, f->unique_id);
wspace(F);
ws(F, f->name); ws(F, f->name);
wspace(F);
ws(F, f->banner); ws(F, f->banner);
wspace(F);
ws(F, f->email); ws(F, f->email);
wspace(F);
ws(F, f->passw); ws(F, f->passw);
wspace(F);
#if RELEASE_VERSION>=LOCALE_VERSION #if RELEASE_VERSION>=LOCALE_VERSION
ws(F, locale_name(f->locale)); ws(F, locale_name(f->locale));
wspace(F);
#endif #endif
wi(F, f->lastorders); wi(F, f->lastorders);
wspace(F);
wi(F, f->age); wi(F, f->age);
wspace(F);
ws(F, f->race->_name[0]); ws(F, f->race->_name[0]);
wnl(F); wnl(F);
wi(F, f->magiegebiet); wi(F, f->magiegebiet);
wspace(F);
wi(F, f->karma); wi(F, f->karma);
wspace(F);
wi(F, f->flags); wi(F, f->flags);
wspace(F);
a_write(F, f->attribs); a_write(F, f->attribs);
wnl(F); wnl(F);
write_msglevels(f->warnings, F); write_msglevels(f->warnings, F);
wnl(F); wnl(F);
wi(F, listlen(f->ursprung)); wi(F, listlen(f->ursprung));
for(ur = f->ursprung;ur;ur=ur->next) { for(ur = f->ursprung;ur;ur=ur->next) {
wspace(F);
wi(F, ur->id); wi(F, ur->id);
wspace(F);
wi(F, ur->x); wi(F, ur->x);
wspace(F);
wi(F, ur->y); wi(F, ur->y);
} }
wnl(F); wnl(F);
wspace(F);
f->options = f->options & ~Pow(O_DEBUG); f->options = f->options & ~Pow(O_DEBUG);
wi(F, f->options); wi(F, f->options);
wnl(F); wnl(F);
@ -1903,9 +1864,7 @@ writegame(char *path, char quiet)
wi(F, listlen(f->allies)); wi(F, listlen(f->allies));
for (sf = f->allies; sf; sf = sf->next) { for (sf = f->allies; sf; sf = sf->next) {
int no = (sf->faction!=NULL)?sf->faction->no:0; int no = (sf->faction!=NULL)?sf->faction->no:0;
wspace(F); wi36(F, no);
wid(F, no);
wspace(F);
wi(F, sf->status); wi(F, sf->status);
} }
wnl(F); wnl(F);
@ -1941,34 +1900,23 @@ writegame(char *path, char quiet)
wnl(F); wnl(F);
wi(F, r->x); wi(F, r->x);
wspace(F);
wi(F, r->y); wi(F, r->y);
wspace(F);
ws(F, r->display); ws(F, r->display);
wspace(F);
wi(F, rterrain(r)); wi(F, rterrain(r));
wspace(F);
wi(F, r->flags & RF_SAVEMASK); wi(F, r->flags & RF_SAVEMASK);
wspace(F);
wi(F, r->age); wi(F, r->age);
wnl(F); wnl(F);
if (landregion(rterrain(r))) { if (landregion(rterrain(r))) {
struct demand * demand; struct demand * demand;
ws(F, r->land->name); ws(F, r->land->name);
wspace(F);
#if GROWING_TREES #if GROWING_TREES
wi(F, rtrees(r,0)); wi(F, rtrees(r,0));
wspace(F);
wi(F, rtrees(r,1)); wi(F, rtrees(r,1));
wspace(F);
wi(F, rtrees(r,2)); wi(F, rtrees(r,2));
wspace(F);
#else #else
wi(F, rtrees(r)); wi(F, rtrees(r));
wspace(F);
#endif #endif
wi(F, rhorses(r)); wi(F, rhorses(r));
wspace(F);
#if NEW_RESOURCEGROWTH == 0 #if NEW_RESOURCEGROWTH == 0
wi(F, riron(r)); wi(F, riron(r));
#elif RELEASE_VERSION>=NEWRESOURCE_VERSION #elif RELEASE_VERSION>=NEWRESOURCE_VERSION
@ -1976,17 +1924,11 @@ writegame(char *path, char quiet)
rawmaterial * res = r->resources; rawmaterial * res = r->resources;
while (res) { while (res) {
ws(F, res->type->name); ws(F, res->type->name);
wspace(F);
wi(F, res->level); wi(F, res->level);
wspace(F);
wi(F, res->amount); wi(F, res->amount);
wspace(F);
wi(F, res->startlevel); wi(F, res->startlevel);
wspace(F);
wi(F, res->base); wi(F, res->base);
wspace(F);
wi(F, res->divisor); wi(F, res->divisor);
wspace(F);
res = res->next; res = res->next;
} }
ws(F, "end"); ws(F, "end");
@ -1994,25 +1936,18 @@ writegame(char *path, char quiet)
#else #else
assert(!"invalid defines"); assert(!"invalid defines");
#endif #endif
wspace(F);
rht = rherbtype(r); rht = rherbtype(r);
if (rht) { if (rht) {
ws(F, resourcename(rht->itype->rtype, 0)); ws(F, resourcename(rht->itype->rtype, 0));
} else { } else {
ws(F, "noherb"); ws(F, "noherb");
} }
wspace(F);
wi(F, rherbs(r)); wi(F, rherbs(r));
wspace(F);
wi(F, rpeasants(r)); wi(F, rpeasants(r));
wspace(F);
wi(F, rmoney(r)); wi(F, rmoney(r));
wspace(F);
if (r->land) for (demand=r->land->demands; demand; demand=demand->next) { if (r->land) for (demand=r->land->demands; demand; demand=demand->next) {
ws(F, resourcename(demand->type->itype->rtype, 0)); ws(F, resourcename(demand->type->itype->rtype, 0));
wspace(F);
wi(F, demand->value); wi(F, demand->value);
wspace(F);
} }
fputs("end", F); fputs("end", F);
wnl(F); wnl(F);
@ -2022,20 +1957,10 @@ writegame(char *path, char quiet)
wi(F, listlen(r->buildings)); wi(F, listlen(r->buildings));
wnl(F); wnl(F);
for (b = r->buildings; b; b = b->next) { for (b = r->buildings; b; b = b->next) {
wid(F, b->no); wi36(F, b->no);
wspace(F);
ws(F, b->name); ws(F, b->name);
wspace(F);
ws(F, b->display); ws(F, b->display);
wspace(F);
wi(F, b->size); wi(F, b->size);
wspace(F);
#ifdef TODO
/* gibts mit dem neuen Magiesystem nicht mehr, sind nun attribute
wi(F, b->zauber);
wspace(F);
*/
#endif
ws(F, b->type->_name); ws(F, b->type->_name);
wnl(F); wnl(F);
a_write(F, b->attribs); a_write(F, b->attribs);
@ -2046,22 +1971,16 @@ writegame(char *path, char quiet)
wnl(F); wnl(F);
for (sh = r->ships; sh; sh = sh->next) { for (sh = r->ships; sh; sh = sh->next) {
assert(sh->region == r); assert(sh->region == r);
wid(F, sh->no); wi36(F, sh->no);
wspace(F);
ws(F, sh->name); ws(F, sh->name);
wspace(F);
ws(F, sh->display); ws(F, sh->display);
wspace(F);
#if RELEASE_VERSION < SHIPTYPE_VERSION #if RELEASE_VERSION < SHIPTYPE_VERSION
wi(F, sh->type); wi(F, sh->type);
#else #else
ws(F, sh->type->name[0]); ws(F, sh->type->name[0]);
#endif #endif
wspace(F);
wi(F, sh->size); wi(F, sh->size);
wspace(F);
wi(F, sh->damage); wi(F, sh->damage);
wspace(F);
wi(F, sh->coast); wi(F, sh->coast);
wnl(F); wnl(F);
a_write(F, sh->attribs); a_write(F, sh->attribs);
@ -2071,61 +1990,45 @@ writegame(char *path, char quiet)
wi(F, listlen(r->units)); wi(F, listlen(r->units));
wnl(F); wnl(F);
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
#if !SKILLPOINTS || defined(CONVERT_SKILLPOINTS) #if !SKILLPOINTS
int i; int i;
#else #else
skill_t sk; skill_t sk;
#endif #endif
wid(F, u->no); wi36(F, u->no);
wspace(F); wi36(F, u->faction->no);
wid(F, u->faction->no);
wspace(F);
ws(F, u->name); ws(F, u->name);
wspace(F);
ws(F, u->display); ws(F, u->display);
wspace(F);
assert(old_race(u->race) == RC_SPELL || u->number == u->debug_number); assert(old_race(u->race) == RC_SPELL || u->number == u->debug_number);
wi(F, u->number); wi(F, u->number);
wspace(F);
wi(F, u->age); wi(F, u->age);
wspace(F);
ws(F, u->race->_name[0]); ws(F, u->race->_name[0]);
wspace(F);
ws(F, u->irace!=u->race?u->irace->_name[0]:""); ws(F, u->irace!=u->race?u->irace->_name[0]:"");
wspace(F);
if (u->building) if (u->building)
wid(F, u->building->no); wi36(F, u->building->no);
else else
wi(F, 0); wi(F, 0);
wspace(F);
if (u->ship) if (u->ship)
#if RELEASE_VERSION>= FULL_BASE36_VERSION #if RELEASE_VERSION>= FULL_BASE36_VERSION
wid(F, u->ship->no); wi36(F, u->ship->no);
#else #else
wi(F, u->ship->no); wi(F, u->ship->no);
#endif #endif
else else
wi(F, 0); wi(F, 0);
wspace(F);
wi(F, u->status); wi(F, u->status);
wspace(F);
wi(F, u->flags & FL_SAVEMASK); wi(F, u->flags & FL_SAVEMASK);
#if RELEASE_VERSION < GUARDFIX_VERSION #if RELEASE_VERSION < GUARDFIX_VERSION
wspace(F);
wi(F, getguard(u)); wi(F, getguard(u));
#endif #endif
for(S=u->orders; S; S=S->next) { for(S=u->orders; S; S=S->next) {
if (is_persistent(S->s, u->faction->locale)) { if (is_persistent(S->s, u->faction->locale)) {
wspace(F);
ws(F, S->s); ws(F, S->s);
} }
} }
wspace(F);
ws(F, ""); /* Abschluß der persistenten Befehle */ ws(F, ""); /* Abschluß der persistenten Befehle */
wspace(F);
ws(F, u->lastorder); ws(F, u->lastorder);
#if RELEASE_VERSION < EFFSTEALTH_VERSION #if RELEASE_VERSION < EFFSTEALTH_VERSION
wspace(F);
wi(F, u_geteffstealth(u)); wi(F, u_geteffstealth(u));
#endif #endif
wnl(F); wnl(F);
@ -2142,9 +2045,7 @@ writegame(char *path, char quiet)
for (sk = 0; sk != MAXSKILLS; sk++) { for (sk = 0; sk != MAXSKILLS; sk++) {
if (get_skill(u, sk)) { if (get_skill(u, sk)) {
wi(F, sk); wi(F, sk);
wspace(F);
wi(F, get_skill(u, sk)); wi(F, get_skill(u, sk));
wspace(F);
} }
} }
#else #else
@ -2152,11 +2053,8 @@ writegame(char *path, char quiet)
skill * sv = u->skills+i; skill * sv = u->skills+i;
if (sv->learning || sv->level) { if (sv->learning || sv->level) {
wi(F, sv->id); wi(F, sv->id);
wspace(F);
wi(F, sv->level); wi(F, sv->level);
wspace(F);
wi(F, sv->learning); wi(F, sv->learning);
wspace(F);
} }
} }
#endif #endif
@ -2173,27 +2071,19 @@ writegame(char *path, char quiet)
#if RELEASE_VERSION < MAGE_ATTRIB_VERSION #if RELEASE_VERSION < MAGE_ATTRIB_VERSION
if (is_mage(u)) { if (is_mage(u)) {
m = get_mage(u); m = get_mage(u);
wspace(F);
wi(F, m->magietyp); wi(F, m->magietyp);
wspace(F);
wi(F, m->spellpoints); wi(F, m->spellpoints);
wspace(F);
wi(F, m->spchange); wi(F, m->spchange);
for (i = 0; i != MAXCOMBATSPELLS; i++){ for (i = 0; i != MAXCOMBATSPELLS; i++){
wspace(F);
wi(F, m->combatspell[i]); wi(F, m->combatspell[i]);
wspace(F);
wi(F, m->combatspelllevel[i]); wi(F, m->combatspelllevel[i]);
} }
wspace(F);
wi(F, -1); wi(F, -1);
wnl(F); wnl(F);
/* BUG: Endlosschleife! */ /* BUG: Endlosschleife! */
for (sp = m->spellptr;sp;sp=sp->next){ for (sp = m->spellptr;sp;sp=sp->next){
wspace(F);
wi(F, sp->spellid); wi(F, sp->spellid);
} }
wspace(F);
} }
wi(F, -1); wi(F, -1);
wnl(F); wnl(F);
@ -2208,9 +2098,6 @@ writegame(char *path, char quiet)
#if RELEASE_VERSION >= UGROUPS_VERSION #if RELEASE_VERSION >= UGROUPS_VERSION
write_ugroups(F); write_ugroups(F);
wnl(F); wnl(F);
#endif
#ifdef OLD_TRIGGER
save_timeouts(F);
#endif #endif
fclose(F); fclose(F);
printf("\nOk.\n"); printf("\nOk.\n");

View File

@ -293,9 +293,6 @@ destroy_ship(ship * s, region * r)
unit * u = r->units; unit * u = r->units;
if(!findship(s->no)) return; if(!findship(s->no)) return;
#ifdef OLD_TRIGGER
do_trigger(s, TYP_SHIP, TR_DESTRUCT);
#endif
while (u) { while (u) {
if (u->ship == s) { if (u->ship == s) {
leave_ship(u); leave_ship(u);
@ -303,9 +300,6 @@ destroy_ship(ship * s, region * r)
u = u->next; u = u->next;
} }
sunhash(s); sunhash(s);
#ifdef OLD_TRIGGER
change_all_pointers(s, TYP_SHIP, NULL);
#endif
choplist(&r->ships, s); choplist(&r->ships, s);
handle_event(&s->attribs, "destroy", s); handle_event(&s->attribs, "destroy", s);
} }

View File

@ -80,6 +80,7 @@ skill_t
sk_find(const char * name) sk_find(const char * name)
{ {
skill_t i; skill_t i;
if (name==NULL) return NOSKILL;
for (i=0;i!=MAXSKILLS;++i) { for (i=0;i!=MAXSKILLS;++i) {
if (strcmp(name, skillnames[i])==0) return i; if (strcmp(name, skillnames[i])==0) return i;
} }
@ -240,7 +241,6 @@ level_days(int level)
return 30 * ((level+1) * level / 2); return 30 * ((level+1) * level / 2);
} }
#if SKILLPOINTS
int int
level(int days) level(int days)
{ {
@ -254,7 +254,6 @@ level(int days)
for (i=0;i!=64;++i) if (ldays[i]>days) return i; for (i=0;i!=64;++i) if (ldays[i]>days) return i;
return i; return i;
} }
#endif
#if !SKILLPOINTS #if !SKILLPOINTS
void void

View File

@ -51,6 +51,7 @@ extern const char * skillname(skill_t, const struct locale *);
extern skill_t sk_find(const char * name); extern skill_t sk_find(const char * name);
extern int level_days(int level); extern int level_days(int level);
extern int level(int days);
#if SKILLPOINTS #if SKILLPOINTS
# define skill_level(level) level_days(level) # define skill_level(level) level_days(level)

View File

@ -525,13 +525,7 @@ select_familiar(const race * magerace, magic_t magiegebiet)
boolean boolean
is_familiar(const unit *u) is_familiar(const unit *u)
{ {
#ifdef NEW_TRIGGER
return i2b(get_familiar_mage(u)!=NULL); return i2b(get_familiar_mage(u)!=NULL);
#else
if (get_relation(u, TYP_UNIT, REL_CREATOR) != NULL )
return true;
return false;
#endif
} }
static void static void
@ -2234,14 +2228,8 @@ sp_ironkeeper(castorder *co)
/* Parteitarnen, damit man nicht sofort weiß, wer dahinter steckt */ /* Parteitarnen, damit man nicht sofort weiß, wer dahinter steckt */
fset(keeper, FL_PARTEITARNUNG); fset(keeper, FL_PARTEITARNUNG);
{ {
#ifdef NEW_TRIGGER
trigger * tkill = trigger_killunit(keeper); trigger * tkill = trigger_killunit(keeper);
add_trigger(&keeper->attribs, "timer", trigger_timeout(cast_level+2, tkill)); add_trigger(&keeper->attribs, "timer", trigger_timeout(cast_level+2, tkill));
#else
timeout * to = create_timeout(cast_level+2);
action *ac = action_destroy(keeper, TYP_UNIT, SPREAD_TRANSFER);
link_action_timeout(ac, to); /* conversion done */
#endif
} }
sprintf(buf, "%s beschwört einen Bergwächter.", unitname(mage)); sprintf(buf, "%s beschwört einen Bergwächter.", unitname(mage));
@ -2739,17 +2727,8 @@ sp_summondragon(castorder *co)
break; break;
} }
{ {
#ifdef NEW_TRIGGER
trigger * tsummon = trigger_createunit(r, f, race, number); trigger * tsummon = trigger_createunit(r, f, race, number);
add_trigger(&r->attribs, "timer", trigger_timeout(time, tsummon)); add_trigger(&r->attribs, "timer", trigger_timeout(time, tsummon));
#else
action *a2;
timeout *t2;
t2 = create_timeout(time);
a2 = action_createunit(r, TYP_REGION, SPREAD_NEVER, f->unique_id,
number, race);
link_action_timeout(a2, t2);
#endif
} }
} }
} }
@ -3543,14 +3522,8 @@ sp_magicboost(castorder *co)
create_curse(mage, &mage->attribs, C_AURA, 0, power, 4, 200, 1); create_curse(mage, &mage->attribs, C_AURA, 0, power, 4, 200, 1);
{ {
#ifdef NEW_TRIGGER
trigger * tsummon = trigger_createcurse(mage, mage, C_AURA, 0, power, 6, 50, 1); trigger * tsummon = trigger_createcurse(mage, mage, C_AURA, 0, power, 6, 50, 1);
add_trigger(&mage->attribs, "timer", trigger_timeout(5, tsummon)); add_trigger(&mage->attribs, "timer", trigger_timeout(5, tsummon));
#else
timeout *to = create_timeout(5);
action * ac = action_createmagicboostcurse(mage, TYP_UNIT, SPREAD_NEVER, power);
link_action_timeout(ac, to); /* conversion done */
#endif
} }
/* kann nicht durch Antimagie beeinflusst werden */ /* kann nicht durch Antimagie beeinflusst werden */
@ -3965,7 +3938,6 @@ sp_charmingsong(castorder *co)
duration = 3 + rand()%force; duration = 3 + rand()%force;
{ {
#ifdef NEW_TRIGGER
trigger * trestore = trigger_changefaction(target, target->faction); trigger * trestore = trigger_changefaction(target, target->faction);
/* läuft die Dauer ab, setze Partei zurück */ /* läuft die Dauer ab, setze Partei zurück */
add_trigger(&target->attribs, "timer", trigger_timeout(duration, trestore)); add_trigger(&target->attribs, "timer", trigger_timeout(duration, trestore));
@ -3973,24 +3945,6 @@ sp_charmingsong(castorder *co)
add_trigger(&target->faction->attribs, "destroy", trigger_killunit(target)); add_trigger(&target->faction->attribs, "destroy", trigger_killunit(target));
/* wird die neue Partei von Target aufgelöst, dann auch diese Einheit */ /* wird die neue Partei von Target aufgelöst, dann auch diese Einheit */
add_trigger(&mage->faction->attribs, "destroy", trigger_killunit(target)); add_trigger(&mage->faction->attribs, "destroy", trigger_killunit(target));
#else
old_trigger *t1;
timeout *t2;
action *a1, *a2;
/* läuft die Dauer ab, setze Partei zurück */
t2 = create_timeout(duration);
a2 = action_changefaction(target, TYP_UNIT, SPREAD_ALWAYS,
target->faction->unique_id);
link_action_timeout(a2, t2);
/* wird die alte Partei von Target aufgelöst */
t1 = create_trigger(target->faction, TYP_FACTION, 0, TR_DESTRUCT);
/* dann löse auch target auf */
a1 = action_destroy(target, TYP_UNIT, SPREAD_ALWAYS);
link_action_trigger(a1, t1);
/* TODO sollte irgendwie nach Ablauf des Zaubers gelöscht werden */
#endif
} }
/* sperre ATTACKIERE, GIB PERSON und überspringe Migranten */ /* sperre ATTACKIERE, GIB PERSON und überspringe Migranten */
create_curse(mage, &target->attribs, C_SLAVE, 0, force, duration, 0, 0); create_curse(mage, &target->attribs, C_SLAVE, 0, force, duration, 0, 0);

View File

@ -43,9 +43,6 @@
#include <event.h> #include <event.h>
#include <goodies.h> #include <goodies.h>
#include <resolve.h> #include <resolve.h>
#ifdef OLD_TRIGGER
# include <old/trigger.h>
#endif
/* libc includes */ /* libc includes */
#include <string.h> #include <string.h>
@ -608,7 +605,9 @@ set_level(unit * u, skill_t id, int value)
if (sv->id == id) { if (sv->id == id) {
sv->level = (unsigned char)value; sv->level = (unsigned char)value;
sv->learning = 0; sv->learning = 0;
break;
} }
++sv;
} }
#endif #endif
} }
@ -781,8 +780,14 @@ transfermen(unit * u, unit * u2, int n)
set_skill(u2, sv->id, sv->level, sv->learning); set_skill(u2, sv->id, sv->level, sv->learning);
} else { } else {
skill * sn = get_skill(u2, sv->id); skill * sn = get_skill(u2, sv->id);
sn->level = (unsigned char)((sv->level*n+sn->level*u2->number)/(u2->number+n)); if (sn) {
if (sn->learning>sv->learning) sn->learning=sv->learning; int level = ((sv->level*n+sn->level*u2->number)/(u2->number+n));
sn->level = (unsigned char)level;
if (sn->learning>sv->learning) sn->learning=sv->learning;
} else {
int level = (sv->level*n/(u2->number+n));
set_level(u2, sv->id, level);
}
} }
} }
#endif #endif
@ -909,15 +914,66 @@ set_number(unit * u, int count)
#if !SKILLPOINTS #if !SKILLPOINTS
boolean boolean
learn_skill(const unit * u, skill_t sk, double chance) learn_skill(unit * u, skill_t sk, double chance)
{ {
/** rewrite me **/ int coins, heads = 0;
assert(!"rewrite me!"); int level = 0;
return 0; int weeks = 0;
skill * sv;
assert (chance <= 1.0);
if (chance < 1.0 && rand()%10000>=chance*10000) return false;
sv = get_skill(u, sk);
if (sv) {
level = sv->level;
weeks = sv->learning;
}
coins = level * 2;
heads = coins - weeks;
while (heads>0 && coins--) {
if (rand()%2==0) --heads;
if (heads>coins) break;
}
if (heads) ++weeks;
else ++level;
if (!sv) {
set_skill(u, sk, level, weeks);
} else {
sv->level = (unsigned char)level;
sv->learning = (unsigned char)weeks;
}
return heads==0;
}
void
set_skill(unit * u, skill_t id, int level, int weeks)
{
skill *i = u->skills;
assert(level>=0 && weeks>=0 && weeks<=level*2);
for (; i != u->skills + u->skill_size; ++i) {
if (i->id == id) {
if (level || weeks) {
i->level = (unsigned char)level;
i->learning = (unsigned char)weeks;
} else {
*i = *(u->skills + u->skill_size - 1);
--u->skill_size;
}
return;
}
} if (!level && !weeks) {
return;
}
++u->skill_size;
u->skills = realloc(u->skills, u->skill_size * sizeof(skill));
i = (u->skills + u->skill_size - 1);
i->level = (unsigned char)level;
i->learning = (unsigned char)weeks;
i->id = (unsigned char)id;
} }
skill * skill *
get_skill(unit * u, skill_t sk) get_skill(const unit * u, skill_t sk)
{ {
skill * sv = u->skills; skill * sv = u->skills;
while (sv!=u->skills+u->skill_size) { while (sv!=u->skills+u->skill_size) {
@ -929,7 +985,7 @@ get_skill(unit * u, skill_t sk)
} }
boolean boolean
has_skill(unit * u, skill_t sk) has_skill(const unit * u, skill_t sk)
{ {
skill * sv = u->skills; skill * sv = u->skills;
while (sv!=u->skills+u->skill_size) { while (sv!=u->skills+u->skill_size) {
@ -1042,10 +1098,10 @@ int
eff_skill(const unit * u, skill_t sk, const region * r) eff_skill(const unit * u, skill_t sk, const region * r)
{ {
int level = get_level(u, sk); int level = get_level(u, sk);
int mlevel = level - get_modifier(u, sk, level, r); if (level>0) {
int mlevel = level + get_modifier(u, sk, level, r);
#if SKILLPOINTS if (mlevel>0) return mlevel;
if (mlevel<0) return 0; }
#endif return 0;
return mlevel;
} }

View File

@ -117,12 +117,10 @@ extern int get_skill(const struct unit * u, skill_t id);
#define change_level(u, sk, bylevel) set_level(u, sk, max(0,get_level(u,sk)+bylevel)); #define change_level(u, sk, bylevel) set_level(u, sk, max(0,get_level(u,sk)+bylevel));
#else #else
extern void set_skill(struct unit * u, skill_t id, int level, int weeks); extern void set_skill(struct unit * u, skill_t id, int level, int weeks);
extern struct skill * get_skill(struct unit * u, skill_t id); extern struct skill * get_skill(const struct unit * u, skill_t id);
extern boolean has_skill(const unit* u, skill_t sk); extern boolean has_skill(const unit* u, skill_t sk);
extern int change_level(struct unit * u, skill_t id, int bylevel);
#endif #endif
extern int change_skillpoints(struct unit * u, skill_t id, int byvalue);
extern void set_level(struct unit * u, skill_t id, int level); extern void set_level(struct unit * u, skill_t id, int level);
extern int get_level(const struct unit * u, skill_t id); extern int get_level(const struct unit * u, skill_t id);
extern void transfermen(struct unit * u, struct unit * u2, int n); extern void transfermen(struct unit * u, struct unit * u2, int n);
@ -159,7 +157,7 @@ extern void u_setfaction(struct unit * u, struct faction * f);
extern void set_number(struct unit * u, int count); extern void set_number(struct unit * u, int count);
#if !SKILLPOINTS #if !SKILLPOINTS
extern boolean learn_skill(const struct unit * u, skill_t sk, double chance); extern boolean learn_skill(struct unit * u, skill_t sk, double chance);
#endif #endif
#endif #endif

View File

@ -28,9 +28,4 @@
#define PEASANT_ADJUSTMENT 1 #define PEASANT_ADJUSTMENT 1
#define SKILLPOINTS 1 #define SKILLPOINTS 0
#undef CONVERT_SKILLPOINTS
#if defined(CONVERT_SKILLPOINTS) && !SKILLPOINTS
# error "cannot have both CONVERT_SKILLPOINTS && !SKILLPOINTS"
#endif

View File

@ -118,31 +118,11 @@ sp_summon_alp(struct castorder *co)
strcpy(buf, "Ein Alp starb, ohne sein Ziel zu erreichen."); strcpy(buf, "Ein Alp starb, ohne sein Ziel zu erreichen.");
{ {
#ifdef NEW_TRIGGER
/* Wenn der Alp stirbt, den Magier nachrichtigen */ /* Wenn der Alp stirbt, den Magier nachrichtigen */
add_trigger(&alp->attribs, "destroy", trigger_unitmessage(mage, buf, MSG_EVENT, ML_INFO)); add_trigger(&alp->attribs, "destroy", trigger_unitmessage(mage, buf, MSG_EVENT, ML_INFO));
/* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */ /* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */
add_trigger(&mage->attribs, "destroy", trigger_killunit(alp)); add_trigger(&mage->attribs, "destroy", trigger_killunit(alp));
add_trigger(&opfer->attribs, "destroy", trigger_killunit(alp)); add_trigger(&opfer->attribs, "destroy", trigger_killunit(alp));
#else
/* da der Alp niemals GIB PERSONEN ausfuehrt, koennen alle seine
* spread-Angaben bei Relations und Actions vom Typ SPREAD_NEVER sein.
*/
old_trigger *tr1, *tr2;
action *ac;
/* Wenn der Alp stirbt, den Magier nachrichtigen */
tr1 = create_trigger(alp, TYP_UNIT, SPREAD_NEVER, TR_DESTRUCT);
ac = action_sendmessage(mage, TYP_UNIT, SPREAD_TRANSFER, buf, MSG_EVENT, ML_INFO);
link_action_trigger(ac, tr1);
/* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */
tr1 = create_trigger(mage, TYP_UNIT, SPREAD_TRANSFER, TR_DESTRUCT);
tr2 = create_trigger(opfer, TYP_UNIT, SPREAD_TRANSFER, TR_DESTRUCT);
ac = action_destroy(alp, TYP_UNIT, SPREAD_NEVER);
link_action_trigger(ac, tr1);
link_action_trigger(ac, tr2);
#endif
} }
sprintf(buf, "%s beschwört den Alp %s für %s.", unitname(mage), sprintf(buf, "%s beschwört den Alp %s für %s.", unitname(mage),
unitname(alp), unitname(opfer)); unitname(alp), unitname(opfer));
@ -177,11 +157,7 @@ alp_findet_opfer(unit *alp, region *r)
* müssen jetzt aber deaktiviert werden, sonst werden sie gleich * müssen jetzt aber deaktiviert werden, sonst werden sie gleich
* beim destroy_unit(alp) ausgelöst. * beim destroy_unit(alp) ausgelöst.
*/ */
#ifdef NEW_TRIGGER
a_removeall(&alp->attribs, &at_eventhandler); a_removeall(&alp->attribs, &at_eventhandler);
#else
remove_all_actions(alp, TYP_UNIT);
#endif
/* Alp umwandeln in Curse */ /* Alp umwandeln in Curse */
c = create_curse(mage, &opfer->attribs, C_ALLSKILLS, 0, 0, 0, -2, opfer->number); c = create_curse(mage, &opfer->attribs, C_ALLSKILLS, 0, 0, 0, -2, opfer->number);
/* solange es noch keine spezielle alp-Antimagie gibt, reagiert der /* solange es noch keine spezielle alp-Antimagie gibt, reagiert der
@ -192,14 +168,7 @@ alp_findet_opfer(unit *alp, region *r)
{ {
/* wenn der Magier stirbt, wird der Curse wieder vom Opfer genommen */ /* wenn der Magier stirbt, wird der Curse wieder vom Opfer genommen */
#ifdef NEW_TRIGGER
add_trigger(&mage->attribs, "destroy", trigger_removecurse(c, opfer)); add_trigger(&mage->attribs, "destroy", trigger_removecurse(c, opfer));
#else
old_trigger * tr = create_trigger(mage, TYP_UNIT, SPREAD_TRANSFER, TR_DESTRUCT);
action * ac = action_removecurse(opfer, TYP_UNIT, SPREAD_MODULO, C_ALLSKILLS, 0);
/* TODO: der Spread des Curses muß dem Spread der Action angepaßt werden! */
link_action_trigger(ac, tr);
#endif
} }
} }

View File

@ -20,10 +20,6 @@
#include <config.h> #include <config.h>
#include <eressea.h> #include <eressea.h>
#ifndef NEW_TRIGGER
# error "new triggers not activated"
#endif
/* triggers includes */ /* triggers includes */
#include <triggers/changefaction.h> #include <triggers/changefaction.h>
#include <triggers/changerace.h> #include <triggers/changerace.h>

View File

@ -77,7 +77,6 @@
#undef XMAS1999 #undef XMAS1999
#undef XMAS2000 #undef XMAS2000
#undef XMAS2001 #undef XMAS2001
#undef CONVERT_SKILLPOINTS
extern void reorder_owners(struct region * r); extern void reorder_owners(struct region * r);
@ -2606,8 +2605,8 @@ fix_questcoors(void)
ursprung * u = f->ursprung; ursprung * u = f->ursprung;
while (u) { while (u) {
if (u->id == p->id) { if (u->id == p->id) {
u->x = eternath->x; u->x = 0;
u->y = eternath->y; u->y = 0;
break; break;
} }
u=u->next; u=u->next;
@ -2693,9 +2692,6 @@ void
korrektur_end(void) korrektur_end(void)
{ {
/* fix_balsamfiasko(); */ /* fix_balsamfiasko(); */
#ifdef CONVERT_SKILLPOINTS
do_once("nskp", convert_skills());
#endif
#ifdef XMAS2001 #ifdef XMAS2001
do_once("2001", xmas2001()); do_once("2001", xmas2001());
#endif #endif

View File

@ -91,6 +91,7 @@ extern item_type * i_silver;
extern boolean nonr; extern boolean nonr;
extern boolean nocr; extern boolean nocr;
extern boolean noreports;
extern boolean nomer; extern boolean nomer;
extern boolean nomsg; extern boolean nomsg;
extern boolean nobattle; extern boolean nobattle;
@ -269,7 +270,7 @@ processturn(char *filename)
remove_unequipped_guarded(); remove_unequipped_guarded();
#endif #endif
korrektur_end(); korrektur_end();
reports(); if (!noreports) reports();
free_units(); free_units();
puts(" - Beseitige leere Parteien"); puts(" - Beseitige leere Parteien");
remove_empty_factions(); remove_empty_factions();
@ -462,12 +463,16 @@ read_args(int argc, char **argv)
if (argv[i][0]!='-') { if (argv[i][0]!='-') {
return usage(argv[0], argv[i]); return usage(argv[0], argv[i]);
} else if (argv[i][1]=='-') { /* long format */ } else if (argv[i][1]=='-') { /* long format */
if (strcmp(argv[i]+1, "nocr")==0) nocr = true; if (strcmp(argv[i]+2, "nocr")==0) nocr = true;
else if (strcmp(argv[i]+2, "nosave")==0) nowrite = true; else if (strcmp(argv[i]+2, "nosave")==0) nowrite = true;
else if (strcmp(argv[i]+2, "noreports")==0) {
noreports = true;
nocr = true;
nocr = true;
}
else if (strcmp(argv[i]+2, "xml")==0) xmlfile = argv[++i]; else if (strcmp(argv[i]+2, "xml")==0) xmlfile = argv[++i];
else if (strcmp(argv[i]+2, "dirtyload")==0) dirtyload = true; else if (strcmp(argv[i]+2, "dirtyload")==0) dirtyload = true;
else if (strcmp(argv[i]+2, "nonr")==0) nonr = true; else if (strcmp(argv[i]+2, "nonr")==0) nonr = true;
else if (strcmp(argv[i]+2, "nocr")==0) nocr = true;
else if (strcmp(argv[i]+2, "nomsg")==0) nomsg = true; else if (strcmp(argv[i]+2, "nomsg")==0) nomsg = true;
else if (strcmp(argv[i]+2, "noeiswald")==0) g_killeiswald = true; else if (strcmp(argv[i]+2, "noeiswald")==0) g_killeiswald = true;
else if (strcmp(argv[i]+2, "nobattle")==0) nobattle = true; else if (strcmp(argv[i]+2, "nobattle")==0) nobattle = true;

View File

@ -20,10 +20,6 @@
#include <config.h> #include <config.h>
#include <eressea.h> #include <eressea.h>
#ifndef NEW_TRIGGER
# error "new triggers not activated"
#endif
/* triggers includes */ /* triggers includes */
#include <triggers/changefaction.h> #include <triggers/changefaction.h>
#include <triggers/changerace.h> #include <triggers/changerace.h>

View File

@ -293,24 +293,36 @@ level(int days)
return l-1; return l-1;
} }
static void
change_level(unit * u, skill_t sk, int bylevel)
{
skill * sv = get_skill(u, sk);
assert(bylevel>0);
if (sv==0) set_skill(u, sk, bylevel, 0);
else {
sv->level = (unsigned char)(sv->level+bylevel);
sv->learning = 0;
}
}
static void static void
give_latestart_bonus(region *r, unit *u, int b) give_latestart_bonus(region *r, unit *u, int b)
{ {
int bsk = skill_level(level(b*30)); int bsk = level(b*30);
change_skill(u, SK_OBSERVATION, bsk*u->number); change_level(u, SK_OBSERVATION, bsk);
change_money(u, 200*b); change_money(u, 200*b);
{ {
unit *u2 = createunit(r, u->faction, 1, u->race); unit *u2 = createunit(r, u->faction, 1, u->race);
change_skill(u2, SK_TACTICS, bsk * u2->number / 2); change_level(u2, SK_TACTICS, bsk);
u2->irace = u->irace; u2->irace = u->irace;
fset(u2, FL_PARTEITARNUNG); fset(u2, FL_PARTEITARNUNG);
} }
{ {
unit *u2 = createunit(r, u->faction, 2*b, u->race); unit *u2 = createunit(r, u->faction, 2*b, u->race);
change_skill(u2, SK_SPEAR, skill_level(3) * u2->number); change_level(u2, SK_SPEAR, 3);
change_skill(u2, SK_TAXING, skill_level(3) * u2->number); change_level(u2, SK_TAXING, 3);
change_item(u2, I_SPEAR, u2->number); change_item(u2, I_SPEAR, u2->number);
u2->irace = u->irace; u2->irace = u->irace;
fset(u2, FL_PARTEITARNUNG); fset(u2, FL_PARTEITARNUNG);
@ -437,7 +449,7 @@ ModifyPartei(faction * f)
if (u->faction == f && get_skill(u, SK_MAGIC)) { if (u->faction == f && get_skill(u, SK_MAGIC)) {
if (fval(f, FL_DH)) if (fval(f, FL_DH))
waddnstr(win, ", ", -1); waddnstr(win, ", ", -1);
wprintw(win, (NCURSES_CONST char*)"%s(%d): %d", unitid(u), u->number, get_skill(u, SK_MAGIC) / u->number); wprintw(win, (NCURSES_CONST char*)"%s(%d): %d", unitid(u), u->number, get_level(u, SK_MAGIC));
fset(f, FL_DH); fset(f, FL_DH);
} }
waddch(win, ')'); waddch(win, ')');
@ -453,7 +465,7 @@ ModifyPartei(faction * f)
if (u->faction == f && get_skill(u, SK_ALCHEMY)) { if (u->faction == f && get_skill(u, SK_ALCHEMY)) {
if (fval(f, FL_DH)) if (fval(f, FL_DH))
waddnstr(win, ", ", -1); waddnstr(win, ", ", -1);
wprintw(win, (NCURSES_CONST char*)"%s(%d): %d", unitid(u), u->number, get_skill(u, SK_ALCHEMY) / u->number); wprintw(win, (NCURSES_CONST char*)"%s(%d): %d", unitid(u), u->number, get_level(u, SK_ALCHEMY));
fset(f, FL_DH); fset(f, FL_DH);
} }
waddch(win, ')'); waddch(win, ')');

View File

@ -356,8 +356,7 @@ modify_talente(unit * u, region * r)
wmove(wn, 0, 3); wmove(wn, 0, 3);
waddnstr(wn, "< Talente >", -1); waddnstr(wn, "< Talente >", -1);
for (i = 0; i < MAXSKILLS; i++) { for (i = 0; i < MAXSKILLS; i++) {
q = get_skill(u, i); sprintf(buf, "%s %d", skillname(i, NULL), eff_skill(u, i, r));
sprintf(buf, "%s %d [%d]", skillname(i, NULL), eff_skill(u, i, r), q / u->number);
TL[i] = strdup(buf); TL[i] = strdup(buf);
if (L > 10) { if (L > 10) {
wmove(wn, i + 1, 4); wmove(wn, i + 1, 4);
@ -423,15 +422,15 @@ modify_talente(unit * u, region * r)
wmove(wn, x + 2, 39); wmove(wn, x + 2, 39);
waddch(wn, '|'); waddch(wn, '|');
wrefresh(wn); wrefresh(wn);
q = map_input(wn, 2, 2, "Tage pro Person", 0, 5000, get_skill(u, x) / u->number); q = map_input(wn, 2, 2, "Talentstufe", 0, 30, get_level(u, x));
} else { } else {
q = map_input(0, 0, 0, "Tage pro Person", 0, 5000, get_skill(u, x) / u->number); q = map_input(0, 0, 0, "Talentstufe", 0, 30, get_level(u, x));
touchwin(mywin); touchwin(mywin);
touchwin(wn); touchwin(wn);
wrefresh(mywin); /* altes Fenster überbügeln */ wrefresh(mywin); /* altes Fenster überbügeln */
} }
set_skill(u, x, q * u->number); set_level(u, x, q);
sprintf(buf, "%s %d [%d]", skillname(x, NULL), eff_skill(u, x, r), q); sprintf(buf, "%s %d", skillname(x, NULL), eff_skill(u, x, r));
free(TL[x]); free(TL[x]);
modif = 1; modif = 1;
TL[x] = strdup(buf); TL[x] = strdup(buf);
@ -498,12 +497,12 @@ modify_unit(region * r, unit * modunit)
x = 0; x = 0;
Addstr("Talente: "); Addstr("Talente: ");
for (sk = 0; sk != MAXSKILLS; sk++) { for (sk = 0; sk != MAXSKILLS; sk++) {
if ((a = get_skill(u, sk))!=0) { if (has_skill(u, sk)) {
if (x) { if (x) {
Addstr(", "); Addstr(", ");
q += 2; q += 2;
} }
sprintf(buf, "%s %d [%d]", skillname(sk, NULL), eff_skill(u, sk, r), a / u->number); sprintf(buf, "%s %d", skillname(sk, NULL), eff_skill(u, sk, r));
q += strlen(buf); q += strlen(buf);
if (q > SX - 8) { if (q > SX - 8) {
q = strlen(buf); q = strlen(buf);