forked from github/server
ship capacities and CR 66
This commit is contained in:
parent
5fc0ed8631
commit
f93c2f28ef
8 changed files with 26 additions and 49 deletions
|
@ -81,7 +81,7 @@ extern int verbosity;
|
|||
boolean opt_cr_absolute_coords = false;
|
||||
|
||||
/* globals */
|
||||
#define C_REPORT_VERSION 65
|
||||
#define C_REPORT_VERSION 66
|
||||
|
||||
#define TAG_LOCALE "de"
|
||||
#ifdef TAG_LOCALE
|
||||
|
@ -611,16 +611,14 @@ cr_output_ship(FILE * F, const ship * sh, const unit * u, int fcaptain, const fa
|
|||
if (u && (u->faction == f || omniscient(f))) {
|
||||
int n = 0, p = 0;
|
||||
int mweight = shipcapacity(sh);
|
||||
int mcabins = sh->type->cabins;
|
||||
getshipweight(sh, &n, &p);
|
||||
|
||||
fprintf(F, "%d;cargo\n", n);
|
||||
fprintf(F, "%d;capacity\n", mcabins);
|
||||
fprintf(F, "%d;capacity\n", n);
|
||||
fprintf(F, "%d;cargo\n", mweight);
|
||||
if (sh->type->cabins) {
|
||||
fprintf(F, "%d;cabins\n", sh->type->cabins);
|
||||
}
|
||||
fprintf(F, "%d;speed\n", shipspeed(sh, u));
|
||||
|
||||
n = (n+99) / 100; /* 1 Silber = 1 GE */
|
||||
fprintf(F, "%d;Ladung\n", n);
|
||||
fprintf(F, "%d;MaxLadung\n", mweight / 100);
|
||||
}
|
||||
/* shore */
|
||||
w = NODIRECTION;
|
||||
|
|
|
@ -1185,29 +1185,21 @@ enter_ship(unit * u, struct order * ord, int id, boolean report)
|
|||
return false;
|
||||
}
|
||||
if (CheckOverload()) {
|
||||
static int rule_capacity = -1;
|
||||
int sweight, scabins;
|
||||
int mweight = shipcapacity(sh);
|
||||
int mcabins = sh->type->cabins;
|
||||
|
||||
if (rule_capacity<0) {
|
||||
rule_capacity = get_param_int(global.parameters, "rules.ship.capacity", 0);
|
||||
}
|
||||
if (rule_capacity!=0) {
|
||||
mcabins *= PERSON_WEIGHT;
|
||||
}
|
||||
if (mweight>0 && mcabins>0) {
|
||||
if (mweight>0) {
|
||||
getshipweight(sh, &sweight, &scabins);
|
||||
sweight += weight(u);
|
||||
if (rule_capacity==0) {
|
||||
scabins += u->number;
|
||||
} else {
|
||||
if (mcabins) {
|
||||
int pweight = u->number * u->race->weight;
|
||||
/* weight goes into number of cabins, not cargo */
|
||||
scabins += u->number * u->race->weight;
|
||||
sweight -= u->number * u->race->weight;
|
||||
scabins += pweight;
|
||||
sweight -= pweight;
|
||||
}
|
||||
|
||||
if (sweight > mweight || scabins > mcabins) {
|
||||
if (sweight > mweight || (mcabins && (scabins > mcabins))) {
|
||||
if (report) cmistake(u, ord, 34, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -465,21 +465,14 @@ cansail(const region * r, ship * sh)
|
|||
if (sh->type->construction && sh->size!=sh->type->construction->maxsize) {
|
||||
return false;
|
||||
} else {
|
||||
static int rule_capacity = -1;
|
||||
int n = 0, p = 0;
|
||||
int mweight = shipcapacity(sh);
|
||||
int mcabins = sh->type->cabins;
|
||||
|
||||
if (rule_capacity<0) {
|
||||
rule_capacity = get_param_int(global.parameters, "rules.ship.capacity", 0);
|
||||
}
|
||||
if (rule_capacity!=0) {
|
||||
mcabins *= PERSON_WEIGHT;
|
||||
}
|
||||
getshipweight(sh, &n, &p);
|
||||
|
||||
if (n > mweight) return false;
|
||||
if (p > mcabins) return false;
|
||||
if (mcabins && p > mcabins) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -266,24 +266,19 @@ shipcapacity (const ship * sh)
|
|||
void
|
||||
getshipweight(const ship * sh, int *sweight, int *scabins)
|
||||
{
|
||||
static int rule_capacity = -1;
|
||||
unit * u;
|
||||
|
||||
*sweight = 0;
|
||||
*scabins = 0;
|
||||
|
||||
if (rule_capacity<0) {
|
||||
rule_capacity = get_param_int(global.parameters, "rules.ship.capacity", 0);
|
||||
}
|
||||
for (u = sh->region->units; u; u = u->next) {
|
||||
if (u->ship == sh) {
|
||||
*sweight += weight(u);
|
||||
if (rule_capacity==0) {
|
||||
*scabins += u->number;
|
||||
} else {
|
||||
if (sh->type->cabins) {
|
||||
int pweight = u->number * u->race->weight;
|
||||
/* weight goes into number of cabins, not cargo */
|
||||
*scabins += u->number * u->race->weight;
|
||||
*sweight -= u->number * u->race->weight;
|
||||
*scabins += pweight;
|
||||
*sweight -= pweight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct ship_type {
|
|||
double storm; /* multiplier for chance to drift in storm */
|
||||
double damage; /* multiplier for damage taken by the ship */
|
||||
|
||||
int cabins; /* max. cabins (people) */
|
||||
int cabins; /* max. cabins (weight) */
|
||||
int cargo; /* max. cargo (weight) */
|
||||
|
||||
int cptskill; /* min. skill of captain */
|
||||
|
|
|
@ -528,7 +528,7 @@ parse_ships(xmlDocPtr doc)
|
|||
st->name[1] = strcat(strcpy(malloc(strlen(st->name[0])+3), st->name[0]),"_a");
|
||||
xmlFree(propValue);
|
||||
|
||||
st->cabins = xml_ivalue(node, "cabins", 0);
|
||||
st->cabins = xml_ivalue(node, "cabins", 0) * PERSON_WEIGHT;
|
||||
st->cargo = xml_ivalue(node, "cargo", 0);
|
||||
st->combat = xml_ivalue(node, "combat", 0);
|
||||
st->cptskill = xml_ivalue(node, "cptskill", 0);
|
||||
|
|
|
@ -142,7 +142,6 @@
|
|||
<param name="rules.migrants" value="0"/>
|
||||
<param name="rules.check_overload" value="0"/>
|
||||
<param name="rules.combat.goblinbonus" value="3"/>
|
||||
<param name="rules.ship.capacity" value="1"/> <!-- -->
|
||||
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
|
||||
<param name="rules.alliances" value="1"/>
|
||||
<param name="rules.combat.herospeed" value="3"/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ships>
|
||||
<ship name="trireme" range="7" storm="1.00" damage="1.00" cabins="20000" cargo="200000" cptskill="4" minskill="1" sumskill="120" opensea="yes">
|
||||
<ship name="trireme" range="7" storm="1.00" damage="1.00" cargo="200000" cptskill="4" minskill="1" sumskill="120" opensea="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<construction skill="shipcraft" minskill="4" maxsize="200" reqsize="1">
|
||||
|
@ -8,7 +8,7 @@
|
|||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="caravel" range="5" storm="1.00" damage="1.00" cabins="30000" cargo="300000" cptskill="3" minskill="1" sumskill="30" opensea="yes">
|
||||
<ship name="caravel" range="5" storm="1.00" damage="1.00" cargo="300000" cptskill="3" minskill="1" sumskill="30" opensea="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<construction skill="shipcraft" minskill="3" maxsize="250" reqsize="1">
|
||||
|
@ -16,7 +16,7 @@
|
|||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="dragonship" range="5" storm="1.00" damage="1.00" cabins="10000" cargo="100000" cptskill="2" minskill="1" sumskill="50" opensea="yes">
|
||||
<ship name="dragonship" range="5" storm="1.00" damage="1.00" cargo="100000" cptskill="2" minskill="1" sumskill="50" opensea="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<construction skill="shipcraft" minskill="2" maxsize="100" reqsize="1">
|
||||
|
@ -24,7 +24,7 @@
|
|||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="longboat" range="3" storm="1.00" damage="1.00" cabins="5000" cargo="50000" cptskill="1" minskill="1" sumskill="10" opensea="yes">
|
||||
<ship name="longboat" range="3" storm="1.00" damage="1.00" cargo="50000" cptskill="1" minskill="1" sumskill="10" opensea="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<construction skill="shipcraft" minskill="1" maxsize="50" reqsize="1">
|
||||
|
@ -32,7 +32,7 @@
|
|||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="balloon" range="2" storm="1.00" damage="1.00" cabins="500" cargo="5000" cptskill="6" minskill="6" sumskill="6" opensea="yes" fly="yes">
|
||||
<ship name="balloon" range="2" storm="1.00" damage="1.00" cargo="5000" cptskill="6" minskill="6" sumskill="6" opensea="yes" fly="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<coast terrain="swamp"/>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<construction skill="shipcraft" minskill="100" maxsize="5" reqsize="1"/>
|
||||
</ship>
|
||||
|
||||
<ship name="boat" range="2" storm="1.00" damage="1.00" cabins="500" cargo="5000" cptskill="1" minskill="1" sumskill="2" opensea="yes">
|
||||
<ship name="boat" range="2" storm="1.00" damage="1.00" cargo="5000" cptskill="1" minskill="1" sumskill="2" opensea="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<coast terrain="swamp"/>
|
||||
|
@ -64,7 +64,7 @@
|
|||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="flyingcarpet" range="3" storm="1.00" damage="1.00" cabins="5000" cargo="50000" cptskill="6" minskill="6" sumskill="10" opensea="yes" fly="yes">
|
||||
<ship name="flyingcarpet" range="3" storm="1.00" damage="1.00" cargo="50000" cptskill="6" minskill="6" sumskill="10" opensea="yes" fly="yes">
|
||||
<coast terrain="ocean"/>
|
||||
<coast terrain="plain"/>
|
||||
<coast terrain="swamp"/>
|
||||
|
|
Loading…
Reference in a new issue