diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index c5c147f3f..3ff993500 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1025,6 +1025,24 @@ inactivefaction(faction * f) fclose(inactiveFILE); } +#ifdef ENHANCED_QUIT +static void +transfer_faction(faction *f, faction *f2) +{ + unit *u, *un; + + for (u = f->units; u;) { + un = u->next; + if(!unit_has_cursed_item(u) + && !has_skill(u, SK_MAGIC) + && !has_skill(u, SK_ALCHEMY)) { + u_setfaction(u, f2); + } + u = un; + } +} +#endif + void quit(void) { @@ -1043,7 +1061,36 @@ quit(void) for (S = u->orders; S; S = S->next) { if (igetkeyword(S->s, u->faction->locale) == K_QUIT) { if (checkpasswd(u->faction, getstrtoken())) { +#ifdef ENHANCED_QUIT + int f2_id = getid(); + + if(f2_id > 0) { + faction *f2 = findfaction(f2_id); + + f = u->faction; + + if(f2 == NULL) { + cmistake(u, S->s, 66, MSG_EVENT); + } else if(f == f2) { + cmistake(u, S->s, 8, MSG_EVENT); +#ifdef ALLIANCES + } else if(u->faction->alliance != f2->alliance) { + cmistake(u, S->s, 315, MSG_EVENT); +#else +#warning ENHANCED_QUIT defined without ALLIANCES +#endif + } else if(alliedfaction(NULL, f, f2, HELP_MONEY)) { + cmistake(u, S->s, 316, MSG_EVENT); + } else { + transfer_faction(f,f2); + destroyfaction(f); + } + } else { + destroyfaction(u->faction); + } +#else destroyfaction(u->faction); +#endif break; } else { cmistake(u, S->s, 86, MSG_EVENT); diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index 90def6e6d..7af9e0aea 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -906,7 +906,7 @@ sp_chaosrow(fighter * fi, int level, int force, spell * sp) if (df->unit->race->battle_flags & BF_NOBLOCK) { df->side->nonblockers[row] -= df->alive; } - row = FIRST_ROW + (rand()%(NUMROWS-1)); + row = FIRST_ROW + (rand()%(LAST_ROW-FIRST_ROW)); switch (row) { case FIGHT_ROW: df->status = ST_FIGHT; diff --git a/src/common/settings-vinyambar-3.h b/src/common/settings-vinyambar-3.h index 8bc58d6de..294dc3c9c 100644 --- a/src/common/settings-vinyambar-3.h +++ b/src/common/settings-vinyambar-3.h @@ -29,7 +29,7 @@ #define LARGE_CASTLES 1 #define NEW_MIGRATION 1 #define NEW_RESOURCEGROWTH 1 -#define NMRTIMEOUT 5 +#define NMRTIMEOUT 99 #define PEASANTS_DO_NOT_STARVE 0 #define PEASANT_ADJUSTMENT 1 #define RACE_ADJUSTMENTS 1 @@ -46,6 +46,7 @@ #define ROIBONUS 4 #endif +#define ENHANCED_QUIT #define ALLIANCES #undef ALLIANCEJOIN #define AUTOALLIANCE (HELP_FIGHT) diff --git a/src/res/de/messages.xml b/src/res/de/messages.xml index 90de6156c..754909b30 100644 --- a/src/res/de/messages.xml +++ b/src/res/de/messages.xml @@ -4483,7 +4483,26 @@ "$unit($unit) in $region($region): '$command' - Eine Partei kann nur einmal neu starten." "$unit($unit) in $region($region): '$command' - Restart can only be used once." - + + + + + + + + "$unit($unit) in $region($region): '$command' - Die Partei kann nur an eine Partei in derselben Allianz übergeben werden." + "$unit($unit) in $region($region): '$command' - The faction can only be given to a faction in the same alliance." + + + + + + + + + "$unit($unit) in $region($region): '$command' - Die Partei möchte unsere Personen nicht aufnehmen." + "$unit($unit) in $region($region): '$command' - The faction does not want to take out people." +