forked from github/server
Neue Meldung für Konvois mit zu wenigen Kapitänen.
This commit is contained in:
parent
043cb88d91
commit
73df4adde7
|
@ -2753,6 +2753,14 @@
|
||||||
</type>
|
</type>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
|
<message name="error329" section="errors">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
<arg name="region" type="region"/>
|
||||||
|
<arg name="command" type="order"/>
|
||||||
|
</type>
|
||||||
|
</message>
|
||||||
|
|
||||||
<message name="error319" section="errors">
|
<message name="error319" section="errors">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
|
|
@ -2777,6 +2777,9 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - So viele Schiff
|
||||||
msgid "error328"
|
msgid "error328"
|
||||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Dafür müssen die Schiffe an derselben Küste liegen.\""
|
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Dafür müssen die Schiffe an derselben Küste liegen.\""
|
||||||
|
|
||||||
|
msgid "error329"
|
||||||
|
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit ist zu klein für einen Konvoi dieser Größe.\""
|
||||||
|
|
||||||
msgid "give_number_missing"
|
msgid "give_number_missing"
|
||||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Anzahl der $localize($resource) fehlt.\""
|
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Anzahl der $localize($resource) fehlt.\""
|
||||||
|
|
||||||
|
|
|
@ -2780,6 +2780,9 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - The ship is und
|
||||||
msgid "error328"
|
msgid "error328"
|
||||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - All ships of a convoy must be on the same coast.\""
|
msgstr "\"$unit($unit) in $region($region): '$order($command)' - All ships of a convoy must be on the same coast.\""
|
||||||
|
|
||||||
|
msgid "error329"
|
||||||
|
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit has too few members to sail this convoi.\""
|
||||||
|
|
||||||
msgid "give_number_missing"
|
msgid "give_number_missing"
|
||||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Missign number of $localize($resource,0).\""
|
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Missign number of $localize($resource,0).\""
|
||||||
|
|
||||||
|
|
|
@ -408,9 +408,12 @@ int crew_skill(const ship *sh) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ship_crewed(const ship *sh) {
|
bool ship_crewed(const ship *sh, const unit *cap) {
|
||||||
unit *u, *cap = ship_owner(sh);
|
unit *u;
|
||||||
int capskill = -1, sumskill = 0;
|
int capskill = -1, sumskill = 0;
|
||||||
|
if (cap == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (u = sh->region->units; u; u = u->next) {
|
for (u = sh->region->units; u; u = u->next) {
|
||||||
if (u->ship == sh) {
|
if (u->ship == sh) {
|
||||||
int es = effskill(u, SK_SAILING, NULL);
|
int es = effskill(u, SK_SAILING, NULL);
|
||||||
|
|
|
@ -117,7 +117,7 @@ extern "C" {
|
||||||
void ship_setname(struct ship *self, const char *name);
|
void ship_setname(struct ship *self, const char *name);
|
||||||
int shipspeed(const struct ship *sh, const struct unit *u);
|
int shipspeed(const struct ship *sh, const struct unit *u);
|
||||||
|
|
||||||
bool ship_crewed(const struct ship *sh);
|
bool ship_crewed(const struct ship *sh, const struct unit *cap);
|
||||||
int crew_skill(const struct ship *sh);
|
int crew_skill(const struct ship *sh);
|
||||||
int ship_captain_minskill(const struct ship *sh);
|
int ship_captain_minskill(const struct ship *sh);
|
||||||
|
|
||||||
|
|
|
@ -45,39 +45,39 @@ static void test_ship_crewed(CuTest * tc)
|
||||||
stype->cptskill = 2;
|
stype->cptskill = 2;
|
||||||
stype->sumskill = 4;
|
stype->sumskill = 4;
|
||||||
sh = test_create_ship(r, stype);
|
sh = test_create_ship(r, stype);
|
||||||
CuAssertTrue(tc, !ship_crewed(sh));
|
CuAssertTrue(tc, !ship_crewed(sh, NULL));
|
||||||
u1 = test_create_unit(f, r);
|
u1 = test_create_unit(f, r);
|
||||||
set_level(u1, SK_SAILING, 4);
|
set_level(u1, SK_SAILING, 4);
|
||||||
u_set_ship(u1, sh);
|
u_set_ship(u1, sh);
|
||||||
CuAssertTrue(tc, ship_crewed(sh));
|
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||||
u2 = test_create_unit(f, r);
|
u2 = test_create_unit(f, r);
|
||||||
set_level(u1, SK_SAILING, 2);
|
set_level(u1, SK_SAILING, 2);
|
||||||
set_level(u2, SK_SAILING, 2);
|
set_level(u2, SK_SAILING, 2);
|
||||||
u_set_ship(u2, sh);
|
u_set_ship(u2, sh);
|
||||||
CuAssertTrue(tc, ship_crewed(sh));
|
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||||
set_level(u1, SK_SAILING, 1);
|
set_level(u1, SK_SAILING, 1);
|
||||||
set_level(u2, SK_SAILING, 2);
|
set_level(u2, SK_SAILING, 2);
|
||||||
CuAssertTrue(tc, !ship_crewed(sh));
|
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||||
set_level(u1, SK_SAILING, 2);
|
set_level(u1, SK_SAILING, 2);
|
||||||
set_level(u2, SK_SAILING, 1);
|
set_level(u2, SK_SAILING, 1);
|
||||||
CuAssertTrue(tc, !ship_crewed(sh));
|
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||||
set_level(u1, SK_SAILING, 3);
|
set_level(u1, SK_SAILING, 3);
|
||||||
set_level(u2, SK_SAILING, 1);
|
set_level(u2, SK_SAILING, 1);
|
||||||
CuAssertTrue(tc, ship_crewed(sh));
|
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||||
stype->minskill = 2;
|
stype->minskill = 2;
|
||||||
CuAssertTrue(tc, !ship_crewed(sh));
|
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||||
set_level(u1, SK_SAILING, 2);
|
set_level(u1, SK_SAILING, 2);
|
||||||
set_level(u2, SK_SAILING, 2);
|
set_level(u2, SK_SAILING, 2);
|
||||||
CuAssertTrue(tc, ship_crewed(sh));
|
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||||
sh->number = 2;
|
sh->number = 2;
|
||||||
CuAssertTrue(tc, !ship_crewed(sh));
|
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||||
set_level(u1, SK_SAILING, 4);
|
set_level(u1, SK_SAILING, 4);
|
||||||
set_level(u2, SK_SAILING, 4);
|
set_level(u2, SK_SAILING, 4);
|
||||||
CuAssertTrue(tc, !ship_crewed(sh));
|
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||||
u1->number = 2;
|
u1->number = 2;
|
||||||
set_level(u1, SK_SAILING, 2);
|
set_level(u1, SK_SAILING, 2);
|
||||||
set_level(u2, SK_SAILING, 4);
|
set_level(u2, SK_SAILING, 4);
|
||||||
CuAssertTrue(tc, ship_crewed(sh));
|
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2581,14 +2581,15 @@ void sinkships(struct region * r)
|
||||||
|
|
||||||
if (sh->number > 0) {
|
if (sh->number > 0) {
|
||||||
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
||||||
|
unit *cap = ship_owner(sh);
|
||||||
if (fval(r->terrain, SEA_REGION)) {
|
if (fval(r->terrain, SEA_REGION)) {
|
||||||
if (!ship_crewed(sh)) {
|
if (!ship_crewed(sh, cap)) {
|
||||||
/* ship is at sea, but not enough people to control it */
|
/* ship is at sea, but not enough people to control it */
|
||||||
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
|
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
|
||||||
damage_ship(sh, dmg);
|
damage_ship(sh, dmg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!ship_owner(sh)) {
|
else if (!cap) {
|
||||||
/* any ship lying around without an owner slowly rots */
|
/* any ship lying around without an owner slowly rots */
|
||||||
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
|
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
|
||||||
damage_ship(sh, dmg);
|
damage_ship(sh, dmg);
|
||||||
|
|
11
src/move.c
11
src/move.c
|
@ -819,7 +819,7 @@ static void drifting_ships(region * r)
|
||||||
/* Kapitaen da? Beschaedigt? Genuegend Matrosen?
|
/* Kapitaen da? Beschaedigt? Genuegend Matrosen?
|
||||||
* Genuegend leicht? Dann ist alles OK. */
|
* Genuegend leicht? Dann ist alles OK. */
|
||||||
|
|
||||||
if (ship_finished(sh) && ship_crewed(sh) && cansail(r, sh)) {
|
if (ship_finished(sh) && ship_crewed(sh, ship_owner(sh)) && cansail(r, sh)) {
|
||||||
shp = &sh->next;
|
shp = &sh->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1630,7 +1630,8 @@ static const region_list *travel_route(unit * u,
|
||||||
|
|
||||||
static bool ship_ready(const region * r, unit * u, order * ord)
|
static bool ship_ready(const region * r, unit * u, order * ord)
|
||||||
{
|
{
|
||||||
if (!u->ship || u != ship_owner(u->ship)) {
|
unit *cap = u->ship ? ship_owner(u->ship) : NULL;
|
||||||
|
if (u != cap) {
|
||||||
cmistake(u, ord, 146, MSG_MOVE);
|
cmistake(u, ord, 146, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1640,11 +1641,15 @@ static bool ship_ready(const region * r, unit * u, order * ord)
|
||||||
u->ship));
|
u->ship));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (u->number < u->ship->number) {
|
||||||
|
cmistake(u, ord, 329, MSG_MOVE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!ship_finished(u->ship)) {
|
if (!ship_finished(u->ship)) {
|
||||||
cmistake(u, ord, 15, MSG_MOVE);
|
cmistake(u, ord, 15, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ship_crewed(u->ship)) {
|
if (!ship_crewed(u->ship, u)) {
|
||||||
cmistake(u, ord, 1, MSG_MOVE);
|
cmistake(u, ord, 1, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue