forked from github/server
crashbugs in randenc und rostregen
This commit is contained in:
parent
9ba5ebedb9
commit
873404d8f4
|
@ -167,130 +167,133 @@ dissolve_units(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
improve_all(faction * f, skill_t sk, int weeks)
|
improve_all(faction * f, skill_t sk, int by_weeks)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
boolean ret = by_weeks;
|
||||||
|
|
||||||
for (u = f->units; u; u = u->nextF) {
|
for (u = f->units; u; u = u->nextF) {
|
||||||
if (has_skill(u, sk)) {
|
if (has_skill(u, sk)) {
|
||||||
while (weeks--) {
|
int weeks = 0;
|
||||||
learn_skill(u, sk, 1.0);
|
for (;weeks!=by_weeks;++weeks) {
|
||||||
}
|
learn_skill(u, sk, 1.0);
|
||||||
}
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return weeks;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
find_manual(region * r, unit * u)
|
find_manual(region * r, unit * u)
|
||||||
{
|
{
|
||||||
skill_t skill = NOSKILL;
|
skill_t skill = NOSKILL;
|
||||||
sprintf(buf, "%s stolper%c bei der Erforschung der Region über ",
|
sprintf(buf, "%s stolper%c bei der Erforschung der Region über ",
|
||||||
unitname(u), "nt"[u->number == 1]);
|
unitname(u), "nt"[u->number == 1]);
|
||||||
|
|
||||||
switch (rand() % 4) {
|
switch (rand() % 4) {
|
||||||
case 0:
|
case 0:
|
||||||
scat("die Ruine eines alten Tempels");
|
scat("die Ruine eines alten Tempels");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
scat("eine alte Burgruine");
|
scat("eine alte Burgruine");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
scat("ein zerfallenes Bauernhaus");
|
scat("ein zerfallenes Bauernhaus");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
scat("eine Leiche am Wegesrand");
|
scat("eine Leiche am Wegesrand");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
scat(". Bei der Durchsuchung ");
|
scat(". Bei der Durchsuchung ");
|
||||||
if (u->number == 1) {
|
if (u->number == 1) {
|
||||||
scat("stößt");
|
scat("stößt");
|
||||||
} else {
|
} else {
|
||||||
scat("stoßen");
|
scat("stoßen");
|
||||||
}
|
}
|
||||||
scat(" sie auf das zerfledderte Exemplar eines alten Buches, betitelt ");
|
scat(" sie auf das zerfledderte Exemplar eines alten Buches, betitelt ");
|
||||||
|
|
||||||
switch (rand() % 36) {
|
switch (rand() % 36) {
|
||||||
case 0:
|
case 0:
|
||||||
scat("\'Magie der Elemente\'");
|
scat("\'Magie der Elemente\'");
|
||||||
skill = SK_MAGIC;
|
skill = SK_MAGIC;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
scat("\'Schwerter, Armbrüste, Langbögen\'");
|
scat("\'Schwerter, Armbrüste, Langbögen\'");
|
||||||
skill = SK_WEAPONSMITH;
|
skill = SK_WEAPONSMITH;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
scat("\'Gorms Almanach der Rationellen Kriegsführung\'");
|
scat("\'Gorms Almanach der Rationellen Kriegsführung\'");
|
||||||
skill = SK_TACTICS;
|
skill = SK_TACTICS;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
case 8:
|
case 8:
|
||||||
case 9:
|
case 9:
|
||||||
case 10:
|
case 10:
|
||||||
scat("\'Katamarane, Koggen, Karavellen\'");
|
scat("\'Katamarane, Koggen, Karavellen\'");
|
||||||
skill = SK_SHIPBUILDING;
|
skill = SK_SHIPBUILDING;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
case 12:
|
case 12:
|
||||||
case 13:
|
case 13:
|
||||||
case 14:
|
case 14:
|
||||||
scat("\'Wege der Sterne\'");
|
scat("\'Wege der Sterne\'");
|
||||||
skill = SK_SAILING;
|
skill = SK_SAILING;
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
case 16:
|
case 16:
|
||||||
case 17:
|
case 17:
|
||||||
scat("\'Nadishahs Kleine Gift- und Kräuterkunde\'");
|
scat("\'Nadishahs Kleine Gift- und Kräuterkunde\'");
|
||||||
skill = SK_HERBALISM;
|
skill = SK_HERBALISM;
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
case 19:
|
case 19:
|
||||||
scat("\'Mandricks Kompendium der Alchemie\'");
|
scat("\'Mandricks Kompendium der Alchemie\'");
|
||||||
skill = SK_ALCHEMY;
|
skill = SK_ALCHEMY;
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
case 21:
|
case 21:
|
||||||
case 22:
|
case 22:
|
||||||
case 23:
|
case 23:
|
||||||
scat("\'Die Konstruktion der Burgen und Schlösser von Zentralandune\'");
|
scat("\'Die Konstruktion der Burgen und Schlösser von Zentralandune\'");
|
||||||
skill = SK_BUILDING;
|
skill = SK_BUILDING;
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
case 25:
|
case 25:
|
||||||
case 26:
|
case 26:
|
||||||
case 27:
|
case 27:
|
||||||
scat("\'Die Esse\'");
|
scat("\'Die Esse\'");
|
||||||
skill = SK_ARMORER;
|
skill = SK_ARMORER;
|
||||||
break;
|
break;
|
||||||
case 28:
|
case 28:
|
||||||
case 29:
|
case 29:
|
||||||
case 30:
|
case 30:
|
||||||
case 31:
|
case 31:
|
||||||
scat("\'Über die Gewinnung von Erzen\'");
|
scat("\'Über die Gewinnung von Erzen\'");
|
||||||
skill = SK_MINING;
|
skill = SK_MINING;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
case 33:
|
case 33:
|
||||||
case 34:
|
case 34:
|
||||||
case 35:
|
case 35:
|
||||||
scat("\'Barinions Lieder, eine Einführung für Unbedarfte\'");
|
scat("\'Barinions Lieder, eine Einführung für Unbedarfte\'");
|
||||||
skill = SK_ENTERTAINMENT;
|
skill = SK_ENTERTAINMENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
scat(". Der Wissensschub ist enorm.");
|
scat(". Der Wissensschub ist enorm.");
|
||||||
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
|
||||||
|
|
||||||
if (improve_all(u->faction, skill, 3) == 3) {
|
if (improve_all(u->faction, skill, 3) == 3) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i!=9;++i) learn_skill(u, skill, 1.0);
|
for (i=0;i!=9;++i) learn_skill(u, skill, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1348,7 +1348,7 @@ sp_rosthauch(castorder *co)
|
||||||
|
|
||||||
for (;iweapon!=NULL;iweapon=iweapon->next) {
|
for (;iweapon!=NULL;iweapon=iweapon->next) {
|
||||||
item ** ip = i_find(&u->items, iweapon->type);
|
item ** ip = i_find(&u->items, iweapon->type);
|
||||||
if (ip) {
|
if (*ip) {
|
||||||
int i = min((*ip)->number, force);
|
int i = min((*ip)->number, force);
|
||||||
if (iweapon->chance<1.0) {
|
if (iweapon->chance<1.0) {
|
||||||
i = (int)(i*iweapon->chance);
|
i = (int)(i*iweapon->chance);
|
||||||
|
@ -1365,27 +1365,27 @@ sp_rosthauch(castorder *co)
|
||||||
if (force<=0) break;
|
if (force<=0) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ironweapon>0) {
|
if (ironweapon>0) {
|
||||||
/* {$mage mage} legt einen Rosthauch auf {target}. {amount} Waffen
|
/* {$mage mage} legt einen Rosthauch auf {target}. {amount} Waffen
|
||||||
* wurden vom Rost zerfressen */
|
* wurden vom Rost zerfressen */
|
||||||
ADDMSG(&mage->faction->msgs, msg_message(
|
ADDMSG(&mage->faction->msgs, msg_message("rust_effect",
|
||||||
"rust_effect", "mage target amount", mage, u, ironweapon));
|
"mage target amount", mage, u, ironweapon));
|
||||||
ADDMSG(&u->faction->msgs, msg_message(
|
ADDMSG(&u->faction->msgs, msg_message("rust_effect",
|
||||||
"rust_effect", "mage target amount",
|
"mage target amount",
|
||||||
cansee(u->faction, r, mage, 0) ? mage:NULL, u, ironweapon));
|
cansee(u->faction, r, mage, 0) ? mage:NULL, u, ironweapon));
|
||||||
success += ironweapon;
|
success += ironweapon;
|
||||||
} else {
|
} else {
|
||||||
/* {$mage mage} legt einen Rosthauch auf {target}, doch der
|
/* {$mage mage} legt einen Rosthauch auf {target}, doch der
|
||||||
* Rosthauch fand keine Nahrung */
|
* Rosthauch fand keine Nahrung */
|
||||||
ADDMSG(&mage->faction->msgs, msg_message(
|
ADDMSG(&mage->faction->msgs, msg_message(
|
||||||
"rust_fail", "mage target", mage, u));
|
"rust_fail", "mage target", mage, u));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* in success stehen nun die insgesamt zerstörten Waffen. Im
|
/* in success stehen nun die insgesamt zerstörten Waffen. Im
|
||||||
* ungünstigsten Fall kann pro Stufe nur eine Waffe verzaubert werden,
|
* ungünstigsten Fall kann pro Stufe nur eine Waffe verzaubert werden,
|
||||||
* darum wird hier nur für alle Fälle in denen noch weniger Waffen
|
* darum wird hier nur für alle Fälle in denen noch weniger Waffen
|
||||||
* betroffen wurden ein Kostennachlass gegeben */
|
* betroffen wurden ein Kostennachlass gegeben */
|
||||||
return min(success, cast_level);
|
return min(success, cast_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ get_island(region * root, region_list ** rlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
island_size(region * r)
|
island_size(region * r)
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -424,7 +424,11 @@ island_size(region * r)
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
region * rn = rconnect(r, d);
|
region * rn = rconnect(r, d);
|
||||||
if (rn && !fval(rn, FL_MARK) && rn->land) {
|
if (rn && !fval(rn, FL_MARK) && rn->land) {
|
||||||
add_regionlist(&rlist->next, rn);
|
region_list * rnew = malloc(sizeof(region_list));
|
||||||
|
rnew->data = rn;
|
||||||
|
rnew->next = rlist->next;
|
||||||
|
rlist->next = rnew;
|
||||||
|
fset(rn, FL_MARK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rlist = rlist->next;
|
rlist = rlist->next;
|
||||||
|
|
|
@ -8,7 +8,7 @@ end
|
||||||
|
|
||||||
function change_locales()
|
function change_locales()
|
||||||
-- local localechange = { }
|
-- local localechange = { }
|
||||||
local localechange = { en = { "bLub" } }
|
local localechange = { de = { "2xwr" } }
|
||||||
|
|
||||||
for loc, flist in localechange do
|
for loc, flist in localechange do
|
||||||
for index, name in flist do
|
for index, name in flist do
|
||||||
|
|
Loading…
Reference in New Issue