forked from github/server
* mapper: parteien aus newfaction.<turn> einlesen. erkläre ich noch.
* PFLANZE repariert * Kampfzaubernutzung von statusrow repariert * Alte Orks sind keine playerrrace mehr. * Auch Snotlinge, die Magie/Alchemie gelernt haben, aber noch T0 sind, werden konvertiert. * Das Erstrundenpasswort erscheint im CR. * Anzeige von Parteitarnung im CR repariert. * mapper-makros auf pdcurses-kompatibilität angepasst. * mapper: SeedPartei ('s') entfernt.
This commit is contained in:
parent
1d625d1683
commit
bb0aa209e8
|
@ -562,14 +562,14 @@ cr_output_unit(FILE * F, const region * r,
|
|||
fprintf(F, "%d;Partei\n", u->faction->no);
|
||||
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
|
||||
if (fval(u, FL_PARTEITARNUNG))
|
||||
fprintf(F, "%d;Parteitarnung\n", fval(u, FL_PARTEITARNUNG));
|
||||
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, FL_PARTEITARNUNG)));
|
||||
if (a_otherfaction)
|
||||
fprintf(F, "%d;Anderepartei\n", a_otherfaction->data.i);
|
||||
} else {
|
||||
const attrib * a = a_find(u->attribs, &at_group);
|
||||
if (fval(u, FL_PARTEITARNUNG)) {
|
||||
/* faction info is hidden */
|
||||
fprintf(F, "%d;Parteitarnung\n", fval(u, FL_PARTEITARNUNG));
|
||||
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, FL_PARTEITARNUNG)));
|
||||
} else {
|
||||
/* other unit. show visible faction, not u->faction */
|
||||
fprintf(F, "%d;Partei\n", sf->no);
|
||||
|
|
|
@ -2512,6 +2512,7 @@ plant(region *r, unit *u, int raw)
|
|||
|
||||
/* Skill prüfen */
|
||||
skill = eff_skill(u, SK_HERBALISM, r);
|
||||
htype = rherbtype(r);
|
||||
if (skill < 6) {
|
||||
add_message(&u->faction->msgs,
|
||||
msg_error(u, findorder(u, u->thisorder), "plant_skills",
|
||||
|
@ -2525,7 +2526,6 @@ plant(region *r, unit *u, int raw)
|
|||
oldresourcetype[R_TREES]));
|
||||
return;
|
||||
}
|
||||
htype = rherbtype(r);
|
||||
n = new_get_pooled(u, htype->itype->rtype, GET_DEFAULT);
|
||||
/* Kräuter prüfen */
|
||||
if (n==0) {
|
||||
|
|
|
@ -2062,7 +2062,7 @@ set_passw(void)
|
|||
if(!isalnum(*c)) pwok = false;
|
||||
c++;
|
||||
}
|
||||
if(pwok == false) {
|
||||
if (pwok == false) {
|
||||
cmistake(u, S->s, 283, MSG_EVENT);
|
||||
for(i=0; i<6; i++) pbuf[i] = (char)(97 + rand() % 26);
|
||||
pbuf[6] = 0;
|
||||
|
|
|
@ -1871,6 +1871,10 @@ report(FILE *F, faction * f, const faction_list * addresses,
|
|||
}
|
||||
|
||||
if (f->age <= 2) {
|
||||
if (f->age <= 1) {
|
||||
ADDMSG(&f->msgs, msg_message("changepasswd",
|
||||
"value", gc_add(strdup(buf))));
|
||||
}
|
||||
RENDER(f, buf, sizeof(buf), ("newbie_password", "password", f->passw));
|
||||
rnl(F);
|
||||
centre(F, buf, true);
|
||||
|
|
|
@ -235,8 +235,8 @@ extern struct region * fleeregion(const struct unit * u);
|
|||
extern boolean enemy (const struct side * a, const struct side * b);
|
||||
extern struct troop select_corpse(struct battle * b, struct fighter * af);
|
||||
extern fighter * make_fighter(struct battle * b, struct unit * u, boolean attack);
|
||||
void flee(const troop dt);
|
||||
void drain_exp(struct unit *u, int d);
|
||||
extern int statusrow(int status);
|
||||
extern void flee(const troop dt);
|
||||
extern void drain_exp(struct unit *u, int d);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -82,7 +82,7 @@ unused_faction_id(void)
|
|||
}
|
||||
|
||||
unit *
|
||||
addplayer(region *r, char *email, const struct race * frace, locale *loc)
|
||||
addplayer(region *r, const char *email, const struct race * frace, const locale *loc)
|
||||
{
|
||||
int i;
|
||||
unit *u;
|
||||
|
@ -93,6 +93,7 @@ addplayer(region *r, char *email, const struct race * frace, locale *loc)
|
|||
|
||||
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
||||
set_string(&f->passw, buf);
|
||||
|
||||
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
||||
set_string(&f->override, buf);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct faction {
|
|||
char *email;
|
||||
char *passw;
|
||||
char *override;
|
||||
struct locale * locale;
|
||||
const struct locale * locale;
|
||||
int lastorders; /* enno: short? */
|
||||
int age; /* enno: short? */
|
||||
ursprung *ursprung;
|
||||
|
@ -77,7 +77,7 @@ typedef struct faction_list {
|
|||
extern const struct unit * random_unit_in_faction(const struct faction *f);
|
||||
extern const char * factionname(const struct faction * f);
|
||||
extern void * resolve_faction(void * data);
|
||||
extern struct unit * addplayer(struct region *r, char *email, const struct race * frace, struct locale *loc);
|
||||
extern struct unit * addplayer(struct region *r, const char *email, const struct race * frace, const struct locale *loc);
|
||||
extern boolean checkpasswd(faction * f, const char * passwd);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -586,7 +586,7 @@ sp_summon_familiar(castorder *co)
|
|||
|
||||
dh = 0;
|
||||
dh1 = 0;
|
||||
sprintf(buf, "%s ruft einen Vertrauten. %s können ",
|
||||
sprintf(buf, "%s ruft einen Vertrauten. %s können ",
|
||||
unitname(mage), LOC(mage->faction->locale, rc_name(rc, 1)));
|
||||
for(sk=0;sk<MAXSKILLS;sk++){
|
||||
if(rc->bonus[sk] > -5) dh++;
|
||||
|
@ -1183,7 +1183,7 @@ sp_hain(castorder *co)
|
|||
return cast_level;
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name: Segne Mallornstecken - Mallorn Hainzauber
|
||||
/* Name: Segne Mallornstecken - Mallorn Hainzauber
|
||||
* Stufe: 4
|
||||
* Kategorie: Region, positiv
|
||||
* Gebiet: Gwyrrd
|
||||
|
@ -1246,7 +1246,7 @@ patzer_ents(castorder *co)
|
|||
}
|
||||
|
||||
ents = force*10;
|
||||
u = create_unit(r, findfaction(MONSTER_FACTION), ents, new_race[RC_TREEMAN], 0,
|
||||
u = create_unit(r, findfaction(MONSTER_FACTION), ents, new_race[RC_TREEMAN], 0,
|
||||
LOC(default_locale, rc_name(new_race[RC_TREEMAN], ents!=1)), NULL);
|
||||
|
||||
/* 'Erfolg' melden */
|
||||
|
@ -1505,7 +1505,7 @@ sp_create_irongolem(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
u2 = create_unit(r, mage->faction, force*8, new_race[RC_IRONGOLEM], 0,
|
||||
u2 = create_unit(r, mage->faction, force*8, new_race[RC_IRONGOLEM], 0,
|
||||
LOC(mage->faction->locale, rc_name(new_race[RC_IRONGOLEM], 1)), mage);
|
||||
|
||||
set_level(u2, SK_ARMORER, 1);
|
||||
|
@ -1516,7 +1516,7 @@ sp_create_irongolem(castorder *co)
|
|||
a->data.ca[1] = IRONGOLEM_CRUMBLE;
|
||||
a_add(&u2->attribs, a);
|
||||
|
||||
add_message(&mage->faction->msgs,
|
||||
add_message(&mage->faction->msgs,
|
||||
msg_message("magiccreate_effect", "region command unit amount object",
|
||||
mage->region, strdup(co->order), mage, force*8,
|
||||
LOC(mage->faction->locale, rc_name(new_race[RC_IRONGOLEM], 1))));
|
||||
|
@ -1566,7 +1566,7 @@ sp_create_stonegolem(castorder *co)
|
|||
return 0;
|
||||
}
|
||||
|
||||
u2 = create_unit(r, mage->faction, force*5, new_race[RC_STONEGOLEM], 0,
|
||||
u2 = create_unit(r, mage->faction, force*5, new_race[RC_STONEGOLEM], 0,
|
||||
LOC(mage->faction->locale, rc_name(new_race[RC_STONEGOLEM], 1)), mage);
|
||||
set_level(u2, SK_ROAD_BUILDING, 1);
|
||||
set_level(u2, SK_BUILDING, 1);
|
||||
|
@ -1576,7 +1576,7 @@ sp_create_stonegolem(castorder *co)
|
|||
a->data.ca[1] = STONEGOLEM_CRUMBLE;
|
||||
a_add(&u2->attribs, a);
|
||||
|
||||
add_message(&mage->faction->msgs,
|
||||
add_message(&mage->faction->msgs,
|
||||
msg_message("magiccreate_effect", "region command unit amount object",
|
||||
mage->region, strdup(co->order), mage, force*5,
|
||||
LOC(mage->faction->locale, rc_name(new_race[RC_STONEGOLEM], 1))));
|
||||
|
@ -2590,7 +2590,7 @@ sp_forest_fire(castorder *co)
|
|||
vernichtet_schoesslinge = rtrees(nr,1) * prozent / 400;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(vernichtet > 0 || vernichtet_schoesslinge > 0) {
|
||||
rsettrees(nr, 2, rtrees(nr,2) - vernichtet);
|
||||
rsettrees(nr, 1, rtrees(nr,1) - vernichtet_schoesslinge);
|
||||
|
@ -3176,13 +3176,13 @@ sp_unholypower(castorder *co)
|
|||
|
||||
switch (old_race(u->race)) {
|
||||
case RC_SKELETON:
|
||||
target_race = new_race[RC_SKELETON_LORD];
|
||||
target_race = new_race[RC_SKELETON_LORD];
|
||||
break;
|
||||
case RC_ZOMBIE:
|
||||
target_race = new_race[RC_ZOMBIE_LORD];
|
||||
target_race = new_race[RC_ZOMBIE_LORD];
|
||||
break;
|
||||
case RC_GHOUL:
|
||||
target_race = new_race[RC_GHOUL_LORD];
|
||||
target_race = new_race[RC_GHOUL_LORD];
|
||||
break;
|
||||
default:
|
||||
cmistake(mage, strdup(co->order), 284, MSG_MAGIC);
|
||||
|
@ -3192,7 +3192,7 @@ sp_unholypower(castorder *co)
|
|||
if(u->number <= n) {
|
||||
n -= u->number;
|
||||
u->race = target_race;
|
||||
add_message(&co->rt->msgs, msg_message("unholypower_effect",
|
||||
add_message(&co->rt->msgs, msg_message("unholypower_effect",
|
||||
"mage target race", mage, u, target_race));
|
||||
} else {
|
||||
unit *un;
|
||||
|
@ -3213,7 +3213,7 @@ sp_unholypower(castorder *co)
|
|||
un->ship = u->ship;
|
||||
}
|
||||
transfermen(u, un, n);
|
||||
add_message(&co->rt->msgs, msg_message("unholypower_limitedeffect",
|
||||
add_message(&co->rt->msgs, msg_message("unholypower_limitedeffect",
|
||||
"mage target race amount",
|
||||
mage, u, target_race, n));
|
||||
n = 0;
|
||||
|
@ -5184,7 +5184,7 @@ sp_gooddreams(castorder *co)
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name:
|
||||
/* Name:
|
||||
* Stufe: 9
|
||||
* Kategorie:
|
||||
* Wirkung:
|
||||
|
@ -5217,7 +5217,7 @@ sp_clonecopy(castorder *co)
|
|||
sprintf(buf, "Klon von %s", unitname(mage));
|
||||
set_string(&clone->name, buf);
|
||||
fset(clone, FL_LOCKED);
|
||||
|
||||
|
||||
create_newclone(mage, clone);
|
||||
|
||||
sprintf(buf, "%s erschafft einen Klon.", unitname(mage));
|
||||
|
@ -6907,7 +6907,7 @@ sp_destroy_curse(castorder *co)
|
|||
int succ = 0;
|
||||
region *r = co->rt;
|
||||
unit *mage = (unit *)co->magician;
|
||||
int cast_level = co->level;
|
||||
int cast_level = co->level;
|
||||
int force = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
char *ts;
|
||||
|
@ -6922,7 +6922,7 @@ sp_destroy_curse(castorder *co)
|
|||
c = findcurse(atoi36(pa->param[1]->data.s));
|
||||
if (!c){
|
||||
/* Es wurde kein Ziel gefunden */
|
||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
||||
"spelltargetnotfound%u:unit%r:region%s:command",
|
||||
mage, mage->region, strdup(co->order)));
|
||||
}
|
||||
|
@ -6963,7 +6963,7 @@ sp_destroy_curse(castorder *co)
|
|||
/* überprüfung, ob curse zu diesem objekt gehört */
|
||||
if (!is_cursed_with(*ap, c)){
|
||||
/* Es wurde kein Ziel gefunden */
|
||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
||||
add_message(&mage->faction->msgs, new_message(mage->faction,
|
||||
"spelltargetnotfound%u:unit%r:region%s:command",
|
||||
mage, mage->region, strdup(co->order)));
|
||||
}
|
||||
|
@ -6971,7 +6971,7 @@ sp_destroy_curse(castorder *co)
|
|||
/* curse auflösen, wenn zauber stärker (force > vigour)*/
|
||||
succ = c->vigour - force;
|
||||
c->vigour = max(0, succ);
|
||||
|
||||
|
||||
if(succ <= 0) {
|
||||
remove_cursec(ap, c);
|
||||
|
||||
|
@ -8796,7 +8796,7 @@ spell spelldaten[] =
|
|||
|
||||
{SPL_WISPS, "Irrlichter",
|
||||
"Der Zauberer spricht eine Beschwörung über einen Teil der Region, "
|
||||
"und in der Folge entstehn dort Irrlichter. "
|
||||
"und in der Folgewoche entstehen dort Irrlichter. "
|
||||
"Wer durch diese Nebel wandert, wird von Visionen geplagt und "
|
||||
"in die Irre geleitet.",
|
||||
"ZAUBERE [REGION x y] [STUFE n] \"Irrlichter\" <Richtung>",
|
||||
|
@ -8883,7 +8883,7 @@ spell spelldaten[] =
|
|||
{0, 0, 0}},
|
||||
(spell_f)sp_summon_familiar, patzer
|
||||
},
|
||||
|
||||
|
||||
{SPL_CLONECOPY, "Seelenkopie",
|
||||
"Dieser mächtige Zauber kann einen Magier vor dem sicheren Tod "
|
||||
"bewahren. Der Magier erschafft anhand einer kleinen Blutprobe einen "
|
||||
|
@ -10436,7 +10436,7 @@ spell spelldaten[] =
|
|||
{0, 0, 0}},
|
||||
(spell_f)sp_dragonodem, patzer
|
||||
},
|
||||
|
||||
|
||||
{ SPL_DRAINODEM, "Schattenodem",
|
||||
"Entzieht Talentstufen und macht Schaden wie Großer Odem",
|
||||
NULL,
|
||||
|
@ -10450,7 +10450,7 @@ spell spelldaten[] =
|
|||
{0, 0, 0}},
|
||||
(spell_f)sp_dragonodem, patzer
|
||||
},
|
||||
|
||||
|
||||
{SPL_AURA_OF_FEAR, "Gesang der Furcht",
|
||||
"Panik",
|
||||
NULL,
|
||||
|
@ -10464,7 +10464,7 @@ spell spelldaten[] =
|
|||
{0, 0, 0}},
|
||||
(spell_f)sp_flee, patzer
|
||||
},
|
||||
|
||||
|
||||
{SPL_SHADOWCALL, "Schattenruf",
|
||||
"Ruft Schattenwesen.",
|
||||
NULL,
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
/* libc includes */
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -2551,36 +2552,64 @@ peasant_adjustment(void)
|
|||
}
|
||||
|
||||
static int
|
||||
orc_conversion(void)
|
||||
orc_conversion2(void)
|
||||
{
|
||||
faction *f;
|
||||
unit *u;
|
||||
region *r;
|
||||
faction *f;
|
||||
unit *u;
|
||||
region *r;
|
||||
|
||||
for(f=factions; f; f=f->next) {
|
||||
if(f->race == new_race[RC_ORC]) {
|
||||
f->race = new_race[RC_URUK];
|
||||
}
|
||||
for(f=factions; f; f=f->next) {
|
||||
if(f->race == new_race[RC_ORC]) {
|
||||
f->race = new_race[RC_URUK];
|
||||
}
|
||||
}
|
||||
|
||||
for(r=regions; r; r=r->next) {
|
||||
for(u=r->units; u; u=u->next) {
|
||||
if(u->race == new_race[RC_ORC]) {
|
||||
/* convert to either uruk or snotling */
|
||||
if(effskill(u, SK_MAGIC) >= 1
|
||||
|| effskill(u, SK_ALCHEMY) >= 1
|
||||
|| get_item(u, I_CHASTITY_BELT) >= u->number) {
|
||||
u->race = new_race[RC_URUK];
|
||||
u->irace = new_race[RC_URUK];
|
||||
} else {
|
||||
u->race = new_race[RC_SNOTLING];
|
||||
u->irace = new_race[RC_SNOTLING];
|
||||
}
|
||||
for(r=regions; r; r=r->next) {
|
||||
for(u=r->units; u; u=u->next) {
|
||||
if (u->race==new_race[RC_ORC] || u->race==new_race[RC_SNOTLING]) {
|
||||
/* convert to either uruk or snotling */
|
||||
if (has_skill(u, SK_MAGIC) || has_skill(u, SK_ALCHEMY)) {
|
||||
u->race = new_race[RC_URUK];
|
||||
u->irace = new_race[RC_URUK];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
orc_conversion(void)
|
||||
{
|
||||
faction *f;
|
||||
unit *u;
|
||||
region *r;
|
||||
|
||||
for(f=factions; f; f=f->next) {
|
||||
if(f->race == new_race[RC_ORC]) {
|
||||
f->race = new_race[RC_URUK];
|
||||
}
|
||||
}
|
||||
|
||||
for(r=regions; r; r=r->next) {
|
||||
for(u=r->units; u; u=u->next) {
|
||||
if(u->race == new_race[RC_ORC]) {
|
||||
/* convert to either uruk or snotling */
|
||||
if(effskill(u, SK_MAGIC) >= 1
|
||||
|| effskill(u, SK_ALCHEMY) >= 1
|
||||
|| get_item(u, I_CHASTITY_BELT) >= u->number) {
|
||||
u->race = new_race[RC_URUK];
|
||||
u->irace = new_race[RC_URUK];
|
||||
} else {
|
||||
u->race = new_race[RC_SNOTLING];
|
||||
u->irace = new_race[RC_SNOTLING];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2641,6 +2670,28 @@ fix_questcoors(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
warn_password(void)
|
||||
{
|
||||
faction * f = factions;
|
||||
while (f) {
|
||||
boolean pwok = true;
|
||||
const char * c = f->passw;
|
||||
while (*c) {
|
||||
if (!isalnum(*c)) pwok = false;
|
||||
c++;
|
||||
}
|
||||
if (pwok == false) {
|
||||
ADDMSG(&f->msgs, msg_message("msg_errors", "string",
|
||||
"Dein Passwort enthält Zeichen, die bei der Nachsendung "
|
||||
"von Reports Probleme bereiten können. Bitte wähle ein neues "
|
||||
"Passwort, bevorzugt nur aus Buchstaben un Zahlen bestehend."));
|
||||
}
|
||||
f = f->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fix_seeds(void)
|
||||
{
|
||||
|
@ -2701,6 +2752,8 @@ korrektur(void)
|
|||
do_once("heal", heal_all());
|
||||
do_once("fquc", fix_questcoors());
|
||||
do_once("fsee", fix_seeds());
|
||||
do_once("orc2", orc_conversion2());
|
||||
warn_password();
|
||||
|
||||
/* seems something fishy is going on, do this just
|
||||
* to be on the safe side:
|
||||
|
|
|
@ -109,182 +109,6 @@ typedef struct island {
|
|||
int age;
|
||||
} island;
|
||||
|
||||
static region *
|
||||
goodregion(int trace)
|
||||
{
|
||||
#define AGEGROUP 3 /* In diesem Alter wird zusammengefasst */
|
||||
#define REGPERFAC 3 /* #Regionen pro faction auf einer insel */
|
||||
region *r;
|
||||
vmap *xmap = (vmap *) calloc(1, sizeof(vmap));
|
||||
cvector islands;
|
||||
void **i;
|
||||
int maxage = 0;
|
||||
island *best = 0;
|
||||
int maxscore = 1000;
|
||||
region *good = 0;
|
||||
|
||||
cv_init(&islands);
|
||||
for (r = regions; r != 0; r = r->next) {
|
||||
int x = (r->x + 999) / 9;
|
||||
int y = (r->y + 999) / 9;
|
||||
unsigned int xp = vmap_find(xmap, x);
|
||||
|
||||
if (xp == xmap->size) {
|
||||
xp = vmap_insert(xmap, x, calloc(1, sizeof(vmap)));
|
||||
} {
|
||||
vmap *ymap = xmap->data[xp].value;
|
||||
unsigned int yp = vmap_find(ymap, y);
|
||||
island *is;
|
||||
unit *u;
|
||||
|
||||
if (yp == ymap->size) {
|
||||
is = calloc(1, sizeof(island));
|
||||
is->x = x;
|
||||
is->y = y;
|
||||
cv_pushback(&islands, is);
|
||||
yp = vmap_insert(ymap, y, is);
|
||||
} else
|
||||
is = ymap->data[yp].value;
|
||||
if (rterrain(r) != T_OCEAN && rterrain(r) != T_GLACIER)
|
||||
++is->land;
|
||||
|
||||
for (u = r->units; u != 0; u = u->next) {
|
||||
faction *f = u->faction;
|
||||
unsigned int pos = vmap_find(&is->factions, f->no);
|
||||
|
||||
if (pos == is->factions.size) {
|
||||
int age = 1 + (f->age / AGEGROUP);
|
||||
|
||||
vmap_insert(&is->factions, f->no, f);
|
||||
is->maxage = max(is->maxage, age);
|
||||
is->age += age;
|
||||
maxage = max(maxage, is->maxage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = islands.begin; i != islands.end; ++i) {
|
||||
island *is = *i;
|
||||
|
||||
if (is->maxage > 6 || is->factions.size == 0)
|
||||
continue;
|
||||
if (is->land / REGPERFAC < is->factions.size)
|
||||
continue;
|
||||
if (is->age < maxscore) {
|
||||
best = is;
|
||||
maxscore = is->age;
|
||||
}
|
||||
}
|
||||
|
||||
if (!best) {
|
||||
maxscore = 0;
|
||||
for (i = islands.begin; i != islands.end; ++i) {
|
||||
island *is = *i;
|
||||
int x, y;
|
||||
int score = 0;
|
||||
|
||||
if (is->land == 0 || is->age != 0)
|
||||
continue;
|
||||
/* insel leer. nachbarn zählen. */
|
||||
for (x = is->x - 1; x <= is->x + 1; ++x) {
|
||||
unsigned int p = vmap_find(xmap, x);
|
||||
vmap *ymap;
|
||||
|
||||
if (p == xmap->size)
|
||||
continue;
|
||||
ymap = xmap->data[p].value;
|
||||
for (y = is->y - 1; y <= is->y + 1; ++y) {
|
||||
unsigned int p = vmap_find(ymap, y);
|
||||
island *os;
|
||||
|
||||
if (p == ymap->size)
|
||||
continue;
|
||||
os = ymap->data[p].value;
|
||||
if (os->age > 0)
|
||||
score += maxage - os->maxage;
|
||||
}
|
||||
}
|
||||
if (score > maxscore) {
|
||||
maxscore = score;
|
||||
best = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best) {
|
||||
int a = best->x * 9 - 999;
|
||||
int b = best->y * 9 - 999;
|
||||
int x, y;
|
||||
|
||||
maxscore = 0;
|
||||
for (x = a; x != a + 9; ++x) {
|
||||
for (y = b; y != b + 9; ++y) {
|
||||
region *r = findregion(x, y);
|
||||
int score = 0;
|
||||
|
||||
if (r && r->units == 0 && rterrain(r) != T_OCEAN && rterrain(r) != T_GLACIER) {
|
||||
direction_t con;
|
||||
for (con = 0; con != MAXDIRECTIONS; ++con) {
|
||||
region *c = rconnect(r, con);
|
||||
|
||||
if (!c || c->units == 0)
|
||||
score += 2;
|
||||
if (c && rterrain(c) != T_OCEAN)
|
||||
++score;
|
||||
}
|
||||
if (score > maxscore) {
|
||||
maxscore = score;
|
||||
good = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* cleanup */ {
|
||||
void **i;
|
||||
unsigned int x;
|
||||
|
||||
for (i = islands.begin; i != islands.end; ++i) {
|
||||
free(*i);
|
||||
}
|
||||
for (x = 0; x != xmap->size; ++x) {
|
||||
vmap *v = xmap->data[x].value;
|
||||
free(v->data);
|
||||
free(v);
|
||||
}
|
||||
free(xmap->data);
|
||||
free(xmap);
|
||||
}
|
||||
return good;
|
||||
}
|
||||
|
||||
region*
|
||||
SeedPartei(void)
|
||||
{
|
||||
int i, q=0, y=3;
|
||||
WINDOW *win;
|
||||
race_t rc = 0;
|
||||
|
||||
do {
|
||||
win = openwin(SX - 10, 6, "< Neue Partei einfügen >");
|
||||
wmove(win, y, 4);
|
||||
for (i = 1; i < MAXRACES; i++) if(playerrace(new_race[i]) && i != RC_ORC) {
|
||||
sprintf(buf, "%d=%s; ", i, new_race[i]->_name[0]);
|
||||
q += strlen(buf);
|
||||
if (q > SX - 20) {
|
||||
q = strlen(buf);
|
||||
y++;
|
||||
wmove(win, y, 4);
|
||||
}
|
||||
wAddstr(buf);
|
||||
}
|
||||
rc = (race_t) map_input(win, 2, 1, "Rasse", 0, MAXRACES-1, rc);
|
||||
|
||||
delwin(win);
|
||||
} while(!playerrace(new_race[i]) || i == RC_ORC);
|
||||
return goodregion(rc);
|
||||
}
|
||||
|
||||
static int
|
||||
days2level(int days)
|
||||
{
|
||||
|
@ -326,88 +150,169 @@ give_latestart_bonus(region *r, unit *u, int b)
|
|||
}
|
||||
}
|
||||
|
||||
static newfaction * newfactions;
|
||||
|
||||
void
|
||||
read_newfactions(const char * filename)
|
||||
{
|
||||
FILE * F = fopen(filename, "r");
|
||||
if (F==NULL) return;
|
||||
for (;;) {
|
||||
faction * f = factions;
|
||||
char race[20], email[64], lang[8];
|
||||
newfaction * nf;
|
||||
int bonus;
|
||||
/* email;race;locale;startbonus */
|
||||
if (fscanf(F, "%s %s %s %d", email, race, lang, &bonus)<=0) break;
|
||||
while (f) {
|
||||
if (strcmp(f->email, email)==0 && f->age==0) {
|
||||
break;
|
||||
}
|
||||
f = f->next;
|
||||
}
|
||||
if (f) continue; /* skip the ones we've already got */
|
||||
nf = calloc(sizeof(newfaction), 1);
|
||||
nf->email = strdup(email);
|
||||
nf->race = rc_find(race);
|
||||
nf->lang = find_locale(lang);
|
||||
nf->bonus = bonus;
|
||||
assert(nf->race && nf->email && nf->lang);
|
||||
nf->next = newfactions;
|
||||
newfactions = nf;
|
||||
}
|
||||
fclose(F);
|
||||
}
|
||||
|
||||
newfaction *
|
||||
select_newfaction(const struct race * rc)
|
||||
{
|
||||
selection *prev, *ilist = NULL, **iinsert;
|
||||
selection *selected = NULL;
|
||||
newfaction *player = newfactions;
|
||||
|
||||
if (!player) return NULL;
|
||||
insert_selection(&ilist, NULL, strdup("new player"), NULL);
|
||||
iinsert=&ilist->next;
|
||||
prev = ilist;
|
||||
|
||||
while (player) {
|
||||
if (rc==NULL || player->race==rc) {
|
||||
char str[80];
|
||||
snprintf(str, 70, "%s %s", locale_string(default_locale, rc_name(player->race, 0)), player->email);
|
||||
insert_selection(iinsert, prev, strdup(str), (void*)player);
|
||||
prev = *iinsert;
|
||||
iinsert = &prev->next;
|
||||
}
|
||||
player=player->next;
|
||||
}
|
||||
selected = do_selection(ilist, "Partei", NULL, NULL);
|
||||
if (selected==NULL) return NULL;
|
||||
return (newfaction*)selected->data;
|
||||
}
|
||||
|
||||
void
|
||||
NeuePartei(region * r)
|
||||
{
|
||||
int i, q, y;
|
||||
WINDOW *win;
|
||||
char email[INPUT_BUFSIZE+1];
|
||||
race_t frace;
|
||||
newfaction * nf, **nfp;
|
||||
const struct locale * lang;
|
||||
const struct race * frace;
|
||||
int late;
|
||||
unit *u;
|
||||
int locale_nr;
|
||||
|
||||
if (!r->land) {
|
||||
warnung(0, "Ungeeignete Region! <Taste>");
|
||||
return;
|
||||
}
|
||||
win = openwin(SX - 10, 12, "< Neue Partei einfügen >");
|
||||
|
||||
strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ", NULL));
|
||||
if (!buf[0]) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
nf = select_newfaction(NULL);
|
||||
|
||||
strcpy(email, buf);
|
||||
if (nf!=NULL) {
|
||||
frace = nf->race;
|
||||
late = nf->bonus;
|
||||
lang = nf->lang;
|
||||
strcpy(email, nf->email);
|
||||
} else {
|
||||
int locale_nr;
|
||||
WINDOW *win = openwin(SX - 10, 12, "< Neue Partei einfügen >");
|
||||
|
||||
y = 3;
|
||||
q = 0;
|
||||
wmove(win, y, 4);
|
||||
for (i = 0; i < MAXRACES; i++) if(playerrace(new_race[i])) {
|
||||
sprintf(buf, "%d=%s; ", i, new_race[i]->_name[0]);
|
||||
q += strlen(buf);
|
||||
if (q > SX - 20) {
|
||||
q = strlen(buf);
|
||||
y++;
|
||||
wmove(win, y, 4);
|
||||
}
|
||||
wAddstr(buf);
|
||||
}
|
||||
wrefresh(win);
|
||||
|
||||
y++;
|
||||
do {
|
||||
frace = (char) map_input(win, 2, y, "Rasse", -1, MAXRACES-1, 0);
|
||||
} while(!playerrace(new_race[frace]));
|
||||
if(frace == -1) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
|
||||
y++;
|
||||
late = (int) map_input(win, 2, y, "Startbonus", -1, 99, 0);
|
||||
if(late == -1) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0; q = 0; y++;
|
||||
wmove(win, y, 4);
|
||||
while(locales[i] != NULL) {
|
||||
sprintf(buf, "%d=%s; ", i, locales[i]);
|
||||
q += strlen(buf);
|
||||
if (q > SX - 20) {
|
||||
q = strlen(buf);
|
||||
y++;
|
||||
wmove(win, y, 4);
|
||||
strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ", NULL));
|
||||
if (!buf[0]) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
wAddstr(buf);
|
||||
i++;
|
||||
}
|
||||
wrefresh(win);
|
||||
|
||||
y++;
|
||||
locale_nr = map_input(win, 2, 8, "Locale", -1, i-1, 0);
|
||||
if(locale_nr == -1) {
|
||||
strcpy(email, buf);
|
||||
|
||||
y = 3;
|
||||
q = 0;
|
||||
wmove(win, y, 4);
|
||||
for (i = 0; i < MAXRACES; i++) if(playerrace(new_race[i])) {
|
||||
sprintf(buf, "%d=%s; ", i, new_race[i]->_name[0]);
|
||||
q += strlen(buf);
|
||||
if (q > SX - 20) {
|
||||
q = strlen(buf);
|
||||
y++;
|
||||
wmove(win, y, 4);
|
||||
}
|
||||
wAddstr(buf);
|
||||
}
|
||||
wrefresh(win);
|
||||
|
||||
y++;
|
||||
do {
|
||||
int nrace = (char) map_input(win, 2, y, "Rasse", -1, MAXRACES-1, 0);
|
||||
if (nrace == -1) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
frace = new_race[nrace];
|
||||
} while(!playerrace(frace));
|
||||
|
||||
y++;
|
||||
late = (int) map_input(win, 2, y, "Startbonus", -1, 99, 0);
|
||||
if(late == -1) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
i = 0; q = 0; y++;
|
||||
wmove(win, y, 4);
|
||||
while(locales[i] != NULL) {
|
||||
sprintf(buf, "%d=%s; ", i, locales[i]);
|
||||
q += strlen(buf);
|
||||
if (q > SX - 20) {
|
||||
q = strlen(buf);
|
||||
y++;
|
||||
wmove(win, y, 4);
|
||||
}
|
||||
wAddstr(buf);
|
||||
i++;
|
||||
}
|
||||
wrefresh(win);
|
||||
|
||||
y++;
|
||||
locale_nr = map_input(win, 2, 8, "Locale", -1, i-1, 0);
|
||||
if(locale_nr == -1) {
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
lang = find_locale(locales[locale_nr]);
|
||||
|
||||
delwin(win);
|
||||
return;
|
||||
}
|
||||
|
||||
delwin(win);
|
||||
/* remove duplicate email addresses */
|
||||
nfp=&newfactions;
|
||||
while (*nfp) {
|
||||
newfaction * nf = *nfp;
|
||||
if (strcmp(email, nf->email)==0) {
|
||||
*nfp = nf->next;
|
||||
}
|
||||
else nfp = &nf->next;
|
||||
}
|
||||
modified = 1;
|
||||
|
||||
u = addplayer(r, email, new_race[frace], find_locale(locales[locale_nr]));
|
||||
u = addplayer(r, email, frace, lang);
|
||||
|
||||
if(late) give_latestart_bonus(r, u, late);
|
||||
|
||||
|
|
|
@ -264,6 +264,7 @@ insert_selection(selection ** p_sel, selection * prev, char * str, void * payloa
|
|||
} else {
|
||||
*p_sel = sel;
|
||||
sel->prev = prev;
|
||||
if (prev) sel->index=prev->index+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ input_string(const char * text, char * result, size_t len) {
|
|||
werase(wn);
|
||||
wmove(wn, 0, 0);
|
||||
wattron(wn, A_BOLD);
|
||||
waddstr(wn, text);
|
||||
waddstr(wn, (char*)text);
|
||||
waddstr(wn, ": ");
|
||||
echo();
|
||||
curs_set(1);
|
||||
|
@ -229,7 +229,6 @@ modify_items(unit * u)
|
|||
return i_modif;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
char
|
||||
modify_zauber(unit * u)
|
||||
|
@ -339,6 +338,7 @@ modify_talente(unit * u, region * r)
|
|||
{
|
||||
int q, L;
|
||||
item_t i;
|
||||
skill_t sk;
|
||||
unsigned char x;
|
||||
char modif=0;
|
||||
WINDOW *wn;
|
||||
|
@ -355,12 +355,12 @@ modify_talente(unit * u, region * r)
|
|||
wborder(wn, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
wmove(wn, 0, 3);
|
||||
waddnstr(wn, "< Talente >", -1);
|
||||
for (i = 0; i < MAXSKILLS; i++) {
|
||||
sprintf(buf, "%s %d", skillname(i, NULL), eff_skill(u, i, r));
|
||||
TL[i] = strdup(buf);
|
||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
||||
sprintf(buf, "%s %d", skillname(sk, NULL), eff_skill(u, sk, r));
|
||||
TL[sk] = strdup(buf);
|
||||
if (L > 10) {
|
||||
wmove(wn, i + 1, 4);
|
||||
waddnstr(wn, TL[i], -1);
|
||||
wmove(wn, sk + 1, 4);
|
||||
waddnstr(wn, TL[sk], -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1038,15 +1038,6 @@ movearound(int rx, int ry) {
|
|||
RemovePartei();
|
||||
ch = -9;
|
||||
break;
|
||||
case 's':
|
||||
c = SeedPartei();
|
||||
if (c) {
|
||||
rx = c->x;
|
||||
ry = c->y;
|
||||
recalc_everything(&x, &y, &rx, &ry);
|
||||
ch = -8;
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
NeuePartei(r);
|
||||
ch = -9;
|
||||
|
@ -1523,6 +1514,10 @@ main(int argc, char *argv[])
|
|||
sprintf(datafile, "%s/%d", datapath(), turn);
|
||||
|
||||
readgame(backup);
|
||||
|
||||
sprintf(buf, "%s/newfactions.%d", basepath(), turn);
|
||||
read_newfactions(buf);
|
||||
|
||||
if (findfaction(MONSTER_FACTION)==NULL) {
|
||||
makemonsters();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
struct race;
|
||||
|
||||
typedef struct dbllist dbllist;
|
||||
struct dbllist {
|
||||
|
@ -42,6 +43,15 @@ typedef struct tagregion {
|
|||
struct region *r;
|
||||
} tagregion;
|
||||
|
||||
typedef struct newfaction {
|
||||
struct newfaction * next;
|
||||
const char * email;
|
||||
const struct locale * lang;
|
||||
const struct race * race;
|
||||
int bonus;
|
||||
boolean oldregions;
|
||||
} newfaction;
|
||||
|
||||
extern tagregion *Tagged;
|
||||
|
||||
void saddstr(char *s);
|
||||
|
@ -93,8 +103,8 @@ extern struct ship *clipship;
|
|||
|
||||
#define NL(S) adddbllist(&S," ")
|
||||
|
||||
#define wAddstr(x) waddnstr(win,x,-1)
|
||||
#define Addstr(x) waddnstr(mywin,x,-1)
|
||||
#define wAddstr(x) waddnstr(win, (NCURSES_CONST char*)x,-1)
|
||||
#define Addstr(x) waddnstr(mywin, (NCURSES_CONST char*)x,-1)
|
||||
#define Movexy(x,y) wmove(mywin,y,x)
|
||||
#define movexy(x,y) move(y,x)
|
||||
/* move(zeile, spalte) ist "verkehrt"... */
|
||||
|
@ -121,6 +131,9 @@ struct selection * do_selection(struct selection * sel, const char * title, void
|
|||
struct selection ** push_selection(struct selection ** p_sel, char * str, void * payload);
|
||||
void insert_selection(struct selection ** p_sel, struct selection * prev, char * str, void * payload);
|
||||
|
||||
extern void read_newfactions(const char * filename);
|
||||
|
||||
|
||||
#define sncat(b, s, size) strncat ((b), s, size - strlen (b))
|
||||
|
||||
#endif /* MAPPER_H */
|
||||
|
|
|
@ -4653,7 +4653,7 @@
|
|||
</type>
|
||||
<locale name="de">
|
||||
<nr section="events">
|
||||
<text>"Die Adresse wurde auf '$value' geändert."</text>
|
||||
<text>"Die Reportadresse wurde auf ${value} geändert."</text>
|
||||
</nr>
|
||||
</locale>
|
||||
</message>
|
||||
|
@ -4664,7 +4664,7 @@
|
|||
</type>
|
||||
<locale name="de">
|
||||
<nr section="events">
|
||||
<text>"Das Passwort wurde auf '$value' geändert."</text>
|
||||
<text>"Das Passwort für diese Partei lautet ${value}."</text>
|
||||
</nr>
|
||||
</locale>
|
||||
</message>
|
||||
|
|
|
@ -3443,7 +3443,7 @@
|
|||
</type>
|
||||
<locale name="en">
|
||||
<nr section="none">
|
||||
<text>"The password has been changed to '$value'."</text>
|
||||
<text>"The password of this faction is '$value'."</text>
|
||||
</nr>
|
||||
</locale>
|
||||
</message>
|
||||
|
|
|
@ -1148,7 +1148,7 @@
|
|||
<familiar race="demon"></familiar>
|
||||
</race>
|
||||
|
||||
<race name="orc" magres="-0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="50" maintenance="10" weight="1000" speed="1.000000" hp="24" ac="0" damage="1d5" unarmedattack="-2" unarmeddefense="-2" attackmodifier="0" defensemodifier="0" playerrace walk giveitem giveperson giveunit getitem equipment>
|
||||
<race name="orc" magres="-0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="50" maintenance="10" weight="1000" speed="1.000000" hp="24" ac="0" damage="1d5" unarmedattack="-2" unarmeddefense="-2" attackmodifier="0" defensemodifier="0" walk giveitem giveperson giveunit getitem equipment>
|
||||
<ai splitsize="10000" attackrandom moverandom learn></ai>
|
||||
<skill name="sk_alchemy" modifier="1"></skill>
|
||||
<skill name="sk_mining" modifier="1"></skill>
|
||||
|
|
Loading…
Reference in New Issue