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>
|
||||
</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">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
|
|
@ -2777,6 +2777,9 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - So viele Schiff
|
|||
msgid "error328"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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;
|
||||
}
|
||||
|
||||
bool ship_crewed(const ship *sh) {
|
||||
unit *u, *cap = ship_owner(sh);
|
||||
bool ship_crewed(const ship *sh, const unit *cap) {
|
||||
unit *u;
|
||||
int capskill = -1, sumskill = 0;
|
||||
if (cap == NULL) {
|
||||
return false;
|
||||
}
|
||||
for (u = sh->region->units; u; u = u->next) {
|
||||
if (u->ship == sh) {
|
||||
int es = effskill(u, SK_SAILING, NULL);
|
||||
|
|
|
@ -117,7 +117,7 @@ extern "C" {
|
|||
void ship_setname(struct ship *self, const char *name);
|
||||
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 ship_captain_minskill(const struct ship *sh);
|
||||
|
||||
|
|
|
@ -45,39 +45,39 @@ static void test_ship_crewed(CuTest * tc)
|
|||
stype->cptskill = 2;
|
||||
stype->sumskill = 4;
|
||||
sh = test_create_ship(r, stype);
|
||||
CuAssertTrue(tc, !ship_crewed(sh));
|
||||
CuAssertTrue(tc, !ship_crewed(sh, NULL));
|
||||
u1 = test_create_unit(f, r);
|
||||
set_level(u1, SK_SAILING, 4);
|
||||
u_set_ship(u1, sh);
|
||||
CuAssertTrue(tc, ship_crewed(sh));
|
||||
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||
u2 = test_create_unit(f, r);
|
||||
set_level(u1, SK_SAILING, 2);
|
||||
set_level(u2, SK_SAILING, 2);
|
||||
u_set_ship(u2, sh);
|
||||
CuAssertTrue(tc, ship_crewed(sh));
|
||||
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||
set_level(u1, SK_SAILING, 1);
|
||||
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(u2, SK_SAILING, 1);
|
||||
CuAssertTrue(tc, !ship_crewed(sh));
|
||||
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||
set_level(u1, SK_SAILING, 3);
|
||||
set_level(u2, SK_SAILING, 1);
|
||||
CuAssertTrue(tc, ship_crewed(sh));
|
||||
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||
stype->minskill = 2;
|
||||
CuAssertTrue(tc, !ship_crewed(sh));
|
||||
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||
set_level(u1, SK_SAILING, 2);
|
||||
set_level(u2, SK_SAILING, 2);
|
||||
CuAssertTrue(tc, ship_crewed(sh));
|
||||
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||
sh->number = 2;
|
||||
CuAssertTrue(tc, !ship_crewed(sh));
|
||||
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||
set_level(u1, SK_SAILING, 4);
|
||||
set_level(u2, SK_SAILING, 4);
|
||||
CuAssertTrue(tc, !ship_crewed(sh));
|
||||
CuAssertTrue(tc, !ship_crewed(sh, u1));
|
||||
u1->number = 2;
|
||||
set_level(u1, SK_SAILING, 2);
|
||||
set_level(u2, SK_SAILING, 4);
|
||||
CuAssertTrue(tc, ship_crewed(sh));
|
||||
CuAssertTrue(tc, ship_crewed(sh, u1));
|
||||
|
||||
test_teardown();
|
||||
}
|
||||
|
|
|
@ -2581,14 +2581,15 @@ void sinkships(struct region * r)
|
|||
|
||||
if (sh->number > 0) {
|
||||
if (!sh->type->construction || sh->size >= sh->type->construction->maxsize) {
|
||||
unit *cap = ship_owner(sh);
|
||||
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 */
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
|
||||
damage_ship(sh, dmg);
|
||||
}
|
||||
}
|
||||
else if (!ship_owner(sh)) {
|
||||
else if (!cap) {
|
||||
/* any ship lying around without an owner slowly rots */
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
|
||||
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?
|
||||
* 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;
|
||||
continue;
|
||||
}
|
||||
|
@ -1630,7 +1630,8 @@ static const region_list *travel_route(unit * u,
|
|||
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
|
@ -1640,11 +1641,15 @@ static bool ship_ready(const region * r, unit * u, order * ord)
|
|||
u->ship));
|
||||
return false;
|
||||
}
|
||||
if (u->number < u->ship->number) {
|
||||
cmistake(u, ord, 329, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
if (!ship_finished(u->ship)) {
|
||||
cmistake(u, ord, 15, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
if (!ship_crewed(u->ship)) {
|
||||
if (!ship_crewed(u->ship, u)) {
|
||||
cmistake(u, ord, 1, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue