From f61469171360b04a2853361f12d0b59dc1c9ef7b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 1 Jul 2009 01:03:12 +0000 Subject: [PATCH] - richtig viele bugfixes --- src/common/gamecode/creport.c | 14 +++-- src/common/gamecode/economy.c | 2 +- src/common/gamecode/laws.c | 5 +- src/common/gamecode/report.c | 35 +++++++----- src/common/gamecode/study.c | 30 ++++++----- src/common/kernel/item.c | 13 +++-- src/common/kernel/region.c | 6 +++ src/common/kernel/reports.c | 2 +- src/common/kernel/skill.c | 2 +- src/common/spells/spells.c | 4 +- src/eressea/server.c | 11 +++- src/eressea/tolua/bind_faction.c | 11 +++- src/eressea/tolua/bind_unit.c | 2 + src/res/buildings.xml | 2 +- src/res/e2k9.xml | 18 +++---- src/res/e2k9/races.xml | 5 +- src/res/e2k9/spells.xml | 16 +++--- src/res/e2k9/strings.xml | 93 +++++++++++++++++++++++++++----- src/res/messages.xml | 10 +++- src/scripts/e2k9.lua | 2 +- 20 files changed, 204 insertions(+), 79 deletions(-) diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 70ca66f09..52c9225c8 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1152,15 +1152,23 @@ cr_output_region(FILE * F, report_context * ctx, seen_region * sr) if (sr->mode>=see_unit) { fprintf(F, "%d;Silber\n", rmoney(r)); - fprintf(F, "%d;Unterh\n", entertainmoney(r)); - + if (skill_enabled[SK_ENTERTAINMENT]) { + fprintf(F, "%d;Unterh\n", entertainmoney(r)); + } if (is_cursed(r->attribs, C_RIOT, 0)){ fprintf(F, "0;Rekruten\n"); } else { fprintf(F, "%d;Rekruten\n", rpeasants(r) / RECRUITFRACTION); } if (production(r)) { - fprintf(F, "%d;Lohn\n", wage(r, f, f->race)); + if (markets_module()) { /* hack */ + fprintf(F, "%d;Lohn\n", wage(r, NULL, NULL)); + } else { + fprintf(F, "%d;Lohn\n", wage(r, f, f->race)); + } + } + if (r->land->ownership) { + fprintf(F, "%d;morale\n", r->land->morale); } } diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 13739720c..406b17d68 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -579,7 +579,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders) cmistake(u, ord, 139, MSG_EVENT); return; } - else u->race = rc; + else u->irace = u->race = rc; } if (has_skill(u, SK_MAGIC)) { diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 00be2a839..962d11c60 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -708,7 +708,7 @@ growing_trees(region * r, const int current_season, const int last_weeks_season) /* Grundchance 1.0% */ /* Jeder Elf in der Region erhöht die Chance um 0.0008%. */ - seedchance += (MIN(elves, (production(r)*MAXPEASANTS_PER_AREA)/8)) * 0.0008; + seedchance += (MIN(elves, (production(r)*MAXPEASANTS_PER_AREA)/8)) * 0.0008 * RESOURCE_QUANTITY; grownup_trees = rtrees(r, 2); seeds = 0; @@ -2974,6 +2974,9 @@ static void age_region(region * r) if (stability>MORALE_COOLDOWN) { if (r->land->ownership->owner && r->land->moraleland->ownership->owner->race); + if (is_cursed(r->attribs, C_GENEROUS, 0)) { + ch *= 1.2; /* 20% improvement */ + } if (chance(ch)) { ++r->land->morale; r->land->ownership->morale_turn = turn; diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index ff508f89a..132a10a11 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -951,6 +951,11 @@ describe(FILE * F, const seen_region * sr, faction * f) bytes = snprintf(bufp, size, ", %d", n); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); + if (r->land->ownership) { + const char * str = locale_string(f->locale, mkname("morale", itoa10(r->land->morale))); + bytes = snprintf(bufp, size, " %s", str); + if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); + } if (fval(r, RF_ORCIFIED)) { bytes = (int)strlcpy(bufp, " ", size); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); @@ -1177,14 +1182,18 @@ statistics(FILE * F, const region * r, const faction * f) rnl(F); /* Region */ - if (fval(r->terrain, LAND_REGION) && rmoney(r)) { + if (skill_enabled[SK_ENTERTAINMENT] && fval(r->terrain, LAND_REGION) && rmoney(r)) { m = msg_message("nr_stat_maxentertainment", "max", entertainmoney(r)); nr_render(m, f->locale, buf, sizeof(buf), f); rparagraph(F, buf, 2, 2, 0); msg_release(m); } if (production(r) && (!fval(r->terrain, SEA_REGION) || f->race == new_race[RC_AQUARIAN])) { - m = msg_message("nr_stat_salary", "max", wage(r, f, f->race)); + if (markets_module()) { /* hack */ + m = msg_message("nr_stat_salary_new", "max", wage(r, NULL, NULL)); + } else { + m = msg_message("nr_stat_salary", "max", wage(r, f, f->race)); + } nr_render(m, f->locale, buf, sizeof(buf), f); rparagraph(F, buf, 2, 2, 0); msg_release(m); @@ -1195,16 +1204,18 @@ statistics(FILE * F, const region * r, const faction * f) rparagraph(F, buf, 2, 2, 0); msg_release(m); - if (buildingtype_exists(r, bt_find("caravan"))) { - m = msg_message("nr_stat_luxuries", "max", - (p * 2) / TRADE_FRACTION); - } else { - m = msg_message("nr_stat_luxuries", "max", - p / TRADE_FRACTION); + if (!markets_module()) { + if (buildingtype_exists(r, bt_find("caravan"))) { + m = msg_message("nr_stat_luxuries", "max", + (p * 2) / TRADE_FRACTION); + } else { + m = msg_message("nr_stat_luxuries", "max", + p / TRADE_FRACTION); + } + nr_render(m, f->locale, buf, sizeof(buf), f); + rparagraph(F, buf, 2, 2, 0); + msg_release(m); } - nr_render(m, f->locale, buf, sizeof(buf), f); - rparagraph(F, buf, 2, 2, 0); - msg_release(m); } /* info about units */ @@ -2185,7 +2196,7 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars const item_type * lux = r_luxury(r); const item_type * herb = r->land->herbtype; message * m = msg_message("nr_market_info", "product herb", - lux->rtype, herb?herb->rtype:0); + lux?lux->rtype:0, herb?herb->rtype:0); rnl(F); nr_paragraph(F, m, f); diff --git a/src/common/gamecode/study.c b/src/common/gamecode/study.c index 0e890a0bf..b94a7dedd 100644 --- a/src/common/gamecode/study.c +++ b/src/common/gamecode/study.c @@ -476,20 +476,24 @@ teach_cmd(unit * u, struct order * ord) static double study_speedup(unit * u) { - static int rule = -1; - if (rule<0) { - rule = get_param_int(global.parameters, "study.speedup", 0); - } - if (rule==1) { - double age = 0; - int i; - for (i=0;i!=u->skill_size;++i) { - skill * sv = u->skills+i; - double time = sv->level*(sv->level+1)/2.0; - age += time; +#define MINTURN 5 /* 5 */ +#define OFSTURN 2 /* 2 */ + if (turn>MINTURN) { + static int rule = -1; + if (rule<0) { + rule = get_param_int(global.parameters, "study.speedup", 0); } - if (age < turn) { - return 2.0-age/turn; + if (rule==1) { + double age = OFSTURN; + int i; + for (i=0;i!=u->skill_size;++i) { + skill * sv = u->skills+i; + double time = sv->level*(sv->level+1)/2.0; + age += time; + } + if (age < turn) { + return 2.0-age/turn; + } } } return 1.0; diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 9500636a3..7b064980a 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -151,13 +151,16 @@ resourcename(const resource_type * rtype, int flags) { int i = 0; - if (rtype->name) return rtype->name(rtype, flags); + if (rtype) { + if (rtype->name) return rtype->name(rtype, flags); - if (flags & NMF_PLURAL) i = 1; - if (flags & NMF_APPEARANCE && rtype->_appearance[i]) { - return rtype->_appearance[i]; + if (flags & NMF_PLURAL) i = 1; + if (flags & NMF_APPEARANCE && rtype->_appearance[i]) { + return rtype->_appearance[i]; + } + return rtype->_name[i]; } - return rtype->_name[i]; + return "none"; } resource_type * diff --git a/src/common/kernel/region.c b/src/common/kernel/region.c index efaecfceb..543c5c649 100644 --- a/src/common/kernel/region.c +++ b/src/common/kernel/region.c @@ -53,6 +53,8 @@ #include #include +#include + /* libc includes */ #include #include @@ -888,6 +890,10 @@ const item_type * r_luxury(region * r) { struct demand * dmd; + if (!r->land->demands) { + fix_demand(r); + assert(r->land->demands); + } for (dmd=r->land->demands;dmd;dmd=dmd->next) { if (dmd->value==0) return dmd->type->itype; } diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index 7ed45a221..57272ba50 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -1032,7 +1032,7 @@ seen_done(seen_region * seehash[]) reuse = seehash[i]; seehash[i] = NULL; } - free(seehash); + // free(seehash); } void diff --git a/src/common/kernel/skill.c b/src/common/kernel/skill.c index f4980c2ed..0dc6c8571 100644 --- a/src/common/kernel/skill.c +++ b/src/common/kernel/skill.c @@ -226,7 +226,7 @@ rc_skillmod(const struct race * rc, const region *r, skill_t sk) { int mods; - if (!skill_enabled[SK_PERCEPTION]) return 0; + if (!skill_enabled[sk]) return 0; #ifdef FASTER_SKILLMOD unsigned int index = hashstring(rc->_name[0]) % RCMODMAXHASH; struct skillmods **imods = &modhash[index]; diff --git a/src/common/spells/spells.c b/src/common/spells/spells.c index baf2fb0ec..fcf639fe2 100644 --- a/src/common/spells/spells.c +++ b/src/common/spells/spells.c @@ -4199,10 +4199,10 @@ sp_generous(castorder *co) message * m = NULL; fset(u->faction, FFL_SELECT); if (cansee(u->faction, r, mage, 0)) { - if (msg[0]==NULL) msg[0] = msg_message("song_of_peace_effect_0", "mage", mage); + if (msg[0]==NULL) msg[0] = msg_message("generous_effect_0", "mage", mage); m = msg[0]; } else { - if (msg[1]==NULL) msg[1] = msg_message("song_of_peace_effect_1", ""); + if (msg[1]==NULL) msg[1] = msg_message("generous_effect_1", ""); m = msg[1]; } r_addmessage(r, u->faction, m); diff --git a/src/eressea/server.c b/src/eressea/server.c index a88ef2673..9ce3d827b 100644 --- a/src/eressea/server.c +++ b/src/eressea/server.c @@ -542,6 +542,11 @@ read_args(int argc, char **argv, lua_State * luaState) } /* add some more variables to the lua globals */ + if (script_path) { + char str[512]; + sprintf(str, "?;?.lua;%s/?.lua;%s/?", script_path, script_path); + setLuaString(luaState, "LUA_PATH", str); + } setLuaString(luaState, "datapath", datapath()); setLuaString(luaState, "scriptpath", script_path); setLuaString(luaState, "basepath", basepath()); @@ -625,7 +630,7 @@ write_skills(void) fputs("\"Rasse\",", F); for (rc=races;rc;rc = rc->next) { if (playerrace(rc)) { - fprintf(F, "\"%s\",", LOC(loc, rc->_name[0])); + fprintf(F, "\"%s\",", LOC(loc, mkname("race", rc->_name[0]))); } } fputc('\n', F); @@ -690,7 +695,9 @@ main(int argc, char *argv[]) if (luafile==NULL) lua_console(luaState); else { char buf[MAX_PATH]; - if (script_path) sprintf(buf, "%s/%s", script_path, luafile); + if (script_path) { + sprintf(buf, "%s/%s", script_path, luafile); + } else strcpy(buf, luafile); #ifdef BINDINGS_LUABIND try { diff --git a/src/eressea/tolua/bind_faction.c b/src/eressea/tolua/bind_faction.c index 87af21945..be756854f 100644 --- a/src/eressea/tolua/bind_faction.c +++ b/src/eressea/tolua/bind_faction.c @@ -163,6 +163,15 @@ tolua_faction_get_options(lua_State* L) return 1; } +static int +tolua_faction_set_options(lua_State* L) +{ + faction * self = (faction *)tolua_tousertype(L, 1, 0); + int options = (int)tolua_tonumber(L, 2, self->options); + self->options = options; + return 1; +} + static int tolua_faction_get_lastturn(lua_State* L) { @@ -452,7 +461,7 @@ tolua_faction_open(lua_State* L) tolua_variable(L, "score", tolua_faction_get_score, NULL); tolua_variable(L, "id", tolua_faction_get_id, tolua_faction_set_id); tolua_variable(L, "age", tolua_faction_get_age, tolua_faction_set_age); - tolua_variable(L, "options", tolua_faction_get_options, NULL); + tolua_variable(L, "options", tolua_faction_get_options, tolua_faction_set_options); tolua_variable(L, "flags", tolua_faction_get_flags, NULL); tolua_variable(L, "lastturn", tolua_faction_get_lastturn, NULL); diff --git a/src/eressea/tolua/bind_unit.c b/src/eressea/tolua/bind_unit.c index 757020299..c246e69ec 100644 --- a/src/eressea/tolua/bind_unit.c +++ b/src/eressea/tolua/bind_unit.c @@ -823,8 +823,10 @@ static int tolua_unit_set_race(lua_State* L) const char * rcname = tolua_tostring(L, 2, 0); race * rc = rc_find(rcname); if (rc!=NULL) { + if (count_unit(self)) --self->faction->no_units; if (self->irace==self->race) self->irace = rc; self->race = rc; + if (count_unit(self)) --self->faction->no_units; } return 0; } diff --git a/src/res/buildings.xml b/src/res/buildings.xml index 7c284e740..4ef3d14aa 100644 --- a/src/res/buildings.xml +++ b/src/res/buildings.xml @@ -166,7 +166,7 @@ - + diff --git a/src/res/e2k9.xml b/src/res/e2k9.xml index 69df32c15..d7b7582b5 100644 --- a/src/res/e2k9.xml +++ b/src/res/e2k9.xml @@ -40,13 +40,13 @@ - - - + + + - + @@ -178,13 +178,13 @@ Bitte denke daran, deine Befehle mit dem Betreff - ERESSEA BEFEHLE an eressea-server@eressea.de zu senden. + E3 BEFEHLE an eressea-server@eressea.de zu senden. Remember to send your orders to - eressea-server@eressea.de with the subject ERESSEA ORDERS. + eressea-server@eressea.de with the subject E3 ORDERS. - ERESSEA BEFEHLE - ERESSEA ORDERS + E3 BEFEHLE + E3 ORDERS diff --git a/src/res/e2k9/races.xml b/src/res/e2k9/races.xml index d2eb182af..fd5cb583c 100644 --- a/src/res/e2k9/races.xml +++ b/src/res/e2k9/races.xml @@ -74,7 +74,7 @@ - + @@ -103,7 +103,6 @@ - @@ -127,7 +126,6 @@ - @@ -171,7 +169,6 @@ - diff --git a/src/res/e2k9/spells.xml b/src/res/e2k9/spells.xml index 13b2aa0a0..beeea5358 100644 --- a/src/res/e2k9/spells.xml +++ b/src/res/e2k9/spells.xml @@ -364,21 +364,21 @@ - + - + - + @@ -386,7 +386,7 @@ - + @@ -396,7 +396,7 @@ - + @@ -405,7 +405,7 @@ - + @@ -414,7 +414,7 @@ - + @@ -424,7 +424,7 @@ - + diff --git a/src/res/e2k9/strings.xml b/src/res/e2k9/strings.xml index c4e441b60..d9928d53b 100644 --- a/src/res/e2k9/strings.xml +++ b/src/res/e2k9/strings.xml @@ -42,6 +42,32 @@ marketplace + + + aufständische + rebellious + + + zornige + angry + + + zufriedene + content + + + glückliche + happy + + + treue + loyal + + + ergebene + devoted + + Streitross charger @@ -59,23 +85,49 @@ tower shields - - Siebenmeilentee - seven mile tea - - - Wasser des Lebens - water of life - - + + Braue Siebenmeilentee + brew seven mile tea + + + Braue Wasser des Lebens + brew water of life + + + Braue Schaffenstrunk + brew busy beer + + + Braue Wundsalbe + brew ointment + + + Braue Bauernblut + brew peasant blood + + + Braue Pferdeglück + brew horsepower potion + + + Braue Elixier der Macht + brew elixir of power + + + Braue Heiltrank + brew healing potion + + + + For Seven Mile Tea, boil up a Cobalt Fungus and pour the resulting brew into a Windbag. Catch and filter the liquid that drips out and administer it. This tea allows up to ten men to move as fast as a horse. Für den Siebenmeilentee koche man einen Blauen Baumringel auf und gieße dieses Gebräu in einen Windbeutel. Das heraustropfende Wasser fange man auf, filtere es und verabreiche es alsdann. Durch diesen Tee können bis zu zehn Menschen schnell wie ein Pferd laufen. - The "Water of Life" allows living trees to be created from logs. A Knotroot and Elvendear are heated until one can just still keep one's finger in. This is then poured into a jar and allowed to cool slowly. The extract is sufficient for 10 pieces of wood. - Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem Elfenlieb erwärmt, so daß man gerade noch den Finger reinhalten kann. Dies gieße man in ein Gefäß und lasse es langsam abkühlen. Der Extrakt reicht für 10 Holzstämme. + The Water of Life allows living trees to be created from logs. A Knotroot and Elvendear are heated until one can just still keep one's finger in. This is then poured into a jar and allowed to cool slowly. The extract is sufficient for 10 pieces of wood. + Das Wasser des Lebens ist in der Lage, aus gefällten Baumstämmen wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem Elfenlieb erwärmt, so daß man gerade noch den Finger reinhalten kann. Dies gieße man in ein Gefäß und lasse es langsam abkühlen. Der Extrakt reicht für 10 Holzstämme. Allow a Tangy Temerity to simmer for three hours in a litre of water, then add a grated Mandrake, and sprinkle in a Gapgrowth harvested at full moon. The whole brew should then be allowed to stew for three days in a warm place. This potion increases the strength and endurance of ten men so that they can achieve twice as much in a week. @@ -102,5 +154,22 @@ Für einen Heiltrank nehme man die Schale eines Windbeutels und etwas Gurgelkraut, rühre eine kleingehacktes Elfenlieb dazu und bestreue alles mit den Blüten einer Eisblume. Dies muß vier Tage lang gären, wobei man am zweiten Tag einen Spaltwachs dazutun muß. Dann ziehe man vorsichtig den oben schwimmenden Saft ab. Ein solcher Trank gibt vier Männern (oder einem Mann vier mal) im Kampf eine Chance von 50%, sonst tödliche Wunden zu überleben. Der Trank wird von ihnen automatisch bei Verletzung angewandt. - + + + Vertrauten binden + Bind Familiar + + + + + Einem erfahrenen Magier wird + irgendwann auf seinen Wanderungen ein + ungewöhnliches Exemplar einer Gattung begegnen, + welches sich dem Magier anschließen wird. + During their travel, seasoned + magicians will occasionally befriend an extraordinary + creature of an unusual species that will join them. + + + diff --git a/src/res/messages.xml b/src/res/messages.xml index 14e1a14ea..6d65ce8da 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -800,7 +800,13 @@ "Lohn für Arbeit: $int($max) Silber" "Worker's salary: $int($max) silver" - "Worker's salary: $int($max) silver" + + + + + + "Bauerneinnahmen: $int($max) Silber" + "Peasant wages: $int($max) silver" @@ -6799,7 +6805,7 @@ - "$unit($unit) in $region($region): '$order($command)' - Der Besitzer muss das Boot zuerst verlassen." + "$unit($unit) in $region($region): '$order($command)' - Der Besitzer muss das Gebäude zuerst verlassen." "$unit($unit) in $region($region): '$order($command)' - The owner must first LEAVE the building." diff --git a/src/scripts/e2k9.lua b/src/scripts/e2k9.lua index 52aba1b12..4da490db6 100644 --- a/src/scripts/e2k9.lua +++ b/src/scripts/e2k9.lua @@ -71,7 +71,7 @@ function process(orders) spawn_dragons() spawn_undead() -- spawn_braineaters(0.25) - spawn_ents() + -- spawn_ents() -- post-turn updates: update_guards()