forked from github/server
fix crashes when trying to trade on ocean.
fix missing message sections.
This commit is contained in:
parent
e9bded4a87
commit
6f5f1651c7
|
@ -30,7 +30,7 @@
|
||||||
</type>
|
</type>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="target_region_invalid">
|
<message name="target_region_invalid" section="errors">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
<arg name="region" type="region"/>
|
<arg name="region" type="region"/>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
</type>
|
</type>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="missing_direction">
|
<message name="missing_direction" section="errors">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
<arg name="region" type="region"/>
|
<arg name="region" type="region"/>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
</type>
|
</type>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="target_region_not_empty">
|
<message name="target_region_not_empty" section="errors">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
<arg name="region" type="region"/>
|
<arg name="region" type="region"/>
|
||||||
|
|
|
@ -1660,7 +1660,7 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r_demand(r, ltype)) {
|
if (!r->land || r_demand(r, ltype)) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "luxury_notsold", ""));
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "luxury_notsold", ""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1702,6 +1702,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
|
||||||
static int bt_cache;
|
static int bt_cache;
|
||||||
static const struct building_type *castle_bt, *harbour_bt, *caravan_bt;
|
static const struct building_type *castle_bt, *harbour_bt, *caravan_bt;
|
||||||
|
|
||||||
|
assert(r->land);
|
||||||
if (bt_changed(&bt_cache)) {
|
if (bt_changed(&bt_cache)) {
|
||||||
castle_bt = bt_find("castle");
|
castle_bt = bt_find("castle");
|
||||||
harbour_bt = bt_find("harbour");
|
harbour_bt = bt_find("harbour");
|
||||||
|
@ -1971,7 +1972,7 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord)
|
||||||
econ_request *o;
|
econ_request *o;
|
||||||
int k, available;
|
int k, available;
|
||||||
|
|
||||||
if (!r_demand(r, ltype)) {
|
if (!r->land || !r_demand(r, ltype)) {
|
||||||
cmistake(u, ord, 263, MSG_COMMERCE);
|
cmistake(u, ord, 263, MSG_COMMERCE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -716,7 +716,10 @@ const item_type *r_luxury(const region * r)
|
||||||
|
|
||||||
int r_demand(const region * r, const luxury_type * ltype)
|
int r_demand(const region * r, const luxury_type * ltype)
|
||||||
{
|
{
|
||||||
struct demand *d = r->land->demands;
|
struct demand *d;
|
||||||
|
|
||||||
|
assert(r && r->land);
|
||||||
|
d = r->land->demands;
|
||||||
while (d && d->type != ltype)
|
while (d && d->type != ltype)
|
||||||
d = d->next;
|
d = d->next;
|
||||||
if (!d)
|
if (!d)
|
||||||
|
|
Loading…
Reference in New Issue