forked from github/server
Bugfix Dämonenverschiebung
Bugfix Dämonenfressen Bugfix Allianzcode
This commit is contained in:
parent
92941d03e1
commit
5db83f6217
|
@ -1049,7 +1049,6 @@ randomevents(void)
|
||||||
region *r;
|
region *r;
|
||||||
building *b, *b2;
|
building *b, *b2;
|
||||||
unit *u;
|
unit *u;
|
||||||
int unfed;
|
|
||||||
|
|
||||||
/* Eiseberge */
|
/* Eiseberge */
|
||||||
for (r=regions; r; r=r->next) freset(r, RF_DH);
|
for (r=regions; r; r=r->next) freset(r, RF_DH);
|
||||||
|
@ -1152,7 +1151,6 @@ randomevents(void)
|
||||||
* sondern der Region zu gute kommt - und da ist der anwender schnuppe
|
* sondern der Region zu gute kommt - und da ist der anwender schnuppe
|
||||||
*/
|
*/
|
||||||
skill * sv;
|
skill * sv;
|
||||||
int dc;
|
|
||||||
if (!bfind) {
|
if (!bfind) {
|
||||||
unit * ud = u;
|
unit * ud = u;
|
||||||
while (ud) {
|
while (ud) {
|
||||||
|
@ -1163,14 +1161,25 @@ randomevents(void)
|
||||||
bfind = true;
|
bfind = true;
|
||||||
}
|
}
|
||||||
if (r->planep==0 || !fval(r->planep, PFL_NOFEED)) {
|
if (r->planep==0 || !fval(r->planep, PFL_NOFEED)) {
|
||||||
unfed = (u->number - bauernblut) - peasantfood;
|
int demons = u->number;
|
||||||
bauernblut = max(0, bauernblut-u->number);
|
if (bauernblut>=demons) {
|
||||||
if (unfed > 0) {
|
bauernblut -= demons;
|
||||||
|
demons = 0;
|
||||||
|
} else if (bauernblut) {
|
||||||
|
demons-=bauernblut;
|
||||||
|
}
|
||||||
|
if (peasantfood>=demons) {
|
||||||
|
peasantfood -= demons;
|
||||||
|
demons = 0;
|
||||||
|
} else {
|
||||||
|
demons-=peasantfood;
|
||||||
|
}
|
||||||
|
if (demons > 0) {
|
||||||
#ifdef DAEMON_HUNGER
|
#ifdef DAEMON_HUNGER
|
||||||
hunger(u, unfed); /* nicht gefütterte dämonen hungern */
|
hunger(u, demons); /* nicht gefütterte dämonen hungern */
|
||||||
#else
|
#else
|
||||||
c = 0;
|
c = 0;
|
||||||
for (n = 0; n < unfed; n++) {
|
for (n = 0; n != demons; n++) {
|
||||||
if (rand() % 100 < 10) {
|
if (rand() % 100 < 10) {
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
@ -1184,16 +1193,15 @@ randomevents(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dc = max(u->number - bauernblut, 0);
|
|
||||||
dc = min(dc, peasantfood);
|
|
||||||
dc = peasantfood - max(u->number - bauernblut, 0);
|
|
||||||
dc = max(0, dc);
|
|
||||||
sv = u->skills;
|
sv = u->skills;
|
||||||
while (sv!=u->skills+u->skill_size) {
|
while (sv!=u->skills+u->skill_size) {
|
||||||
if (sv->level>0 && rand() % 100 < 25) {
|
if (sv->level>0 && rand() % 100 < 25) {
|
||||||
int weeks = 1+rand()%3;
|
int weeks = 1+rand()%3;
|
||||||
if (rand() % 100 < 40) reduce_skill(u, sv, weeks);
|
if (rand() % 100 < 40) {
|
||||||
else while (weeks--) learn_skill(u, sv->id, 1.0);
|
reduce_skill(u, sv, weeks);
|
||||||
|
} else {
|
||||||
|
while (weeks--) learn_skill(u, sv->id, 1.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++sv;
|
++sv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1811,7 +1811,7 @@ list_address(FILE * F, const faction * uf, const faction_list * seenfactions)
|
||||||
const faction * f = flist->data;
|
const faction * f = flist->data;
|
||||||
if (f->no!=MONSTER_FACTION) {
|
if (f->no!=MONSTER_FACTION) {
|
||||||
sprintf(buf, "%s: %s; %s", factionname(f), f->email, f->banner);
|
sprintf(buf, "%s: %s; %s", factionname(f), f->email, f->banner);
|
||||||
rparagraph(F, buf, 4, ALLIED(uf, f)?'+':'*');
|
rparagraph(F, buf, 4, (char)(ALLIED(uf, f)?'+':'*'));
|
||||||
}
|
}
|
||||||
flist = flist->next;
|
flist = flist->next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,8 +402,6 @@ b_namequestportal(const border * b, const region * r, const struct faction * f,
|
||||||
return "gewaltiges offenes Tor";
|
return "gewaltiges offenes Tor";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
border_type bt_questportal = {
|
border_type bt_questportal = {
|
||||||
|
|
|
@ -1294,10 +1294,9 @@ use_oldresource(region * r, const resource_type * rtype, int norders)
|
||||||
#if GROWING_TREES
|
#if GROWING_TREES
|
||||||
int avail_grownup = rtrees(r,2);
|
int avail_grownup = rtrees(r,2);
|
||||||
int avail_young = rtrees(r,1);
|
int avail_young = rtrees(r,1);
|
||||||
int avail = avail_grownup + avail_young;
|
|
||||||
int wcount;
|
int wcount;
|
||||||
|
|
||||||
assert(norders <= avail);
|
assert(norders <= avail_grownup + avail_young);
|
||||||
|
|
||||||
if(norders <= avail_grownup) {
|
if(norders <= avail_grownup) {
|
||||||
rsettrees(r, 2, avail_grownup-norders);
|
rsettrees(r, 2, avail_grownup-norders);
|
||||||
|
|
|
@ -887,6 +887,7 @@ get_addresses(const faction * f, const seen_region * seenregions)
|
||||||
}
|
}
|
||||||
#ifdef ALLIANCES
|
#ifdef ALLIANCES
|
||||||
if(f->alliance != NULL) {
|
if(f->alliance != NULL) {
|
||||||
|
faction * f2;
|
||||||
for(f2 = factions; f2; f2 = f2->next) {
|
for(f2 = factions; f2; f2 = f2->next) {
|
||||||
if(f2->alliance != NULL && f2->alliance == f->alliance) {
|
if(f2->alliance != NULL && f2->alliance == f->alliance) {
|
||||||
faction_list ** fnew = &flist;
|
faction_list ** fnew = &flist;
|
||||||
|
|
|
@ -1524,6 +1524,7 @@ readunit(FILE * F)
|
||||||
} else {
|
} else {
|
||||||
rs(F, buf);
|
rs(F, buf);
|
||||||
if (strcmp(buf, "giant turtle")==0) strcpy(buf, "giantturtle");
|
if (strcmp(buf, "giant turtle")==0) strcpy(buf, "giantturtle");
|
||||||
|
if (strcmp(buf, "elf")==0) strcpy(buf, "demon");
|
||||||
u->race = rc_find(buf);
|
u->race = rc_find(buf);
|
||||||
assert(u->race);
|
assert(u->race);
|
||||||
rs(F, buf);
|
rs(F, buf);
|
||||||
|
|
|
@ -278,26 +278,29 @@ skill_weeks(int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
reduce_skill(unit *u, skill * sv, int weeks)
|
reduce_skill(unit * u, skill * sv, unsigned int weeks)
|
||||||
{
|
{
|
||||||
boolean reroll = false;
|
int reroll = false;
|
||||||
while (sv->level>0 && weeks>sv->level) {
|
while (sv->level>0 && weeks>sv->level) {
|
||||||
weeks -= sv->level;
|
weeks -= sv->level;
|
||||||
--sv->level;
|
--sv->level;
|
||||||
}
|
}
|
||||||
if (sv->level*2+1<sv->weeks) reroll = true;
|
if (sv->level*2+1<sv->weeks) reroll = true;
|
||||||
if (sv->level>0) {
|
if (sv->level>0) {
|
||||||
if (rand()%sv->level < weeks) {
|
sv->weeks+=weeks;
|
||||||
|
while (sv->level!=0 && sv->weeks>sv->level) {
|
||||||
|
weeks = sv->weeks-sv->level;
|
||||||
--sv->level;
|
--sv->level;
|
||||||
reroll = true;
|
sv->weeks = weeks;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
reroll = true;
|
|
||||||
}
|
}
|
||||||
if (reroll) sv->weeks = (unsigned char)skill_weeks(sv->level);
|
if (sv->level==0) {
|
||||||
assert(sv->weeks<=sv->level*2+1);
|
/* reroll */
|
||||||
|
sv->weeks = (unsigned char)skill_weeks(sv->level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
skill_compare(const skill * sk, const skill * sc)
|
skill_compare(const skill * sk, const skill * sc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,9 +24,9 @@ extern signed char skill_bonus(struct unit * u, struct region * r);
|
||||||
|
|
||||||
typedef struct skill {
|
typedef struct skill {
|
||||||
unsigned char id;
|
unsigned char id;
|
||||||
unsigned char level;
|
unsigned int level : 8;
|
||||||
unsigned char weeks;
|
unsigned int weeks : 8;
|
||||||
unsigned char old;
|
unsigned int old : 8;
|
||||||
} skill;
|
} skill;
|
||||||
|
|
||||||
typedef struct skillmod_data {
|
typedef struct skillmod_data {
|
||||||
|
@ -50,7 +50,7 @@ extern int level_days(int level);
|
||||||
extern int level(int days);
|
extern int level(int days);
|
||||||
|
|
||||||
#define skill_level(level) (level)
|
#define skill_level(level) (level)
|
||||||
extern void reduce_skill(struct unit *u, skill * sv, int change);
|
extern void reduce_skill(struct unit *u, skill * sv, unsigned int change);
|
||||||
extern int skill_weeks(int level);
|
extern int skill_weeks(int level);
|
||||||
extern int skill_compare(const skill * sk, const skill * sc);
|
extern int skill_compare(const skill * sk, const skill * sc);
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,9 @@ read_gmcreate(attrib * a, FILE * F)
|
||||||
const item_type ** p_itype = (const item_type **)&a->data.v;
|
const item_type ** p_itype = (const item_type **)&a->data.v;
|
||||||
fscanf(F, "%s", zText);
|
fscanf(F, "%s", zText);
|
||||||
*p_itype = it_find(zText);
|
*p_itype = it_find(zText);
|
||||||
assert(*p_itype);
|
if (a->data.v==NULL) {
|
||||||
|
log_error(("unknown itemtype %s in gmcreate attribute\n", zText));
|
||||||
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue