* Doppelte keys (entfernt aber nicht die, die schon im DF sind)

* Neue Queste
* Bugfix Irrlichter
This commit is contained in:
Enno Rehling 2002-03-02 19:26:39 +00:00
parent e7c9e10b98
commit f285f5a104
5 changed files with 38 additions and 87 deletions

View File

@ -26,6 +26,14 @@ attrib_type at_key = {
a_readdefault,
};
attrib *
add_key(attrib ** alist, int key)
{
attrib * a = find_key(*alist, key);
if (a==NULL) a = a_add(alist, make_key(key));
return a;
}
attrib *
make_key(int key)
{

View File

@ -16,4 +16,5 @@ extern struct attrib_type at_key;
extern struct attrib * make_key(int key);
extern struct attrib * find_key(struct attrib * alist, int key);
extern struct attrib * add_key(struct attrib ** alist, int key);
extern void init_key(void);

View File

@ -38,6 +38,7 @@
#include "race.h"
#include "region.h"
#include "render.h"
#include "spell.h"
#include "ship.h"
#include "skill.h"
#include "unit.h"
@ -1020,6 +1021,8 @@ travel(region * first, unit * u, region * next, int flucht)
while (b) {
if (b->type==&bt_wisps) {
wall_data * wd = (wall_data*)b->data;
if (wd->active) {
region * rl = rconnect(current, (direction_t)((dir+MAXDIRECTIONS-1)%MAXDIRECTIONS));
region * rr = rconnect(current, (direction_t)((dir+1)%MAXDIRECTIONS));
int j = rand() % 3;
@ -1028,6 +1031,7 @@ travel(region * first, unit * u, region * next, int flucht)
else if (j==2 && rr && landregion(rterrain(rr))==landregion(rterrain(next))) next = rr;
break;
}
}
if (b->type->move) b->type->move(b, u, current, next);
b = b->next;
}

View File

@ -678,14 +678,14 @@ gm_addquest(const char * email, const char * name, int radius, unsigned int flag
/* generic permissions */
a = a_add(&f->attribs, a_new(&at_permissions));
a_add((attrib**)&a->data.v, make_key(atoi36("gmterf")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmgate")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmtele")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmgive")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmskil")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmtake")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmmsgr")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmmsgu")));
add_key((attrib**)&a->data.v, atoi36("gmterf"));
add_key((attrib**)&a->data.v, atoi36("gmtele"));
add_key((attrib**)&a->data.v, atoi36("gmgive"));
add_key((attrib**)&a->data.v, atoi36("gmskil"));
add_key((attrib**)&a->data.v, atoi36("gmtake"));
add_key((attrib**)&a->data.v, atoi36("gmmsgr"));
add_key((attrib**)&a->data.v, atoi36("gmmsgu"));
add_key((attrib**)&a->data.v, atoi36("gmgate"));
a_add((attrib**)&a->data.v, make_atgmcreate(resource2item(r_silver)));
@ -716,7 +716,7 @@ gm_addfaction(const char * email, plane * p, region * r)
assert(p!=NULL);
/* GM faction */
a_add(&f->attribs, make_key(atoi36("quest")));
add_key(&f->attribs, atoi36("quest"));
f->banner = strdup("Questenpartei");
f->passw = strdup(itoa36(rand()));
f->email = strdup(email);
@ -740,14 +740,14 @@ gm_addfaction(const char * email, plane * p, region * r)
/* generic permissions */
a = a_add(&f->attribs, a_new(&at_permissions));
a_add((attrib**)&a->data.v, make_key(atoi36("gmterf")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmgate")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmtele")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmgive")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmskil")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmtake")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmmsgr")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmmsgu")));
add_key((attrib**)&a->data.v, atoi36("gmterf"));
add_key((attrib**)&a->data.v, atoi36("gmtele"));
add_key((attrib**)&a->data.v, atoi36("gmgive"));
add_key((attrib**)&a->data.v, atoi36("gmskil"));
add_key((attrib**)&a->data.v, atoi36("gmtake"));
add_key((attrib**)&a->data.v, atoi36("gmmsgr"));
add_key((attrib**)&a->data.v, atoi36("gmmsgu"));
add_key((attrib**)&a->data.v, atoi36("gmgate"));
a_add((attrib**)&a->data.v, make_atgmcreate(resource2item(r_silver)));
@ -809,39 +809,3 @@ gm_addplane(int radius, unsigned int flags, const char * name)
}
return p;
}
#ifdef TEST_GM_COMMANDS
void
setup_gm_faction(void)
{
int i = atoi36("gms")-1;
faction * f = factions;
unit * newunit;
region * r = regions;
attrib * a;
do {
f = findfaction(++i);
} while (f);
f = (faction *) calloc(1, sizeof(faction));
f->no = i;
set_string(&f->email, "gms@eressea-pbem.de");
set_string(&f->passw, "geheim");
set_string(&f->name, "GMs");
f->alive = 1;
f->options |= (1 << O_REPORT);
f->options |= (1 << O_COMPUTER);
addlist(&factions, f);
a = a_add(&f->attribs, a_new(&at_permissions));
a_add((attrib**)&a->data.v, make_atgmcreate(&it_demonseye));
a_add((attrib**)&a->data.v, make_key(atoi36("gmtf")));
while (r && !r->land) r=r->next;
newunit = createunit(r, f, 1, RC_DAEMON);
set_string(&newunit->name, "Flamdring, Gott des Feuers");
set_money(newunit, 100);
fset(newunit, FL_ISNEW);
}
#endif

View File

@ -1064,9 +1064,7 @@ update_gms(void)
int k;
item_t i;
for (k=0;keys[k];++k) {
if (!find_key((attrib*)permissions->data.v, atoi36(keys[k]))) {
a_add((attrib**)&permissions->data.v, make_key(atoi36(keys[k])));
}
add_key((attrib**)&permissions->data.v, atoi36(keys[k]));
}
for (i=I_GREATSWORD;i!=I_KEKS;++i) {
attrib * a = a_find(permissions, &at_gmcreate);
@ -1940,30 +1938,6 @@ test_gmquest(void)
}
#endif
#if 0
static int
create_xe(void)
{
attrib *a;
plane * p = gm_addplane(4, PFL_NOCOORDS | PFL_NORECRUITS |
PFL_NOGIVE | PFL_NOATTACK | PFL_NOTERRAIN | PFL_NOMAGIC |
PFL_NOSTEALTH | PFL_NOTEACH | PFL_NOBUILD | PFL_NOFEED,
"Xontormia-Expreß");
region * center = findregion(p->minx+(p->maxx-p->minx)/2, p->miny+(p->maxy-p->miny)/2);
faction * f = gm_addfaction("abeer@gmx.de", p, center);
log_printf("Xe-Partei %s\n", factionname(f));
a = a_find(f->attribs, &at_permissions);
a_remove(&f->attribs, a);
a = a_add(&f->attribs, a_new(&at_permissions));
a_add((attrib**)&a->data.v, make_key(atoi36("gmterf")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmmsgr")));
a_add((attrib**)&a->data.v, make_key(atoi36("gmmsgu")));
return 0;
}
#endif
#define TEST_LOCALES 0
#if TEST_LOCALES
static void