forked from github/server
* Prefix im CR repariert.
* RACE_ADJUSTMENT korrekt deaktiviert. * Schiffe werden nur noch beschädigt, wenn der Kampf für sie relevant war. * Erneute Reparatur für Regionen ohne demand. * KÄMPFE HELFE NICHT repariert. * Setzen des Kampfzaubers ohne Stufenangabe setzt die Stufe auf 0 (=max) * Übersetzung des HP-Status im Report * Teilübersetzung der Spionage-Reports. * locale_string() liefert auf NULL wieder NULL zurück (statt crash).
This commit is contained in:
parent
4fd1c237d1
commit
32bc84c970
|
@ -547,14 +547,17 @@ cr_output_unit(FILE * F, const region * r,
|
||||||
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
||||||
/* my own faction, full info */
|
/* my own faction, full info */
|
||||||
const attrib * a = a_find(u->attribs, &at_group);
|
const attrib * a = a_find(u->attribs, &at_group);
|
||||||
|
const attrib * ap = 0;
|
||||||
if (a) {
|
if (a) {
|
||||||
const group * g = (const group*)a->data.v;
|
const group * g = (const group*)a->data.v;
|
||||||
const attrib *a = a_find(g->attribs, &at_raceprefix);
|
ap = a_find(g->attribs, &at_raceprefix);
|
||||||
fprintf(F, "%d;gruppe\n", g->gid);
|
fprintf(F, "%d;gruppe\n", g->gid);
|
||||||
if (a) {
|
} else {
|
||||||
const char * name = (const char*)a->data.v;
|
ap = a_find(u->faction->attribs, &at_raceprefix);
|
||||||
fprintf(F, "\"%s\";typprefix\n", add_translation(name, LOC(f->locale, name)));
|
}
|
||||||
}
|
if (ap) {
|
||||||
|
const char * name = (const char*)a->data.v;
|
||||||
|
fprintf(F, "\"%s\";typprefix\n", add_translation(name, LOC(f->locale, name)));
|
||||||
}
|
}
|
||||||
fprintf(F, "%d;Partei\n", u->faction->no);
|
fprintf(F, "%d;Partei\n", u->faction->no);
|
||||||
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
|
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
|
||||||
|
@ -642,7 +645,7 @@ cr_output_unit(FILE * F, const region * r,
|
||||||
fprintf(F, "\"%s\";privat\n", c);
|
fprintf(F, "\"%s\";privat\n", c);
|
||||||
c = hp_status(u);
|
c = hp_status(u);
|
||||||
if (c && *c && (u->faction == f || omniscient(f)))
|
if (c && *c && (u->faction == f || omniscient(f)))
|
||||||
fprintf(F, "\"%s\";hp\n", c);
|
fprintf(F, "\"%s\";hp\n", add_translation(c, locale_string(u->faction->locale, c)));
|
||||||
if (fval(u, FL_HUNGER) && (u->faction == f))
|
if (fval(u, FL_HUNGER) && (u->faction == f))
|
||||||
fputs("1;hunger\n", F);
|
fputs("1;hunger\n", F);
|
||||||
if (is_mage(u)) {
|
if (is_mage(u)) {
|
||||||
|
|
|
@ -121,7 +121,6 @@ static struct scramble {
|
||||||
int rnd;
|
int rnd;
|
||||||
} * vec;
|
} * vec;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
scramblecmp(const void *p1, const void *p2)
|
scramblecmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
|
@ -297,26 +296,27 @@ expandrecruit(region * r, request * recruitorders)
|
||||||
if (u->number)
|
if (u->number)
|
||||||
u->hp += u->n * unit_max_hp(u);
|
u->hp += u->n * unit_max_hp(u);
|
||||||
if (u->race == new_race[RC_ORC]) {
|
if (u->race == new_race[RC_ORC]) {
|
||||||
change_skill(u, SK_SWORD, 30 * u->n);
|
change_skill(u, SK_SWORD, skill_level(1) * u->n);
|
||||||
change_skill(u, SK_SPEAR, 30 * u->n);
|
change_skill(u, SK_SPEAR, skill_level(1) * u->n);
|
||||||
}
|
}
|
||||||
if (u->race->ec_flags & ECF_REC_HORSES) {
|
if (u->race->ec_flags & ECF_REC_HORSES) {
|
||||||
change_skill(u, SK_RIDING, 30 * u->n);
|
change_skill(u, SK_RIDING, skill_level(1) * u->n);
|
||||||
}
|
}
|
||||||
i = fspecial(u->faction, FS_MILITIA);
|
i = fspecial(u->faction, FS_MILITIA);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
if (u->race->bonus[SK_SPEAR] >= 0) change_skill(u, SK_SPEAR,
|
int ld = skill_level(i);
|
||||||
u->n * level_days(i));
|
if (u->race->bonus[SK_SPEAR] >= 0)
|
||||||
if (u->race->bonus[SK_SWORD] >= 0) change_skill(u, SK_SWORD,
|
change_skill(u, SK_SPEAR, u->n * ld);
|
||||||
u->n * level_days(i));
|
if (u->race->bonus[SK_SWORD] >= 0)
|
||||||
if (u->race->bonus[SK_LONGBOW] >= 0) change_skill(u, SK_LONGBOW,
|
change_skill(u, SK_SWORD, u->n * ld);
|
||||||
u->n * level_days(i));
|
if (u->race->bonus[SK_LONGBOW] >= 0)
|
||||||
if (u->race->bonus[SK_CROSSBOW] >= 0) change_skill(u, SK_CROSSBOW,
|
change_skill(u, SK_LONGBOW, u->n * ld);
|
||||||
u->n * level_days(i));
|
if (u->race->bonus[SK_CROSSBOW] >= 0)
|
||||||
if (u->race->bonus[SK_RIDING] >= 0) change_skill(u, SK_RIDING,
|
change_skill(u, SK_CROSSBOW, u->n * ld);
|
||||||
u->n * level_days(i));
|
if (u->race->bonus[SK_RIDING] >= 0)
|
||||||
if (u->race->bonus[SK_AUSDAUER] >= 0) change_skill(u, SK_AUSDAUER,
|
change_skill(u, SK_RIDING, u->n * ld);
|
||||||
u->n * level_days(i));
|
if (u->race->bonus[SK_AUSDAUER] >= 0)
|
||||||
|
change_skill(u, SK_AUSDAUER, u->n * ld);
|
||||||
}
|
}
|
||||||
if (u->n < u->wants) {
|
if (u->n < u->wants) {
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
|
@ -547,7 +547,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
|
||||||
&& u2->faction != u->faction
|
&& u2->faction != u->faction
|
||||||
&& ucontact(u2, u) == 0) {
|
&& ucontact(u2, u) == 0) {
|
||||||
error = 73;
|
error = 73;
|
||||||
} else if (u2 && (get_skill(u, SK_MAGIC) > 0 || get_skill(u2, SK_MAGIC) > 0)) {
|
} else if (u2 && (get_skill(u, SK_MAGIC) || get_skill(u2, SK_MAGIC))) {
|
||||||
error = 158;
|
error = 158;
|
||||||
} else {
|
} else {
|
||||||
if (n > u->number) n = u->number;
|
if (n > u->number) n = u->number;
|
||||||
|
@ -570,7 +570,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (u2 && (get_skill(u, SK_ALCHEMY) > 0 || get_skill(u2, SK_ALCHEMY) > 0)) {
|
if (u2 && (get_skill(u, SK_ALCHEMY) || get_skill(u2, SK_ALCHEMY))) {
|
||||||
|
|
||||||
k = count_skill(u2->faction, SK_ALCHEMY);
|
k = count_skill(u2->faction, SK_ALCHEMY);
|
||||||
|
|
||||||
|
@ -580,7 +580,7 @@ givemen(int n, unit * u, unit * u2, const char * cmd)
|
||||||
k += u2->number;
|
k += u2->number;
|
||||||
|
|
||||||
/* Wenn in eine Alchemisteneinheit Personen verschoben werden */
|
/* Wenn in eine Alchemisteneinheit Personen verschoben werden */
|
||||||
if (get_skill(u2, SK_ALCHEMY) > 0 && !get_skill(u, SK_ALCHEMY))
|
if (get_skill(u2, SK_ALCHEMY) && !get_skill(u, SK_ALCHEMY))
|
||||||
k += n;
|
k += n;
|
||||||
|
|
||||||
/* Wenn Parteigrenzen überschritten werden */
|
/* Wenn Parteigrenzen überschritten werden */
|
||||||
|
@ -1546,7 +1546,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
if (btype==&bt_mine)
|
if (btype==&bt_mine)
|
||||||
al->save *= 0.5;
|
al->save *= 0.5;
|
||||||
if (u->race == new_race[RC_DWARF])
|
if (u->race == new_race[RC_DWARF])
|
||||||
#ifdef RACE_ADJUSTMENTS
|
#if RACE_ADJUSTMENTS
|
||||||
al->save *= 0.75;
|
al->save *= 0.75;
|
||||||
#else
|
#else
|
||||||
al->save *= 0.5;
|
al->save *= 0.5;
|
||||||
|
@ -1556,7 +1556,7 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
if (btype==&bt_quarry)
|
if (btype==&bt_quarry)
|
||||||
al->save = al->save*0.5;
|
al->save = al->save*0.5;
|
||||||
#ifdef RACE_ADJUSTMENTS
|
#if RACE_ADJUSTMENTS
|
||||||
if (u->race == new_race[RC_TROLL])
|
if (u->race == new_race[RC_TROLL])
|
||||||
al->save = al->save*0.75;
|
al->save = al->save*0.75;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1740,8 +1740,7 @@ split_allocations(region * r)
|
||||||
if (al->get) {
|
if (al->get) {
|
||||||
assert(itype || !"not implemented for non-items");
|
assert(itype || !"not implemented for non-items");
|
||||||
i_change(&al->unit->items, itype, al->get);
|
i_change(&al->unit->items, itype, al->get);
|
||||||
change_skill(al->unit, itype->construction->skill,
|
produceexp(al->unit, itype->construction->skill, al->unit->number);
|
||||||
al->unit->number * PRODUCEEXP);
|
|
||||||
#if NEW_RESOURCEGROWTH
|
#if NEW_RESOURCEGROWTH
|
||||||
fset(r, RF_DH);
|
fset(r, RF_DH);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2502,7 +2501,7 @@ plant(region *r, unit *u, int raw)
|
||||||
for(i = n; i>0; i--) {
|
for(i = n; i>0; i--) {
|
||||||
if (rand()%10 < skill) planted++;
|
if (rand()%10 < skill) planted++;
|
||||||
}
|
}
|
||||||
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
|
produceexp(u, SK_HERBALISM, u->number);
|
||||||
|
|
||||||
/* Alles ok. Abziehen. */
|
/* Alles ok. Abziehen. */
|
||||||
new_use_pooled(u, oldresourcetype[R_TREES], GET_DEFAULT, 1);
|
new_use_pooled(u, oldresourcetype[R_TREES], GET_DEFAULT, 1);
|
||||||
|
@ -2556,7 +2555,7 @@ planttrees(region *r, unit *u, int raw)
|
||||||
rsettrees(r, 0, rtrees(r, 0)+planted);
|
rsettrees(r, 0, rtrees(r, 0)+planted);
|
||||||
|
|
||||||
/* Alles ok. Abziehen. */
|
/* Alles ok. Abziehen. */
|
||||||
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
|
produceexp(u, SK_HERBALISM, u->number);
|
||||||
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
||||||
|
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
add_message(&u->faction->msgs, new_message(u->faction,
|
||||||
|
@ -2661,7 +2660,7 @@ breedtrees(region *r, unit *u, int raw)
|
||||||
rsettrees(r, 1, rtrees(r, 1)+planted);
|
rsettrees(r, 1, rtrees(r, 1)+planted);
|
||||||
|
|
||||||
/* Alles ok. Abziehen. */
|
/* Alles ok. Abziehen. */
|
||||||
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
|
produceexp(u, SK_HERBALISM, u->number);
|
||||||
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
new_use_pooled(u, itype->rtype, GET_DEFAULT, n);
|
||||||
|
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
add_message(&u->faction->msgs, new_message(u->faction,
|
||||||
|
@ -2695,8 +2694,9 @@ breedhorses(region *r, unit *u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gezuechtet > 0)
|
if (gezuechtet > 0) {
|
||||||
change_skill(u, SK_HORSE_TRAINING, PRODUCEEXP * u->number);
|
produceexp(u, SK_HORSE_TRAINING, u->number);
|
||||||
|
}
|
||||||
|
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
add_message(&u->faction->msgs, new_message(u->faction,
|
||||||
"raised%u:unit%i:amount", u, gezuechtet));
|
"raised%u:unit%i:amount", u, gezuechtet));
|
||||||
|
@ -2773,7 +2773,7 @@ research(region *r, unit *u)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
change_skill(u, SK_HERBALISM, PRODUCEEXP * u->number);
|
produceexp(u, SK_HERBALISM, u->number);
|
||||||
|
|
||||||
if (rherbs(r) > 0) {
|
if (rherbs(r) > 0) {
|
||||||
const herb_type *rht = rherbtype(r);
|
const herb_type *rht = rherbtype(r);
|
||||||
|
@ -2917,7 +2917,7 @@ steal(region * r, unit * u, request ** stealorders)
|
||||||
|
|
||||||
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
|
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
|
||||||
|
|
||||||
change_skill(u, SK_STEALTH, min(n, u->number) * PRODUCEEXP);
|
produceexp(u, SK_STEALTH, min(n, u->number));
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -2960,8 +2960,7 @@ expandentertainment(region * r)
|
||||||
entertaining -= u->n;
|
entertaining -= u->n;
|
||||||
|
|
||||||
/* Nur soviel PRODUCEEXP wie auch tatsächlich gemacht wurde */
|
/* Nur soviel PRODUCEEXP wie auch tatsächlich gemacht wurde */
|
||||||
|
produceexp(u, SK_ENTERTAINMENT, min(u->n, u->number));
|
||||||
change_skill(u, SK_ENTERTAINMENT, PRODUCEEXP * min(u->n, u->number));
|
|
||||||
add_income(u, IC_ENTERTAIN, o->qty, u->n);
|
add_income(u, IC_ENTERTAIN, o->qty, u->n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3215,7 +3214,7 @@ produce(void)
|
||||||
if (fval(u, FL_TRADER)) {
|
if (fval(u, FL_TRADER)) {
|
||||||
attrib * a = a_find(u->attribs, &at_trades);
|
attrib * a = a_find(u->attribs, &at_trades);
|
||||||
if (a && a->data.i) {
|
if (a && a->data.i) {
|
||||||
change_skill(u, SK_TRADE, u->number * PRODUCEEXP);
|
produceexp(u, SK_TRADE, u->number);
|
||||||
}
|
}
|
||||||
u->thisorder[0]=0;
|
u->thisorder[0]=0;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2350,16 +2350,15 @@ instant_orders(void)
|
||||||
case P_VORNE:
|
case P_VORNE:
|
||||||
u->status = ST_FIGHT;
|
u->status = ST_FIGHT;
|
||||||
break;
|
break;
|
||||||
#ifdef NOAID
|
|
||||||
case P_HELP:
|
case P_HELP:
|
||||||
param = getstrtoken();
|
param = getstrtoken();
|
||||||
if(findparam(param, u->faction->locale) == P_NOT) {
|
if( findparam(param, u->faction->locale) == P_NOT) {
|
||||||
freset(u, FL_NOAID);
|
|
||||||
} else {
|
|
||||||
fset(u, FL_NOAID);
|
fset(u, FL_NOAID);
|
||||||
|
} else {
|
||||||
|
freset(u, FL_NOAID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (strlen(param)) {
|
if (strlen(param)) {
|
||||||
|
@ -2391,6 +2390,7 @@ instant_orders(void)
|
||||||
level = max(0, level);
|
level = max(0, level);
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
}
|
}
|
||||||
|
else level = 0;
|
||||||
|
|
||||||
spell = find_spellbyname(u, s);
|
spell = find_spellbyname(u, s);
|
||||||
|
|
||||||
|
|
|
@ -167,8 +167,8 @@ dissolve_units(void)
|
||||||
remove_empty_units();
|
remove_empty_units();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
improve_all(faction * f, skill_t s, int g)
|
improve_all(faction * f, skill_t sk, int days)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -177,9 +177,15 @@ improve_all(faction * f, skill_t s, int g)
|
||||||
|
|
||||||
for (r = firstregion(f); r != last; r = r->next) {
|
for (r = firstregion(f); r != last; r = r->next) {
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
if (u->faction == f && get_skill(u, s) > 0) {
|
if (u->faction == f && get_skill(u, sk)) {
|
||||||
|
#if SKILLPOINTS
|
||||||
|
change_skill(u, sk, u->number * days);
|
||||||
n += u->number;
|
n += u->number;
|
||||||
change_skill(u, s, u->number * g);
|
#else
|
||||||
|
if (learn_skill(u, sk, days * u->number)) {
|
||||||
|
change_skill(u, sk, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,11 +299,15 @@ find_manual(region * r, unit * u)
|
||||||
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
||||||
|
|
||||||
if (improve_all(u->faction, skill, 90) == 0) {
|
if (improve_all(u->faction, skill, 90) == 0) {
|
||||||
|
#if SKILLPOINTS
|
||||||
change_skill(u, skill, 270);
|
change_skill(u, skill, 270);
|
||||||
|
#else
|
||||||
|
change_skill(u, skill, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
get_unit(region * r, unit * u)
|
get_unit(region * r, unit * u)
|
||||||
{
|
{
|
||||||
unit *newunit;
|
unit *newunit;
|
||||||
|
@ -315,23 +325,23 @@ get_unit(region * r, unit * u)
|
||||||
if (fval(u, FL_PARTEITARNUNG)) fset(newunit, FL_PARTEITARNUNG);
|
if (fval(u, FL_PARTEITARNUNG)) fset(newunit, FL_PARTEITARNUNG);
|
||||||
switch (rand() % 4) {
|
switch (rand() % 4) {
|
||||||
case 0:
|
case 0:
|
||||||
set_skill(newunit, SK_MINING, 30 * newunit->number);
|
set_skill(newunit, SK_MINING, skill_level(1) * newunit->number);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
set_skill(newunit, SK_LUMBERJACK, 30 * newunit->number);
|
set_skill(newunit, SK_LUMBERJACK, skill_level(1) * newunit->number);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
set_skill(newunit, SK_CARTMAKER, 30 * newunit->number);
|
set_skill(newunit, SK_CARTMAKER, skill_level(1) * newunit->number);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
set_skill(newunit, SK_QUARRYING, 30 * newunit->number);
|
set_skill(newunit, SK_QUARRYING, skill_level(1) * newunit->number);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
set_item(newunit, I_WAGON, rand() % 2);
|
set_item(newunit, I_WAGON, rand() % 2);
|
||||||
set_item(newunit, I_HORSE, min(get_item(newunit, I_WAGON) * 2, rand() % 5));
|
set_item(newunit, I_HORSE, min(get_item(newunit, I_WAGON) * 2, rand() % 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
get_allies(region * r, unit * u)
|
get_allies(region * r, unit * u)
|
||||||
{
|
{
|
||||||
unit *newunit = NULL;
|
unit *newunit = NULL;
|
||||||
|
@ -348,19 +358,19 @@ get_allies(region * r, unit * u)
|
||||||
|
|
||||||
switch (rand() % 4) {
|
switch (rand() % 4) {
|
||||||
case 0:
|
case 0:
|
||||||
set_skill(newunit, SK_SWORD, (30 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_SWORD, skill_level(1+rand()%3) * newunit->number);
|
||||||
set_item(newunit, I_SWORD, newunit->number);
|
set_item(newunit, I_SWORD, newunit->number);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
set_skill(newunit, SK_SPEAR, (30 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_SPEAR, skill_level(1+rand()%3) * newunit->number);
|
||||||
set_item(newunit, I_SPEAR, newunit->number);
|
set_item(newunit, I_SPEAR, newunit->number);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
set_skill(newunit, SK_CROSSBOW, (30 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_CROSSBOW, skill_level(1+rand()%3) * newunit->number);
|
||||||
set_item(newunit, I_CROSSBOW, newunit->number);
|
set_item(newunit, I_CROSSBOW, newunit->number);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
set_skill(newunit, SK_LONGBOW, (30 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_LONGBOW, skill_level(1+rand()%3) * newunit->number);
|
||||||
set_item(newunit, I_LONGBOW, newunit->number);
|
set_item(newunit, I_LONGBOW, newunit->number);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -369,7 +379,7 @@ get_allies(region * r, unit * u)
|
||||||
}
|
}
|
||||||
if (rand() % 100 < 30) {
|
if (rand() % 100 < 30) {
|
||||||
set_item(newunit, I_HORSE, newunit->number);
|
set_item(newunit, I_HORSE, newunit->number);
|
||||||
set_skill(newunit, SK_RIDING, (30 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_RIDING, skill_level(1+rand()%3) * newunit->number);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -381,12 +391,12 @@ get_allies(region * r, unit * u)
|
||||||
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
|
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
|
||||||
set_string(&newunit->name, "Waldbewohner");
|
set_string(&newunit->name, "Waldbewohner");
|
||||||
set_money(newunit, (rand() % 20 + 10) * newunit->number);
|
set_money(newunit, (rand() % 20 + 10) * newunit->number);
|
||||||
set_skill(newunit, SK_LONGBOW, (90 + rand() % 210) * newunit->number);
|
set_skill(newunit, SK_LONGBOW, skill_level(2+rand()%3) * newunit->number);
|
||||||
set_item(newunit, I_LONGBOW, newunit->number);
|
set_item(newunit, I_LONGBOW, newunit->number);
|
||||||
set_skill(newunit, SK_OBSERVATION, (90 + rand() % 110) * newunit->number);
|
set_skill(newunit, SK_OBSERVATION, skill_level(2+rand()%2) * newunit->number);
|
||||||
set_skill(newunit, SK_STEALTH, (30 + rand() % 80) * newunit->number);
|
set_skill(newunit, SK_STEALTH, skill_level(1+rand()%2) * newunit->number);
|
||||||
if (rand() % 100 < 20) {
|
if (rand() % 100 < 20) {
|
||||||
set_skill(newunit, SK_HERBALISM, (30 + rand() % 10) * newunit->number);
|
set_skill(newunit, SK_HERBALISM, skill_level(1+rand()%2) * newunit->number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -398,9 +408,9 @@ get_allies(region * r, unit * u)
|
||||||
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
|
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
|
||||||
set_string(&newunit->name, "Sumpfbewohner");
|
set_string(&newunit->name, "Sumpfbewohner");
|
||||||
set_money(newunit, (rand() % 20 + 10) * newunit->number);
|
set_money(newunit, (rand() % 20 + 10) * newunit->number);
|
||||||
set_skill(newunit, SK_SPEAR, (90 + rand() % 210) * newunit->number);
|
set_skill(newunit, SK_SPEAR, skill_level(2+rand()%3) * newunit->number);
|
||||||
set_item(newunit, I_SPEAR, newunit->number);
|
set_item(newunit, I_SPEAR, newunit->number);
|
||||||
set_skill(newunit, SK_STEALTH, (90 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_STEALTH, skill_level(2+rand()%3) * newunit->number);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_DESERT:
|
case T_DESERT:
|
||||||
|
@ -410,12 +420,12 @@ get_allies(region * r, unit * u)
|
||||||
newunit = createunit(r, u->faction, rand() % 12 + 2, u->faction->race);
|
newunit = createunit(r, u->faction, rand() % 12 + 2, u->faction->race);
|
||||||
set_string(&newunit->name, "Berber");
|
set_string(&newunit->name, "Berber");
|
||||||
set_money(newunit, (rand() % 30 + 20) * newunit->number);
|
set_money(newunit, (rand() % 30 + 20) * newunit->number);
|
||||||
set_skill(newunit, SK_SWORD, (30 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_SWORD, skill_level(1+rand()%2) * newunit->number);
|
||||||
set_item(newunit, I_SWORD, newunit->number);
|
set_item(newunit, I_SWORD, newunit->number);
|
||||||
set_skill(newunit, SK_TRADE, (30 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_TRADE, skill_level(1+rand()%3) * newunit->number);
|
||||||
set_skill(newunit, SK_RIDING, (90 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_RIDING, skill_level(2+rand()%2) * newunit->number);
|
||||||
set_item(newunit, I_HORSE, newunit->number);
|
set_item(newunit, I_HORSE, newunit->number);
|
||||||
set_skill(newunit, SK_HORSE_TRAINING, (90 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_HORSE_TRAINING, skill_level(2+rand()%2) * newunit->number);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_HIGHLAND:
|
case T_HIGHLAND:
|
||||||
|
@ -425,7 +435,7 @@ get_allies(region * r, unit * u)
|
||||||
newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race);
|
newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race);
|
||||||
set_string(&newunit->name, "Hochlandbarbaren");
|
set_string(&newunit->name, "Hochlandbarbaren");
|
||||||
set_money(newunit, (rand() % 10 + 20) * newunit->number);
|
set_money(newunit, (rand() % 10 + 20) * newunit->number);
|
||||||
set_skill(newunit, SK_SWORD, (60 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_SWORD, skill_level(1+rand()%2) * newunit->number);
|
||||||
set_item(newunit, I_SWORD, newunit->number);
|
set_item(newunit, I_SWORD, newunit->number);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -437,10 +447,10 @@ get_allies(region * r, unit * u)
|
||||||
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
|
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
|
||||||
set_string(&newunit->name, "Bergbewohner");
|
set_string(&newunit->name, "Bergbewohner");
|
||||||
set_money(newunit, (rand() % 40 + 60) * newunit->number);
|
set_money(newunit, (rand() % 40 + 60) * newunit->number);
|
||||||
set_skill(newunit, SK_SWORD, (90 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_SWORD, skill_level(2+rand()%2) * newunit->number);
|
||||||
set_item(newunit, I_SWORD, newunit->number);
|
set_item(newunit, I_SWORD, newunit->number);
|
||||||
set_skill(newunit, SK_ARMORER, (90 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_ARMORER, skill_level(2+rand()%2) * newunit->number);
|
||||||
set_skill(newunit, SK_TRADE, (30 + rand() % 120) * newunit->number);
|
set_skill(newunit, SK_TRADE, skill_level(1+rand()%3) * newunit->number);
|
||||||
if (rand() % 100 < 60) {
|
if (rand() % 100 < 60) {
|
||||||
set_item(newunit, I_PLATE_ARMOR, newunit->number);
|
set_item(newunit, I_PLATE_ARMOR, newunit->number);
|
||||||
}
|
}
|
||||||
|
@ -454,9 +464,9 @@ get_allies(region * r, unit * u)
|
||||||
newunit = createunit(r, u->faction, rand() % 4 + 2, u->faction->race);
|
newunit = createunit(r, u->faction, rand() % 4 + 2, u->faction->race);
|
||||||
set_string(&newunit->name, "Eisleute");
|
set_string(&newunit->name, "Eisleute");
|
||||||
set_money(newunit, (rand() % 20 + 20) * newunit->number);
|
set_money(newunit, (rand() % 20 + 20) * newunit->number);
|
||||||
set_skill(newunit, SK_SWORD, (90 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_SWORD, skill_level(2+rand()%2) * newunit->number);
|
||||||
set_item(newunit, I_SWORD, newunit->number);
|
set_item(newunit, I_SWORD, newunit->number);
|
||||||
set_skill(newunit, SK_ARMORER, (90 + rand() % 60) * newunit->number);
|
set_skill(newunit, SK_ARMORER, skill_level(2+rand()%2) * newunit->number);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +485,7 @@ get_allies(region * r, unit * u)
|
||||||
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
encounter(region * r, unit * u)
|
encounter(region * r, unit * u)
|
||||||
{
|
{
|
||||||
if (!fval(r, RF_ENCOUNTER)) return;
|
if (!fval(r, RF_ENCOUNTER)) return;
|
||||||
|
@ -1018,8 +1028,12 @@ godcurse(void)
|
||||||
for(u=r->units; u; u=u->next) {
|
for(u=r->units; u; u=u->next) {
|
||||||
for(sk=0; sk < MAXSKILLS; sk++) {
|
for(sk=0; sk < MAXSKILLS; sk++) {
|
||||||
int s = get_skill(u, sk);
|
int s = get_skill(u, sk);
|
||||||
if(s > 0) {
|
if (s > 0) {
|
||||||
|
#if SKILLPOINTS
|
||||||
change_skill(u, sk, -min(s, (30+rand()%90)*u->number));
|
change_skill(u, sk, -min(s, (30+rand()%90)*u->number));
|
||||||
|
#else
|
||||||
|
change_skill(u, sk, -min(s, u->number));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1070,8 +1084,8 @@ randomevents(void)
|
||||||
if (p && (p->flags & PFL_NOORCGROWTH)) continue;
|
if (p && (p->flags & PFL_NOORCGROWTH)) continue;
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
if ( (u->race == new_race[RC_ORC] || is_cursed(u->attribs, C_ORC, 0))
|
if ( (u->race == new_race[RC_ORC] || is_cursed(u->attribs, C_ORC, 0))
|
||||||
&& get_skill(u, SK_MAGIC) == 0
|
&& !get_skill(u, SK_MAGIC)
|
||||||
&& get_skill(u, SK_ALCHEMY) == 0) {
|
&& !get_skill(u, SK_ALCHEMY)) {
|
||||||
int increase = 0;
|
int increase = 0;
|
||||||
int num, prob;
|
int num, prob;
|
||||||
|
|
||||||
|
@ -1090,28 +1104,20 @@ randomevents(void)
|
||||||
}
|
}
|
||||||
if (increase) {
|
if (increase) {
|
||||||
if (u->race == new_race[RC_ORC]) {
|
if (u->race == new_race[RC_ORC]) {
|
||||||
int s;
|
int i;
|
||||||
s = get_skill(u, SK_SWORD) / (u->number * 2);
|
struct orcskills {
|
||||||
change_skill(u, SK_SWORD,
|
skill_t skill;
|
||||||
increase * max(30, s));
|
int level;
|
||||||
s = get_skill(u, SK_SPEAR) / (u->number * 2);
|
} skills [] = {
|
||||||
change_skill(u, SK_SPEAR,
|
{ SK_SWORD, 1 }, { SK_SPEAR, 1 }, { SK_TACTICS, 0 },
|
||||||
increase * max(30, s));
|
{ SK_LONGBOW, 0 }, { SK_CROSSBOW, 0 }, { SK_CATAPULT, 0 },
|
||||||
s = get_skill(u, SK_TACTICS) / (u->number * 2);
|
{ SK_AUSDAUER, 0 }, { NOSKILL, 0 }
|
||||||
change_skill(u, SK_TACTICS,
|
};
|
||||||
increase * s);
|
for (i=0;skills[i].skill!=NOSKILL;++i) {
|
||||||
s = get_skill(u, SK_LONGBOW) / (u->number * 2);
|
int s = get_skill(u, skills[i].skill) / (u->number * 2);
|
||||||
change_skill(u, SK_LONGBOW,
|
int k = skill_level(skills[i].level);
|
||||||
increase * s);
|
change_skill(u, skills[i].skill, increase * max(k, s));
|
||||||
s = get_skill(u, SK_CROSSBOW) / (u->number * 2);
|
}
|
||||||
change_skill(u, SK_CROSSBOW,
|
|
||||||
increase * s);
|
|
||||||
s = get_skill(u, SK_CATAPULT) / (u->number * 2);
|
|
||||||
change_skill(u, SK_CATAPULT,
|
|
||||||
increase * s);
|
|
||||||
s = get_skill(u, SK_AUSDAUER) / (u->number * 2);
|
|
||||||
change_skill(u, SK_AUSDAUER,
|
|
||||||
increase * s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_number(u, u->number + increase);
|
set_number(u, u->number + increase);
|
||||||
|
@ -1176,20 +1182,25 @@ randomevents(void)
|
||||||
dc = max(0, dc);
|
dc = max(0, dc);
|
||||||
rsetpeasants(r, dc);
|
rsetpeasants(r, dc);
|
||||||
for (sk = 0; sk != MAXSKILLS; sk++) {
|
for (sk = 0; sk != MAXSKILLS; sk++) {
|
||||||
if (get_skill(u, sk) > 0 && rand() % 100 < 25) {
|
if (get_skill(u, sk) && rand() % 100 < 25) {
|
||||||
|
int change = rand() % 90 + 1;
|
||||||
if (rand() % 100 < 60) {
|
if (rand() % 100 < 60) {
|
||||||
change_skill(u, sk, u->number * (rand() % 90 + 1));
|
#if SKILLPOINTS
|
||||||
|
change_skill(u, sk, u->number * change);
|
||||||
|
#else
|
||||||
|
if (learn_skill(u, sk, change * u->number)) {
|
||||||
|
change_skill(u, sk, u->number);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
int s = get_skill(u, sk);
|
int s = get_skill(u, sk);
|
||||||
int r = u->number * (rand() % 90 + 1);
|
#ifdef SKILLPOINTS
|
||||||
r = min(s, r);
|
s = min(s, u->number * change);
|
||||||
change_skill(u, sk, -r);
|
change_skill(u, sk, -s);
|
||||||
#if 0
|
#else
|
||||||
/* ist kaputt. weiß nicht, wieso. */
|
s = min(s, u->number);
|
||||||
if (r==s) {
|
if (learn_skill(u, sk, change * u->number)) {
|
||||||
sprintf(buf, "Durch Konzentrationsmangel vergißt %s das Talent %s vollständig",
|
change_skill(u, sk, -s);
|
||||||
unitname(u), skillname(u->faction->local, sk));
|
|
||||||
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1200,13 +1211,11 @@ randomevents(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
#if (RACE_ADJUSTMENTS==0)
|
#if !RACE_ADJUSTMENTS
|
||||||
/* Elfen generieren Wald, Personen in Steinkreisen können Einhörner
|
/* Elfen generieren Wald */
|
||||||
* bekommen. */
|
|
||||||
|
|
||||||
if (r->land && !fval(r, RF_MALLORN)) {
|
if (r->land && !fval(r, RF_MALLORN)) {
|
||||||
#if GROWING_TREES
|
#if GROWING_TREES
|
||||||
int trees = rtrees(r,2);
|
int trees = rtrees(r, 2);
|
||||||
#else
|
#else
|
||||||
int trees = rtrees(r);
|
int trees = rtrees(r);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1225,8 +1234,8 @@ randomevents(void)
|
||||||
rsettrees(r, 2, trees);
|
rsettrees(r, 2, trees);
|
||||||
#else
|
#else
|
||||||
rsettrees(r, trees);
|
rsettrees(r, trees);
|
||||||
#endif
|
#endif /* GROWING_TREES */
|
||||||
}
|
} /* !RACE_ADJUSTMENTS */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (u=r->units; u; u=u->next) {
|
for (u=r->units; u; u=u->next) {
|
||||||
|
@ -1324,10 +1333,10 @@ randomevents(void)
|
||||||
unit * u;
|
unit * u;
|
||||||
if (rterrain(r) == T_OCEAN && rand()%10000 < 1) {
|
if (rterrain(r) == T_OCEAN && rand()%10000 < 1) {
|
||||||
u = createunit(r, findfaction(MONSTER_FACTION), 1, new_race[RC_SEASERPENT]);
|
u = createunit(r, findfaction(MONSTER_FACTION), 1, new_race[RC_SEASERPENT]);
|
||||||
set_skill(u, SK_MAGIC, u->number * 300);
|
set_skill(u, SK_MAGIC, u->number * skill_level(4));
|
||||||
set_skill(u, SK_OBSERVATION, u->number * 180);
|
set_skill(u, SK_OBSERVATION, u->number * skill_level(3));
|
||||||
set_skill(u, SK_STEALTH, u->number * 90);
|
set_skill(u, SK_STEALTH, u->number * skill_level(2));
|
||||||
set_skill(u, SK_AUSDAUER, u->number * 30);
|
set_skill(u, SK_AUSDAUER, u->number * skill_level(1));
|
||||||
set_string(&u->name, "Seeschlange");
|
set_string(&u->name, "Seeschlange");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,10 +1361,10 @@ randomevents(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_money(u, u->number * (rand() % 500 + 100));
|
set_money(u, u->number * (rand() % 500 + 100));
|
||||||
set_skill(u, SK_MAGIC, u->number * 300);
|
set_skill(u, SK_MAGIC, u->number * skill_level(4));
|
||||||
set_skill(u, SK_OBSERVATION, u->number * (rand() % 180));
|
set_skill(u, SK_OBSERVATION, u->number * skill_level(1+rand()%3));
|
||||||
set_skill(u, SK_AUSDAUER, u->number * 30);
|
set_skill(u, SK_AUSDAUER, u->number * skill_level(1));
|
||||||
set_skill(u, SK_STEALTH, u->number * 30);
|
set_skill(u, SK_STEALTH, u->number * skill_level(1));
|
||||||
log_printf("%d %s in %s.\n", u->number,
|
log_printf("%d %s in %s.\n", u->number,
|
||||||
LOC(default_locale, rc_name(u->race, u->number!=1)), regionname(r, NULL));
|
LOC(default_locale, rc_name(u->race, u->number!=1)), regionname(r, NULL));
|
||||||
|
|
||||||
|
@ -1428,7 +1437,7 @@ randomevents(void)
|
||||||
|
|
||||||
for (i=0;i < MAXSKILLS;i++) {
|
for (i=0;i < MAXSKILLS;i++) {
|
||||||
if (rc->bonus[i] >= 1) {
|
if (rc->bonus[i] >= 1) {
|
||||||
set_skill(u, i, 30 * u->number);
|
set_skill(u, i, skill_level(1) * u->number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u->hp = unit_max_hp(u) * u->number;
|
u->hp = unit_max_hp(u) * u->number;
|
||||||
|
@ -1498,7 +1507,13 @@ randomevents(void)
|
||||||
u = createunit(r, findfaction(MONSTER_FACTION),treemen, new_race[RC_TREEMAN]);
|
u = createunit(r, findfaction(MONSTER_FACTION),treemen, new_race[RC_TREEMAN]);
|
||||||
set_string(&u->lastorder, "WARTEN");
|
set_string(&u->lastorder, "WARTEN");
|
||||||
/* guard(u, GUARD_ALL); kein auto-guard! erst in monster.c! */
|
/* guard(u, GUARD_ALL); kein auto-guard! erst in monster.c! */
|
||||||
change_skill(u,SK_OBSERVATION,180*u->number);
|
#if SKILLPOINTS
|
||||||
|
change_skill(u, SK_OBSERVATION, u->number * 180);
|
||||||
|
#else
|
||||||
|
if (learn_skill(u, SK_OBSERVATION, u->number * 180)) {
|
||||||
|
change_skill(u, SK_OBSERVATION, u->number);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (u->number == 1)
|
if (u->number == 1)
|
||||||
set_string(&u->name, "Ein wütender Ent");
|
set_string(&u->name, "Ein wütender Ent");
|
||||||
else
|
else
|
||||||
|
|
|
@ -2329,9 +2329,12 @@ aftermath(battle * b)
|
||||||
int sum_hp = 0;
|
int sum_hp = 0;
|
||||||
int n;
|
int n;
|
||||||
if (relevant && df->action_counter >= du->number) {
|
if (relevant && df->action_counter >= du->number) {
|
||||||
|
ship * sh = du->ship?du->ship:leftship(du);
|
||||||
|
|
||||||
|
if (sh) fset(sh, SF_DAMAGED);
|
||||||
fset(du, FL_LONGACTION);
|
fset(du, FL_LONGACTION);
|
||||||
/* TODO: das sollte hier weg sobald anderswo üb
|
/* TODO: das sollte hier weg sobald anderswo üb
|
||||||
* erall HADBATTLE getestet wird. */
|
* erall FL_LONGACTION getestet wird. */
|
||||||
set_string(&du->thisorder, "");
|
set_string(&du->thisorder, "");
|
||||||
}
|
}
|
||||||
for (n = 0; n != df->alive; ++n) {
|
for (n = 0; n != df->alive; ++n) {
|
||||||
|
@ -2441,8 +2444,6 @@ aftermath(battle * b)
|
||||||
* schonmal Schaden genommen hat. (moved und drifted
|
* schonmal Schaden genommen hat. (moved und drifted
|
||||||
* sollten in flags überführt werden */
|
* sollten in flags überführt werden */
|
||||||
|
|
||||||
for (sh=r->ships; sh; sh=sh->next) sh->drifted = false;
|
|
||||||
|
|
||||||
for (fi = fighters->begin; fi != fighters->end; ++fi) {
|
for (fi = fighters->begin; fi != fighters->end; ++fi) {
|
||||||
fighter *df = *fi;
|
fighter *df = *fi;
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
|
@ -2462,9 +2463,9 @@ aftermath(battle * b)
|
||||||
|
|
||||||
if (du->ship) sh = du->ship; else sh = leftship(du);
|
if (du->ship) sh = du->ship; else sh = leftship(du);
|
||||||
|
|
||||||
if (sh && sh->drifted == false && b->turn+(b->has_tactics_turn?1:0)>2) {
|
if (sh && fval(sh, SF_DAMAGED) && b->turn+(b->has_tactics_turn?1:0)>2) {
|
||||||
damage_ship(sh, 0.20);
|
damage_ship(sh, 0.20);
|
||||||
sh->drifted = true;
|
freset(sh, SF_DAMAGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2472,7 +2473,7 @@ aftermath(battle * b)
|
||||||
ship **sp = &r->ships;
|
ship **sp = &r->ships;
|
||||||
while (*sp) {
|
while (*sp) {
|
||||||
ship * sh = *sp;
|
ship * sh = *sp;
|
||||||
sh->drifted = false;
|
freset(sh, SF_DAMAGED);
|
||||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||||
destroy_ship(sh, r);
|
destroy_ship(sh, r);
|
||||||
}
|
}
|
||||||
|
@ -3225,10 +3226,8 @@ join_allies(battle * b)
|
||||||
for (si = 0; si != size; ++si) {
|
for (si = 0; si != size; ++si) {
|
||||||
int se;
|
int se;
|
||||||
side *s = b->sides.begin[si];
|
side *s = b->sides.begin[si];
|
||||||
#ifdef NOAID
|
|
||||||
/* Wenn alle attackierten noch FL_NOAIDF haben, dann kämpfe nicht mit. */
|
/* Wenn alle attackierten noch FL_NOAIDF haben, dann kämpfe nicht mit. */
|
||||||
if (fval(s->bf->faction, FL_NOAIDF)) continue;
|
if (fval(s->bf->faction, FL_NOAIDF)) continue;
|
||||||
#endif
|
|
||||||
if (s->bf->faction!=f) {
|
if (s->bf->faction!=f) {
|
||||||
/* Wenn wir attackiert haben, kommt niemand mehr hinzu: */
|
/* Wenn wir attackiert haben, kommt niemand mehr hinzu: */
|
||||||
if (s->bf->attacker) continue;
|
if (s->bf->attacker) continue;
|
||||||
|
@ -3361,14 +3360,13 @@ do_battle(void)
|
||||||
battle *b = NULL;
|
battle *b = NULL;
|
||||||
int sides = 0;
|
int sides = 0;
|
||||||
side *s;
|
side *s;
|
||||||
|
ship * sh;
|
||||||
void **fi;
|
void **fi;
|
||||||
building *bu;
|
building *bu;
|
||||||
|
|
||||||
#ifdef NOAID
|
|
||||||
for (u = r->units; u != NULL; u = u->next) {
|
for (u = r->units; u != NULL; u = u->next) {
|
||||||
fset(u->faction, FL_NOAIDF);
|
fset(u->faction, FL_NOAIDF);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* list_foreach geht nicht, wegen flucht */
|
/* list_foreach geht nicht, wegen flucht */
|
||||||
for (u = r->units; u != NULL; u = u->next) {
|
for (u = r->units; u != NULL; u = u->next) {
|
||||||
|
@ -3515,12 +3513,11 @@ do_battle(void)
|
||||||
c1 = join_battle(b, u, true);
|
c1 = join_battle(b, u, true);
|
||||||
c2 = join_battle(b, u2, false);
|
c2 = join_battle(b, u2, false);
|
||||||
|
|
||||||
#ifdef NOAID
|
|
||||||
/* Hat die attackierte Einheit keinen Noaid-Status,
|
/* Hat die attackierte Einheit keinen Noaid-Status,
|
||||||
* wird das Flag von der Faction genommen, andere
|
* wird das Flag von der Faction genommen, andere
|
||||||
* Einheiten greifen ein. */
|
* Einheiten greifen ein. */
|
||||||
if (!fval(u2, FL_NOAID)) freset(u2->faction, FL_NOAIDF);
|
if (!fval(u2, FL_NOAID)) freset(u2->faction, FL_NOAIDF);
|
||||||
#endif
|
|
||||||
if (c1 && c2) {
|
if (c1 && c2) {
|
||||||
/* Merken, wer Angreifer ist, für die Rückzahlung der
|
/* Merken, wer Angreifer ist, für die Rückzahlung der
|
||||||
* Präcombataura bei kurzem Kampf. */
|
* Präcombataura bei kurzem Kampf. */
|
||||||
|
@ -3568,6 +3565,9 @@ do_battle(void)
|
||||||
}
|
}
|
||||||
list_next(bu);
|
list_next(bu);
|
||||||
|
|
||||||
|
/* make sure no ships are damaged initially */
|
||||||
|
for (sh=r->ships; sh; sh=sh->next) freset(sh, SF_DAMAGED);
|
||||||
|
|
||||||
/* Gibt es eine Taktikrunde ? */
|
/* Gibt es eine Taktikrunde ? */
|
||||||
b->turn = 1;
|
b->turn = 1;
|
||||||
#ifndef NEW_TACTICS
|
#ifndef NEW_TACTICS
|
||||||
|
|
|
@ -1684,7 +1684,7 @@ create_unit(region * r, faction * f, int number, const struct race *urace, int i
|
||||||
f->no_units++;
|
f->no_units++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creator){
|
if (creator) {
|
||||||
attrib * a;
|
attrib * a;
|
||||||
|
|
||||||
/* erbt Kampfstatus */
|
/* erbt Kampfstatus */
|
||||||
|
|
|
@ -84,9 +84,6 @@ struct xml_stack;
|
||||||
#include <attrib.h>
|
#include <attrib.h>
|
||||||
|
|
||||||
#define AT_PERSISTENT
|
#define AT_PERSISTENT
|
||||||
#undef RANDOMIZED_LEARNING
|
|
||||||
#undef NOVISIBLESKILLPOINTS
|
|
||||||
#undef SKILLMODIFIESLEARNING
|
|
||||||
|
|
||||||
/* eressea-defined attribute-type flags */
|
/* eressea-defined attribute-type flags */
|
||||||
#define ATF_CURSE ATF_USER_DEFINED
|
#define ATF_CURSE ATF_USER_DEFINED
|
||||||
|
@ -105,7 +102,6 @@ struct xml_stack;
|
||||||
#define NEW_TAVERN
|
#define NEW_TAVERN
|
||||||
#define GOBLINKILL
|
#define GOBLINKILL
|
||||||
#undef HELFE_WAHRNEHMUNG
|
#undef HELFE_WAHRNEHMUNG
|
||||||
#define NOAID
|
|
||||||
|
|
||||||
#define USE_FIREWALL 1
|
#define USE_FIREWALL 1
|
||||||
#undef COMPATIBILITY
|
#undef COMPATIBILITY
|
||||||
|
@ -880,10 +876,8 @@ typedef struct skillvalue {
|
||||||
#define MAX_UNIT_NR (36*36*36*36-1)
|
#define MAX_UNIT_NR (36*36*36*36-1)
|
||||||
#define MAX_CONTAINER_NR (36*36*36*36-1)
|
#define MAX_CONTAINER_NR (36*36*36*36-1)
|
||||||
|
|
||||||
#ifdef NOAID
|
|
||||||
#define FL_NOAIDF (1<<21) /* Hilfsflag Kampf */
|
#define FL_NOAIDF (1<<21) /* Hilfsflag Kampf */
|
||||||
#define FL_NOAID (1<<22) /* Einheit hat Noaid-Status */
|
#define FL_NOAID (1<<22) /* Einheit hat Noaid-Status */
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FL_MARK (1<<23) /* für markierende algorithmen, die das hinterher auch wieder
|
#define FL_MARK (1<<23) /* für markierende algorithmen, die das hinterher auch wieder
|
||||||
löschen müssen! (Ist dafür nicht eigentlich FL_DH gedacht?) */
|
löschen müssen! (Ist dafür nicht eigentlich FL_DH gedacht?) */
|
||||||
|
@ -892,13 +886,8 @@ typedef struct skillvalue {
|
||||||
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
||||||
#define FL_RESTARTED (1<<27) /* Partei hat schon einen Neustart gemacht */
|
#define FL_RESTARTED (1<<27) /* Partei hat schon einen Neustart gemacht */
|
||||||
/* no longer used, may contain old data! */
|
/* no longer used, may contain old data! */
|
||||||
|
|
||||||
/* Flags, die gespeichert werden sollen: */
|
/* Flags, die gespeichert werden sollen: */
|
||||||
#ifdef NOAID
|
|
||||||
#define FL_SAVEMASK (FL_NOAID | FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
#define FL_SAVEMASK (FL_NOAID | FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
||||||
#else
|
|
||||||
#define FL_SAVEMASK (FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define fval(u, i) ((u)->flags & (i))
|
#define fval(u, i) ((u)->flags & (i))
|
||||||
#define fset(u, i) ((u)->flags |= (i))
|
#define fset(u, i) ((u)->flags |= (i))
|
||||||
|
@ -1191,4 +1180,6 @@ typedef struct settings {
|
||||||
extern settings global;
|
extern settings global;
|
||||||
|
|
||||||
extern FILE * updatelog;
|
extern FILE * updatelog;
|
||||||
|
extern int produceexp(struct unit * u, skill_t sk, int n);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -148,7 +148,7 @@ personcapacity(const unit *u)
|
||||||
|
|
||||||
if (old_race(u->race) == RC_TROLL)
|
if (old_race(u->race) == RC_TROLL)
|
||||||
cap += 540;
|
cap += 540;
|
||||||
#ifdef RACE_ADJUSTMENTS
|
#if RACE_ADJUSTMENTS
|
||||||
else if(old_race(u->race) == RC_GOBLIN)
|
else if(old_race(u->race) == RC_GOBLIN)
|
||||||
cap -= 100;
|
cap -= 100;
|
||||||
#endif
|
#endif
|
||||||
|
@ -465,7 +465,7 @@ move_ship(ship * sh, region * from, region * to, region ** route)
|
||||||
ulist = &u->next;
|
ulist = &u->next;
|
||||||
u->ship = sh;
|
u->ship = sh;
|
||||||
if (route && eff_skill(u, SK_SAILING, from) >= 1) {
|
if (route && eff_skill(u, SK_SAILING, from) >= 1) {
|
||||||
change_skill(u, SK_SAILING, PRODUCEEXP * u->number);
|
produceexp(u, SK_SAILING, u->number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u = nu;
|
u = nu;
|
||||||
|
@ -486,7 +486,7 @@ drifting_ships(region * r)
|
||||||
sh2 = sh->next;
|
sh2 = sh->next;
|
||||||
|
|
||||||
/* Schiff schon abgetrieben oder durch Zauber geschützt? */
|
/* Schiff schon abgetrieben oder durch Zauber geschützt? */
|
||||||
if (sh->drifted == 1 || is_cursed(sh->attribs, C_SHIP_NODRIFT, 0)) {
|
if (fval(sh, SF_DRIFTED) || is_cursed(sh->attribs, C_SHIP_NODRIFT, 0)) {
|
||||||
sh = sh2;
|
sh = sh2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ drifting_ships(region * r)
|
||||||
for (f = factions; f; f = f->next)
|
for (f = factions; f; f = f->next)
|
||||||
freset(f, FL_DH);
|
freset(f, FL_DH);
|
||||||
#endif
|
#endif
|
||||||
if (sh->drifted) {
|
if (fval(sh, SF_DRIFTED)) {
|
||||||
/* wenn schon einmal abgetrieben, dann durchreise eintragen */
|
/* wenn schon einmal abgetrieben, dann durchreise eintragen */
|
||||||
route[0] = r;
|
route[0] = r;
|
||||||
sh = move_ship(sh, r, rconnect(r, d), route);
|
sh = move_ship(sh, r, rconnect(r, d), route);
|
||||||
|
@ -559,7 +559,7 @@ drifting_ships(region * r)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sh->drifted = 1;
|
fset(sh, SF_DRIFTED);
|
||||||
|
|
||||||
if (rterrain(rconnect(r, d)) != T_OCEAN) {
|
if (rterrain(rconnect(r, d)) != T_OCEAN) {
|
||||||
/* Alle Attribute
|
/* Alle Attribute
|
||||||
|
@ -928,7 +928,7 @@ travel(region * first, unit * u, region * next, int flucht)
|
||||||
cmistake(u, findorder(u, u->thisorder), 143, MSG_MOVE);
|
cmistake(u, findorder(u, u->thisorder), 143, MSG_MOVE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (rterrain(next) == T_OCEAN && u->ship && u->ship->moved == 1) {
|
} else if (rterrain(next) == T_OCEAN && u->ship && fval(u->ship, FL_MOVED)) {
|
||||||
cmistake(u, findorder(u, u->thisorder), 13, MSG_MOVE);
|
cmistake(u, findorder(u, u->thisorder), 13, MSG_MOVE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1119,7 +1119,7 @@ travel(region * first, unit * u, region * next, int flucht)
|
||||||
mode = 0;
|
mode = 0;
|
||||||
else if (canride(u)) {
|
else if (canride(u)) {
|
||||||
mode = 1;
|
mode = 1;
|
||||||
change_skill(u, SK_RIDING, u->number * PRODUCEEXP);
|
produceexp(u, SK_RIDING, u->number);
|
||||||
} else
|
} else
|
||||||
mode = 2;
|
mode = 2;
|
||||||
|
|
||||||
|
@ -1506,7 +1506,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
|
||||||
/* Falls kein Problem, eines weiter ziehen */
|
/* Falls kein Problem, eines weiter ziehen */
|
||||||
route[step] = dir;
|
route[step] = dir;
|
||||||
tt[step] = current_point; /* travelthrough */
|
tt[step] = current_point; /* travelthrough */
|
||||||
u->ship->moved = 1;
|
fset(u->ship, FL_MOVED);
|
||||||
step++;
|
step++;
|
||||||
m++;
|
m++;
|
||||||
|
|
||||||
|
@ -1533,7 +1533,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
|
||||||
* gekommen ist. Das ist nicht der Fall, wenn er von der Küste ins
|
* gekommen ist. Das ist nicht der Fall, wenn er von der Küste ins
|
||||||
* Inland zu segeln versuchte */
|
* Inland zu segeln versuchte */
|
||||||
|
|
||||||
if (u->ship->moved) {
|
if (fval(u->ship, FL_MOVED)) {
|
||||||
ship * sh = u->ship;
|
ship * sh = u->ship;
|
||||||
/* nachdem alle Richtungen abgearbeitet wurden, und alle Einheiten
|
/* nachdem alle Richtungen abgearbeitet wurden, und alle Einheiten
|
||||||
* transferiert wurden, kann der aktuelle Befehl gelöscht werden. */
|
* transferiert wurden, kann der aktuelle Befehl gelöscht werden. */
|
||||||
|
@ -1544,7 +1544,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
|
||||||
} else {
|
} else {
|
||||||
sh->coast = NODIRECTION;
|
sh->coast = NODIRECTION;
|
||||||
}
|
}
|
||||||
sh->moved = 1;
|
fset(sh, FL_MOVED);
|
||||||
sprintf(buf, "Die %s ", shipname(sh));
|
sprintf(buf, "Die %s ", shipname(sh));
|
||||||
if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) )
|
if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) )
|
||||||
scat("fliegt");
|
scat("fliegt");
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "karma.h"
|
#include "karma.h"
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
|
#include "message.h"
|
||||||
#include "race.h"
|
#include "race.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
|
@ -103,12 +104,10 @@ report_kampfstatus(const unit * u, const struct locale * lang)
|
||||||
"status_avoid", "status_flee" };
|
"status_avoid", "status_flee" };
|
||||||
|
|
||||||
strcpy(fsbuf, LOC(lang, azstatus[u->status]));
|
strcpy(fsbuf, LOC(lang, azstatus[u->status]));
|
||||||
#ifdef NOAID
|
if (fval(u, FL_NOAID)) {
|
||||||
if(fval(u, FL_NOAID)) {
|
|
||||||
strcat(fsbuf, ", ");
|
strcat(fsbuf, ", ");
|
||||||
strcat(fsbuf, LOC(lang, "status_noaid"));
|
strcat(fsbuf, LOC(lang, "status_noaid"));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return fsbuf;
|
return fsbuf;
|
||||||
}
|
}
|
||||||
|
@ -119,15 +118,15 @@ hp_status(const unit * u)
|
||||||
double p = (double) ((double) u->hp / (double) (u->number * unit_max_hp(u)));
|
double p = (double) ((double) u->hp / (double) (u->number * unit_max_hp(u)));
|
||||||
|
|
||||||
if (p > 2.00)
|
if (p > 2.00)
|
||||||
return "sehr stark";
|
return "dmg_critical";
|
||||||
if (p > 1.50)
|
if (p > 1.50)
|
||||||
return "stark";
|
return "dmg_heavily";
|
||||||
if (p < 0.50)
|
if (p < 0.50)
|
||||||
return "schwer verwundet";
|
return "dmg_badly";
|
||||||
if (p < 0.75)
|
if (p < 0.75)
|
||||||
return "verwundet";
|
return "dmg_wounded";
|
||||||
if (p < 0.99)
|
if (p < 0.99)
|
||||||
return "erschöpft";
|
return "dmg_exhausted";
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +264,7 @@ bufunit(const faction * f, const unit * u, int indent, int mode)
|
||||||
/* status */
|
/* status */
|
||||||
|
|
||||||
if (u->number && (u->faction == f || telepath_see || isbattle)) {
|
if (u->number && (u->faction == f || telepath_see || isbattle)) {
|
||||||
const char * c = hp_status(u);
|
const char * c = locale_string(f->locale, hp_status(u));
|
||||||
scat(", ");
|
scat(", ");
|
||||||
scat(report_kampfstatus(u, f->locale));
|
scat(report_kampfstatus(u, f->locale));
|
||||||
if (c || fval(u, FL_HUNGER)) {
|
if (c || fval(u, FL_HUNGER)) {
|
||||||
|
@ -634,7 +633,7 @@ spskill(const struct locale * lang, const struct unit * u, skill_t sk, int *dh,
|
||||||
}
|
}
|
||||||
sbuf += sprintf(sbuf, "%d", effskill(u, sk));
|
sbuf += sprintf(sbuf, "%d", effskill(u, sk));
|
||||||
|
|
||||||
#ifndef NOVISIBLESKILLPOINTS
|
#if SKILLPOINTS
|
||||||
if (days) {
|
if (days) {
|
||||||
assert(u->number);
|
assert(u->number);
|
||||||
sbuf += sprintf(sbuf, " [%d]", d / u->number);
|
sbuf += sprintf(sbuf, " [%d]", d / u->number);
|
||||||
|
@ -689,11 +688,7 @@ spy_message(int spy, unit *u, unit *target)
|
||||||
{
|
{
|
||||||
const char *c;
|
const char *c;
|
||||||
|
|
||||||
change_skill(u, SK_SPY, PRODUCEEXP);
|
produceexp(u, SK_SPY, u->number);
|
||||||
|
|
||||||
sprintf(buf, "%s gelang es, Informationen über ", unitname(u));
|
|
||||||
scat(unitname(target));
|
|
||||||
scat(" herauszubekommen: ");
|
|
||||||
|
|
||||||
/* Infos:
|
/* Infos:
|
||||||
* - Kampfstatus
|
* - Kampfstatus
|
||||||
|
@ -705,6 +700,7 @@ spy_message(int spy, unit *u, unit *target)
|
||||||
*/
|
*/
|
||||||
/* mit spy=100 (magische Spionage) soll alles herausgefunden werden */
|
/* mit spy=100 (magische Spionage) soll alles herausgefunden werden */
|
||||||
|
|
||||||
|
buf[0]='\0';
|
||||||
if (spy > 99){
|
if (spy > 99){
|
||||||
/* magische Spionage */
|
/* magische Spionage */
|
||||||
/* Zauberwirkungen */
|
/* Zauberwirkungen */
|
||||||
|
@ -822,13 +818,14 @@ spy_message(int spy, unit *u, unit *target)
|
||||||
{ /* immer */
|
{ /* immer */
|
||||||
scat("Kampfstatus: ");
|
scat("Kampfstatus: ");
|
||||||
scat(report_kampfstatus(target, u->faction->locale));
|
scat(report_kampfstatus(target, u->faction->locale));
|
||||||
c = hp_status(target);
|
c = locale_string(u->faction->locale, hp_status(target));
|
||||||
if (c && strlen(c))
|
if (c && strlen(c))
|
||||||
sprintf(buf, "%s (%s)", buf, c);
|
sprintf(buf, "%s (%s)", buf, c);
|
||||||
scat(".");
|
scat(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
ADDMSG(&u->faction->msgs, msg_message("spyreport",
|
||||||
|
"spy target report", u, target, strdup(buf)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct unit *
|
const struct unit *
|
||||||
|
|
|
@ -68,6 +68,10 @@ extern void st_register(const ship_type * type);
|
||||||
|
|
||||||
#define NOSHIP NULL
|
#define NOSHIP NULL
|
||||||
|
|
||||||
|
#define SF_DRIFTED 1<<0
|
||||||
|
#define SF_MOVED 1<<1
|
||||||
|
#define SF_DAMAGED 1<<2 /* for use in combat */
|
||||||
|
|
||||||
typedef struct ship {
|
typedef struct ship {
|
||||||
struct ship *next;
|
struct ship *next;
|
||||||
struct ship *nexthash;
|
struct ship *nexthash;
|
||||||
|
@ -78,11 +82,9 @@ typedef struct ship {
|
||||||
struct attrib * attribs;
|
struct attrib * attribs;
|
||||||
int size;
|
int size;
|
||||||
int damage; /* damage in 100th of a point of size */
|
int damage; /* damage in 100th of a point of size */
|
||||||
int flags;
|
unsigned int flags;
|
||||||
const struct ship_type * type;
|
const struct ship_type * type;
|
||||||
direction_t coast;
|
direction_t coast;
|
||||||
boolean moved;
|
|
||||||
boolean drifted;
|
|
||||||
} ship;
|
} ship;
|
||||||
|
|
||||||
extern void damage_ship(ship *sh, double percent);
|
extern void damage_ship(ship *sh, double percent);
|
||||||
|
|
|
@ -103,31 +103,32 @@ locale_getstring(const locale * lang, const char * key)
|
||||||
const char *
|
const char *
|
||||||
locale_string(const locale * lang, const char * key)
|
locale_string(const locale * lang, const char * key)
|
||||||
{
|
{
|
||||||
unsigned int hkey = hashstring(key);
|
if (key==NULL) return NULL;
|
||||||
unsigned int id = hkey % SMAXHASH;
|
|
||||||
struct locale_string * find;
|
|
||||||
|
|
||||||
if (key == NULL || *key==0) return NULL;
|
|
||||||
if (lang == NULL) return key;
|
|
||||||
find = lang->strings[id];
|
|
||||||
while (find) {
|
|
||||||
if (find->hashkey == hkey && !strcmp(key, find->key)) break;
|
|
||||||
find = find->nexthash;
|
|
||||||
}
|
|
||||||
if (!find) {
|
|
||||||
const char * s = key;
|
|
||||||
log_warning(("missing translation for \"%s\" in locale %s\n", key, lang->name));
|
|
||||||
if (lang!=default_locale) {
|
|
||||||
s = locale_string(default_locale, key);
|
|
||||||
}
|
|
||||||
if (s_debug) {
|
|
||||||
fprintf(s_debug, "%s;%s;%s\n", key, lang->name, s);
|
|
||||||
fflush(s_debug);
|
|
||||||
locale_setstring((struct locale*)lang, key, s);
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
|
unsigned int hkey = hashstring(key);
|
||||||
|
unsigned int id = hkey % SMAXHASH;
|
||||||
|
struct locale_string * find;
|
||||||
|
|
||||||
|
if (key == NULL || *key==0) return NULL;
|
||||||
|
if (lang == NULL) return key;
|
||||||
|
find = lang->strings[id];
|
||||||
|
while (find) {
|
||||||
|
if (find->hashkey == hkey && !strcmp(key, find->key)) break;
|
||||||
|
find = find->nexthash;
|
||||||
|
}
|
||||||
|
if (!find) {
|
||||||
|
const char * s = key;
|
||||||
|
log_warning(("missing translation for \"%s\" in locale %s\n", key, lang->name));
|
||||||
|
if (lang!=default_locale) {
|
||||||
|
s = locale_string(default_locale, key);
|
||||||
|
}
|
||||||
|
if (s_debug) {
|
||||||
|
fprintf(s_debug, "%s;%s;%s\n", key, lang->name, s);
|
||||||
|
fflush(s_debug);
|
||||||
|
locale_setstring((struct locale*)lang, key, s);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
return find->str;
|
return find->str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1043,6 +1043,7 @@ fix_demand_region(region *r)
|
||||||
}
|
}
|
||||||
for (rl=rlist;rl;rl=rl->next) {
|
for (rl=rlist;rl;rl=rl->next) {
|
||||||
region * r = rl->region;
|
region * r = rl->region;
|
||||||
|
log_warning(("fixing demand in %s\n", regionname(r, NULL)));
|
||||||
setluxuries(r, mlux[rand() % maxlux]);
|
setluxuries(r, mlux[rand() % maxlux]);
|
||||||
}
|
}
|
||||||
while (rlist) {
|
while (rlist) {
|
||||||
|
@ -2707,7 +2708,6 @@ korrektur(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_once("grat", fix_ratfamiliar());
|
do_once("grat", fix_ratfamiliar());
|
||||||
do_once("fdmd", fix_demand());
|
|
||||||
do_once("fgms", fix_gms());
|
do_once("fgms", fix_gms());
|
||||||
#if NEW_RESOURCEGROWTH
|
#if NEW_RESOURCEGROWTH
|
||||||
do_once("rndr", randomized_resources());
|
do_once("rndr", randomized_resources());
|
||||||
|
@ -2716,6 +2716,10 @@ korrektur(void)
|
||||||
do_once("szip", set_zip());
|
do_once("szip", set_zip());
|
||||||
do_once("heal", heal_all());
|
do_once("heal", heal_all());
|
||||||
|
|
||||||
|
/* seems something fishy is going on, do this just
|
||||||
|
* to be on the safe side:
|
||||||
|
*/
|
||||||
|
fix_demand();
|
||||||
/* trade_orders(); */
|
/* trade_orders(); */
|
||||||
if (global.data_version < NEWROAD_VERSION) {
|
if (global.data_version < NEWROAD_VERSION) {
|
||||||
newroads();
|
newroads();
|
||||||
|
|
|
@ -4543,16 +4543,22 @@
|
||||||
</locale>
|
</locale>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="spyfail">
|
<message name="spyreport" section="events">
|
||||||
|
<type>
|
||||||
|
<arg name="spy" type="unit"></arg>
|
||||||
|
<arg name="target" type="unit"></arg>
|
||||||
|
<arg name="report" type="string"></arg>
|
||||||
|
</type>
|
||||||
|
<text locale="de">"$unit($spy) gelang es Informationen über $unit(target) herauszubekommen: ${report}."</text>
|
||||||
|
<text locale="en">"$unit($spy) managed to gather Information about $unit(target): ${report}."</text>
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message name="spyfail" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="spy" type="unit"></arg>
|
<arg name="spy" type="unit"></arg>
|
||||||
<arg name="target" type="unit"></arg>
|
<arg name="target" type="unit"></arg>
|
||||||
</type>
|
</type>
|
||||||
<locale name="de">
|
<text locale="de">"$unit($spy) gelang es nicht, etwas über $unit($target) herauszufinden."</text>
|
||||||
<nr section="events">
|
|
||||||
<text>"$unit($spy) gelang es nicht, etwas über $unit($target) herauszufinden."</text>
|
|
||||||
</nr>
|
|
||||||
</locale>
|
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="stealfail">
|
<message name="stealfail">
|
||||||
|
|
|
@ -3153,5 +3153,26 @@
|
||||||
<text locale="en">dwarf</text>
|
<text locale="en">dwarf</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<string name="dmg_critical">
|
||||||
|
<text locale="de">sehr stark</text>
|
||||||
|
<text locale="en">critically wounded</text>
|
||||||
|
</string>
|
||||||
|
<string name="dmg_heavily">
|
||||||
|
<text locale="de">stark</text>
|
||||||
|
<text locale="en">heavily wounded</text>
|
||||||
|
</string>
|
||||||
|
<string name="dmg_badly">
|
||||||
|
<text locale="de">schwer verwundet</text>
|
||||||
|
<text locale="en">badly wounded</text>
|
||||||
|
</string>
|
||||||
|
<string name="dmg_wounded">
|
||||||
|
<text locale="de">verwundet</text>
|
||||||
|
<text locale="en">wounded</text>
|
||||||
|
</string>
|
||||||
|
<string name="dmg_exhausted">
|
||||||
|
<text locale="de">erschöpft</text>
|
||||||
|
<text locale="en">exhausted</text>
|
||||||
|
</string>
|
||||||
|
|
||||||
</namespace>
|
</namespace>
|
||||||
</strings>
|
</strings>
|
||||||
|
|
Loading…
Reference in New Issue