Merge branch 'master'

This commit is contained in:
Enno Rehling 2018-09-09 07:54:41 +02:00
commit 422415870f
3 changed files with 10 additions and 6 deletions

View File

@ -30,7 +30,7 @@
</type>
</message>
<message name="target_region_invalid">
<message name="target_region_invalid" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
@ -38,7 +38,7 @@
</type>
</message>
<message name="missing_direction">
<message name="missing_direction" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
@ -46,7 +46,7 @@
</type>
</message>
<message name="target_region_not_empty">
<message name="target_region_not_empty" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>

View File

@ -1666,7 +1666,7 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord)
return;
}
}
if (r_demand(r, ltype)) {
if (!r->land || r_demand(r, ltype)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "luxury_notsold", ""));
return;
}
@ -1708,6 +1708,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
static int bt_cache;
static const struct building_type *castle_bt, *harbour_bt, *caravan_bt;
assert(r->land);
if (bt_changed(&bt_cache)) {
castle_bt = bt_find("castle");
harbour_bt = bt_find("harbour");
@ -1977,7 +1978,7 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord)
econ_request *o;
int k, available;
if (!r_demand(r, ltype)) {
if (!r->land || !r_demand(r, ltype)) {
cmistake(u, ord, 263, MSG_COMMERCE);
return false;
}

View File

@ -716,7 +716,10 @@ const item_type *r_luxury(const region * r)
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)
d = d->next;
if (!d)