forked from github/server
handelsgüterfix. faction rr bekommt gm-permissions. übersetzung alte->neue hashcodes. alte hashcodes aktiv.
This commit is contained in:
parent
0467736f70
commit
2bb8563278
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: creation.c,v 1.4 2001/02/03 13:45:28 enno Exp $
|
* $Id: creation.c,v 1.5 2001/02/10 19:24:04 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)
|
||||||
|
@ -52,8 +52,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static int g_maxluxuries;
|
|
||||||
|
|
||||||
/* eine insel pro 9x9 feld. das erste feld von (0,0) bis (8,8) */
|
/* eine insel pro 9x9 feld. das erste feld von (0,0) bis (8,8) */
|
||||||
|
|
||||||
/* Ozean und Grasland wird automatisch generiert (ein Ozean, darin eine Insel
|
/* Ozean und Grasland wird automatisch generiert (ein Ozean, darin eine Insel
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: economy.c,v 1.5 2001/02/10 14:17:59 enno Exp $
|
* $Id: economy.c,v 1.6 2001/02/10 19:24:04 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)
|
||||||
|
@ -1144,16 +1144,13 @@ maintain(building * b, boolean full)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
gebaeude_stuerzt_ein(region * r, building * b)
|
gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
int n, i;
|
int n, i;
|
||||||
direction_t d;
|
direction_t d;
|
||||||
int opfer = 0;
|
int opfer = 0;
|
||||||
faction *f;
|
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) freset(f, FL_DH);
|
|
||||||
|
|
||||||
sprintf(buf, "%s stürzte ein.", buildingname(b));
|
sprintf(buf, "%s stürzte ein.", buildingname(b));
|
||||||
|
|
||||||
|
@ -1171,7 +1168,7 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
if (u->building == b) {
|
if (u->building == b) {
|
||||||
int loss = 0;
|
int loss = 0;
|
||||||
|
|
||||||
fset(u->faction, FL_DH);
|
fset(u->faction, FL_MARK);
|
||||||
freset(u, FL_OWNER);
|
freset(u, FL_OWNER);
|
||||||
leave(r,u);
|
leave(r,u);
|
||||||
n = u->number;
|
n = u->number;
|
||||||
|
@ -1197,10 +1194,14 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
scat(" zu beklagen.");
|
scat(" zu beklagen.");
|
||||||
} else buf[0] = 0;
|
} else buf[0] = 0;
|
||||||
addmessage(r, 0, buf, MSG_EVENT, ML_IMPORTANT);
|
addmessage(r, 0, buf, MSG_EVENT, ML_IMPORTANT);
|
||||||
for (f = factions; f; f = f->next)
|
for (u=r->units; u; u=u->next) {
|
||||||
if (fval(f, FL_DH))
|
faction * f = u->faction;
|
||||||
|
if (fval(f, FL_MARK)) {
|
||||||
|
freset(u->faction, FL_MARK);
|
||||||
add_message(&f->msgs,
|
add_message(&f->msgs,
|
||||||
new_message(f, "buildingcrash%r:region%b:building%s:opfer", r, b, buf));
|
new_message(f, "buildingcrash%r:region%b:building%s:opfer", r, b, buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
destroy_building(b);
|
destroy_building(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: battle.c,v 1.9 2001/02/10 10:40:11 enno Exp $
|
* $Id: battle.c,v 1.10 2001/02/10 19:24:05 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)
|
||||||
|
@ -648,7 +648,7 @@ weapon_effskill(troop t, troop enemy, const weapon * w, boolean attacking, boole
|
||||||
if (riding(t) && (wtype==NULL || !fval(wtype, WTF_MISSILE))) {
|
if (riding(t) && (wtype==NULL || !fval(wtype, WTF_MISSILE))) {
|
||||||
skill += 2;
|
skill += 2;
|
||||||
#ifdef BETA_CODE
|
#ifdef BETA_CODE
|
||||||
skill = skillmod(urace(tu)->attribs, tu, tu->region, wtype->skill, skill, SMF_RIDING);
|
if (wtype) skill = skillmod(urace(tu)->attribs, tu, tu->region, wtype->skill, skill, SMF_RIDING);
|
||||||
#else
|
#else
|
||||||
if (tu->race == RC_TROLL) skill--;
|
if (tu->race == RC_TROLL) skill--;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: eressea.h,v 1.15 2001/02/10 14:18:00 enno Exp $
|
* $Id: eressea.h,v 1.16 2001/02/10 19:24:05 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)
|
||||||
|
@ -141,7 +141,7 @@ typedef struct settings {
|
||||||
} settings;
|
} settings;
|
||||||
extern settings global;
|
extern settings global;
|
||||||
|
|
||||||
#define RELEASE_VERSION NEWHASH_VERSION
|
#define RELEASE_VERSION NEWSOURCE_VERSION
|
||||||
#define ECHECK_VERSION "3.10"
|
#define ECHECK_VERSION "3.10"
|
||||||
|
|
||||||
/* changes from->to: 72->73: struct unit::lock entfernt.
|
/* changes from->to: 72->73: struct unit::lock entfernt.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: message.c,v 1.4 2001/02/10 11:38:29 enno Exp $
|
* $Id: message.c,v 1.5 2001/02/10 19:24:05 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)
|
||||||
|
@ -193,7 +193,18 @@ mistake(const unit * u, const char *command, const char *comment, int mtype)
|
||||||
xmistake(u, command, gc_add(strdup(translate_regions(comment, u->faction))), mtype);
|
xmistake(u, command, gc_add(strdup(translate_regions(comment, u->faction))), mtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
messagetype * messagetypes;
|
static messagetype * messagetypes;
|
||||||
|
|
||||||
|
extern unsigned int new_hashstring(const char* s);
|
||||||
|
void
|
||||||
|
debug_messagetypes(FILE * out)
|
||||||
|
{
|
||||||
|
messagetype * mt;
|
||||||
|
for (mt=messagetypes;mt;mt=mt->next) {
|
||||||
|
fprintf(out, "%u->%u;%s\n", mt->hashkey, new_hashstring(mt->name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
messagetype *
|
messagetype *
|
||||||
new_messagetype(const char * name, int level, const char * section)
|
new_messagetype(const char * name, int level, const char * section)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: message.h,v 1.2 2001/01/26 16:19:40 enno Exp $
|
* $Id: message.h,v 1.3 2001/02/10 19:24:05 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)
|
||||||
|
@ -88,4 +88,6 @@ void read_msglevels(struct warning ** w, FILE * F);
|
||||||
void set_msglevel(struct warning ** warnings, const char * type, int level);
|
void set_msglevel(struct warning ** warnings, const char * type, int level);
|
||||||
int get_msglevel(const struct warning * warnings, const msglevel * levels, const messagetype * mtype);
|
int get_msglevel(const struct warning * warnings, const msglevel * levels, const messagetype * mtype);
|
||||||
|
|
||||||
|
void debug_messagetypes(FILE * out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: region.c,v 1.7 2001/02/05 16:11:58 enno Exp $
|
* $Id: region.c,v 1.8 2001/02/10 19:24:05 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)
|
||||||
|
@ -346,12 +346,10 @@ reldirection(region * from, region * to)
|
||||||
void
|
void
|
||||||
free_regionlist(regionlist *rl)
|
free_regionlist(regionlist *rl)
|
||||||
{
|
{
|
||||||
regionlist *rl2;
|
while (rl) {
|
||||||
|
regionlist * rl2 = rl->next;
|
||||||
while(rl != NULL) {
|
free(rl);
|
||||||
rl2 = rl;
|
rl = rl2;
|
||||||
rl = rl->next;
|
|
||||||
free(rl2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: region.h,v 1.3 2001/02/03 13:45:32 enno Exp $
|
* $Id: region.h,v 1.4 2001/02/10 19:24:05 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)
|
||||||
|
@ -118,7 +118,7 @@ void runhash(struct region * r);
|
||||||
|
|
||||||
typedef struct regionlist {
|
typedef struct regionlist {
|
||||||
struct regionlist *next;
|
struct regionlist *next;
|
||||||
struct region *region;
|
struct region *region;
|
||||||
} regionlist;
|
} regionlist;
|
||||||
|
|
||||||
void free_regionlist(regionlist *rl);
|
void free_regionlist(regionlist *rl);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: render.c,v 1.4 2001/02/10 11:38:29 enno Exp $
|
* $Id: render.c,v 1.5 2001/02/10 19:24:05 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)
|
||||||
|
@ -255,7 +255,7 @@ render_immediate(const message * m, const char * find, localizer * l)
|
||||||
struct entry * e = m->type->entries;
|
struct entry * e = m->type->entries;
|
||||||
++p;
|
++p;
|
||||||
if (*p=='$') {
|
if (*p=='$') {
|
||||||
int key;
|
unsigned int key;
|
||||||
eval * e;
|
eval * e;
|
||||||
++p;
|
++p;
|
||||||
while (*p!=' ') *f++ = *p++;
|
while (*p!=' ') *f++ = *p++;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: save.c,v 1.14 2001/02/10 15:27:09 corwin Exp $
|
* $Id: save.c,v 1.15 2001/02/10 19:24:05 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)
|
||||||
|
@ -961,7 +961,7 @@ readgame(boolean backup)
|
||||||
} else {
|
} else {
|
||||||
firstx=0;
|
firstx=0;
|
||||||
firsty=0;
|
firsty=0;
|
||||||
if (maxregions>0) n = min(n, maxregions)-1;
|
if (maxregions>0) maxregions = min(n, maxregions)-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxregions==0) skip = true;
|
if (maxregions==0) skip = true;
|
||||||
|
|
|
@ -60,13 +60,19 @@ read_permissions(attrib * a, FILE * F)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct attrib_type at_permissions = {
|
struct attrib_type at_permissions = {
|
||||||
"GM:permissions",
|
"GM:permissions",
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
write_permissions, read_permissions,
|
write_permissions, read_permissions,
|
||||||
ATF_UNIQUE
|
ATF_UNIQUE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
attrib *
|
||||||
|
make_atpermissions(void)
|
||||||
|
{
|
||||||
|
return a_new(&at_permissions);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** GM: CREATE <number> <itemtype>
|
** GM: CREATE <number> <itemtype>
|
||||||
**/
|
**/
|
||||||
|
@ -95,7 +101,7 @@ static attrib_type at_gmcreate = {
|
||||||
write_gmcreate, read_gmcreate
|
write_gmcreate, read_gmcreate
|
||||||
};
|
};
|
||||||
|
|
||||||
static attrib *
|
attrib *
|
||||||
make_atgmcreate(const struct item_type * itype)
|
make_atgmcreate(const struct item_type * itype)
|
||||||
{
|
{
|
||||||
attrib * a = a_new(&at_gmcreate);
|
attrib * a = a_new(&at_gmcreate);
|
||||||
|
@ -175,21 +181,6 @@ init_gmcmd(void)
|
||||||
add_gmcommand(&g_cmds, "gm", &gm_command);
|
add_gmcommand(&g_cmds, "gm", &gm_command);
|
||||||
add_gmcommand(&g_cmds, "terraform", &gm_terraform);
|
add_gmcommand(&g_cmds, "terraform", &gm_terraform);
|
||||||
add_gmcommand(&g_cmds, "create", &gm_create);
|
add_gmcommand(&g_cmds, "create", &gm_create);
|
||||||
|
|
||||||
{
|
|
||||||
faction * f = findfaction(atoi36("rr"));
|
|
||||||
if (f) {
|
|
||||||
attrib * a = a_find(f->attribs, &at_permissions);
|
|
||||||
if (!a) {
|
|
||||||
item_type * itype;
|
|
||||||
a = a_add(&f->attribs, a_new(&at_permissions));
|
|
||||||
for (itype=itemtypes;itype;itype=itype->next) {
|
|
||||||
a_add((attrib**)&a->data.v, make_atgmcreate(itype));
|
|
||||||
}
|
|
||||||
a_add((attrib**)&a->data.v, make_key(atoi36("gmtf")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: goodies.c,v 1.4 2001/02/10 11:38:29 enno Exp $
|
* $Id: goodies.c,v 1.5 2001/02/10 19:24:05 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)
|
||||||
|
@ -58,7 +58,20 @@ intlist_find(int *i_p, int fi)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
hashstring(const char* s)
|
old_hashstring(const char* s)
|
||||||
|
{
|
||||||
|
int key = 0;
|
||||||
|
int i = strlen(s);
|
||||||
|
|
||||||
|
while (i) {
|
||||||
|
--i;
|
||||||
|
key = ((key >> 31) & 1) ^ (key << 1) ^ s[i];
|
||||||
|
}
|
||||||
|
return key & 0x7fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
new_hashstring(const char* s)
|
||||||
{
|
{
|
||||||
unsigned int key = 0;
|
unsigned int key = 0;
|
||||||
int i = strlen(s);
|
int i = strlen(s);
|
||||||
|
@ -69,6 +82,15 @@ hashstring(const char* s)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
hashstring(const char* s)
|
||||||
|
{
|
||||||
|
#if RELEASE_VERSION < NEWHASH_VERSION
|
||||||
|
return old_hashstring(s);
|
||||||
|
#else
|
||||||
|
return new_hashstring(s);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
/* Standardfunktion aus Sedgewick: Algorithmen in C++ */
|
/* Standardfunktion aus Sedgewick: Algorithmen in C++ */
|
||||||
|
|
||||||
#define HASH_MAX 100001
|
#define HASH_MAX 100001
|
||||||
|
|
|
@ -54,6 +54,18 @@ Package=<4>
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "echeck"=..\echeck\echeck.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
Project: "eressea"=".\eressea\eressea-6.dsp" - Package Owner=<4>
|
Project: "eressea"=".\eressea\eressea-6.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: korrektur.c,v 1.19 2001/02/10 14:18:00 enno Exp $
|
* $Id: korrektur.c,v 1.20 2001/02/10 19:24:05 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)
|
||||||
|
@ -1204,36 +1204,134 @@ count_demand(const region *r)
|
||||||
{
|
{
|
||||||
struct demand *dmd;
|
struct demand *dmd;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for (dmd=r->land->demands;dmd;dmd=dmd->next) c++;
|
if (r->land) {
|
||||||
|
for (dmd=r->land->demands;dmd;dmd=dmd->next) c++;
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
fix_demand_region(const region *r)
|
recurse_regions(region * r, regionlist **rlist, boolean(*fun)(const region * r))
|
||||||
{
|
{
|
||||||
direction_t d;
|
if (!fun(r)) return 0;
|
||||||
|
else {
|
||||||
|
int len = 0;
|
||||||
|
direction_t d;
|
||||||
|
regionlist * rl = calloc(sizeof(regionlist), 1);
|
||||||
|
rl->next = *rlist;
|
||||||
|
rl->region = r;
|
||||||
|
(*rlist) = rl;
|
||||||
|
fset(r, FL_MARK);
|
||||||
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
|
region * nr = rconnect(r, d);
|
||||||
|
if (nr && !fval(nr, FL_MARK)) len += recurse_regions(nr, rlist, fun);
|
||||||
|
}
|
||||||
|
return len+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
static int maxluxuries = 0;
|
||||||
region *nr = rconnect(r, d);
|
|
||||||
if (nr && nr->land && count_demand(nr) != 7) {
|
|
||||||
const luxury_type *sale=NULL;
|
|
||||||
const luxury_type *ltype;
|
|
||||||
struct demand *dmd, *dmd2;
|
|
||||||
|
|
||||||
for(dmd = nr->land->demands; dmd; dmd=dmd->next)
|
static boolean
|
||||||
if(dmd->value == 0) sale = dmd->type;
|
f_nolux(const region * r)
|
||||||
|
{
|
||||||
|
if (r->land && count_demand(r) != maxluxuries) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
dmd2 = NULL;
|
static void
|
||||||
for (ltype = luxurytypes;ltype;ltype=ltype->next) {
|
fix_demand_region(region *r)
|
||||||
dmd = malloc(sizeof(struct demand));
|
{
|
||||||
dmd->type = ltype;
|
regionlist *rl, *rlist = NULL;
|
||||||
if(ltype == sale) {
|
static const luxury_type **mlux = 0, ** ltypes;
|
||||||
dmd->value = 0;
|
const luxury_type *sale = NULL;
|
||||||
} else {
|
int maxlux = 0;
|
||||||
dmd->value = 1+rand()%5;
|
|
||||||
|
recurse_regions(r, &rlist, f_nolux);
|
||||||
|
if (mlux==0) {
|
||||||
|
int i = 0;
|
||||||
|
if (maxluxuries==0) for (sale=luxurytypes;sale;sale=sale->next) {
|
||||||
|
maxluxuries++;
|
||||||
|
}
|
||||||
|
mlux = (const luxury_type **)gc_add(calloc(maxluxuries, sizeof(const luxury_type *)));
|
||||||
|
ltypes = (const luxury_type **)gc_add(calloc(maxluxuries, sizeof(const luxury_type *)));
|
||||||
|
for (sale=luxurytypes;sale;sale=sale->next) {
|
||||||
|
ltypes[i++] = sale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int i;
|
||||||
|
for (i=0;i!=maxluxuries;++i) mlux[i] = 0;
|
||||||
|
}
|
||||||
|
for (rl=rlist;rl;rl=rl->next) {
|
||||||
|
region * r = rl->region;
|
||||||
|
direction_t d;
|
||||||
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
|
region * nr = rconnect(r, d);
|
||||||
|
if (nr && nr->land && nr->land->demands) {
|
||||||
|
struct demand * dmd;
|
||||||
|
for (dmd = nr->land->demands;dmd;dmd=dmd->next) {
|
||||||
|
if (dmd->value == 0) {
|
||||||
|
int i;
|
||||||
|
for (i=0;i!=maxluxuries;++i) {
|
||||||
|
if (mlux[i]==NULL) {
|
||||||
|
maxlux = i;
|
||||||
|
mlux[i] = dmd->type;
|
||||||
|
break;
|
||||||
|
} else if (mlux[i]==dmd->type) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
freset(r, FL_MARK); /* undo recursive marker */
|
||||||
|
}
|
||||||
|
if (maxlux<2) {
|
||||||
|
int i;
|
||||||
|
for (i=maxlux;i!=2;++i) {
|
||||||
|
int j;
|
||||||
|
do {
|
||||||
|
int k = rand() % maxluxuries;
|
||||||
|
mlux[i] = ltypes[k];
|
||||||
|
for (j=0;j!=i;++j) {
|
||||||
|
if (mlux[j]==mlux[i]) break;
|
||||||
|
}
|
||||||
|
} while (j!=i);
|
||||||
|
}
|
||||||
|
maxlux=2;
|
||||||
|
}
|
||||||
|
for (rl=rlist;rl;rl=rl->next) {
|
||||||
|
region * r = rl->region;
|
||||||
|
setluxuries(r, mlux[rand() % maxlux]);
|
||||||
|
}
|
||||||
|
while (rlist) {
|
||||||
|
rl = rlist->next;
|
||||||
|
free(rlist);
|
||||||
|
rlist = rl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern attrib * make_atgmcreate(const struct item_type * itype);
|
||||||
|
extern attrib * make_atpermissions(void);
|
||||||
|
extern struct attrib_type at_permissions;
|
||||||
|
|
||||||
|
static void
|
||||||
|
make_gms(void)
|
||||||
|
{
|
||||||
|
faction * f = findfaction(atoi36("rr"));
|
||||||
|
if (f) {
|
||||||
|
attrib * a = a_find(f->attribs, &at_permissions);
|
||||||
|
if (!a) {
|
||||||
|
item_type * itype;
|
||||||
|
a = a_add(&f->attribs, make_atpermissions());
|
||||||
|
for (itype=itemtypes;itype;itype=itype->next) {
|
||||||
|
a_add((attrib**)&a->data.v, make_atgmcreate(itype));
|
||||||
|
}
|
||||||
|
a_add((attrib**)&a->data.v, make_key(atoi36("gmtf")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1241,9 +1339,14 @@ static void
|
||||||
fix_demand(void)
|
fix_demand(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
const luxury_type *sale = NULL;
|
||||||
|
|
||||||
for (r=regions; r; r=r->next) if (r->land) {
|
if (maxluxuries==0) for (sale=luxurytypes;sale;sale=sale->next) ++maxluxuries;
|
||||||
if (count_demand(r) != 7) fix_demand_region(r);
|
|
||||||
|
for (r=regions; r; r=r->next) {
|
||||||
|
if ((r->land) && count_demand(r) != maxluxuries) {
|
||||||
|
fix_demand_region(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1804,7 +1907,7 @@ korrektur(void)
|
||||||
#ifdef TEST_GM_COMMANDS
|
#ifdef TEST_GM_COMMANDS
|
||||||
setup_gm_faction();
|
setup_gm_faction();
|
||||||
#endif
|
#endif
|
||||||
|
make_gms();
|
||||||
/* Wieder entfernen! */
|
/* Wieder entfernen! */
|
||||||
do_once(atoi36("trgr"), fix_targetregion_resolve())
|
do_once(atoi36("trgr"), fix_targetregion_resolve())
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: main.c,v 1.11 2001/02/05 16:27:07 enno Exp $
|
* $Id: main.c,v 1.12 2001/02/10 19:24:05 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)
|
||||||
|
@ -535,6 +535,12 @@ main(int argc, char *argv[])
|
||||||
kernel_init();
|
kernel_init();
|
||||||
game_init();
|
game_init();
|
||||||
|
|
||||||
|
{
|
||||||
|
FILE * F = fopen("c:\\messagetypes.txt", "wt");
|
||||||
|
debug_messagetypes(F);
|
||||||
|
fclose(F);
|
||||||
|
}
|
||||||
|
|
||||||
if ((i=readgame(false))!=0) return i;
|
if ((i=readgame(false))!=0) return i;
|
||||||
if ((i=processturn(orders))!=0) return i;
|
if ((i=processturn(orders))!=0) return i;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue