forked from github/server
- there are no roads in astral space
This commit is contained in:
parent
66d7cc0fdf
commit
390bf522f7
3 changed files with 8 additions and 4 deletions
|
@ -1126,8 +1126,8 @@ roadto(const region * r, direction_t dir)
|
|||
if (get_curse(r2->attribs, roads_ct)!=NULL) return true;
|
||||
}
|
||||
|
||||
if (r->terrain->max_road == 0) return false;
|
||||
if (r2->terrain->max_road == 0) return false;
|
||||
if (r->terrain->max_road <= 0) return false;
|
||||
if (r2->terrain->max_road <= 0) return false;
|
||||
if (rroad(r, dir) < r->terrain->max_road) return false;
|
||||
if (rroad(r2, dir_invert(dir)) < r2->terrain->max_road) return false;
|
||||
return true;
|
||||
|
|
|
@ -1667,7 +1667,8 @@ parse_terrains(xmlDocPtr doc)
|
|||
terrain->_name = strdup((const char *)propValue);
|
||||
xmlFree(propValue);
|
||||
|
||||
terrain->max_road = (short)xml_ivalue(node, "road", -1);
|
||||
terrain->max_road = (short)xml_ivalue(node, "road", 0);
|
||||
assert(terrain->max_road>=0);
|
||||
terrain->size = xml_ivalue(node, "size", 0);
|
||||
|
||||
if (xml_bvalue(node, "forbidden", false)) terrain->flags |= FORBIDDEN_REGION;
|
||||
|
|
|
@ -195,13 +195,16 @@ region_setresource(region& r, const char * type, int value)
|
|||
static void
|
||||
region_setroad(region& r, int dir, lua_Number size)
|
||||
{
|
||||
rsetroad(&r, (direction_t)dir, (short)(r.terrain->max_road * size));
|
||||
if (r.terrain->max_road>0) {
|
||||
rsetroad(&r, (direction_t)dir, (short)(r.terrain->max_road * size));
|
||||
}
|
||||
}
|
||||
|
||||
static lua_Number
|
||||
region_getroad(region& r, int dir)
|
||||
{
|
||||
lua_Number result = rroad(&r, (direction_t)dir);
|
||||
if (r.terrain->max_road<=0 || result<=0) return 0;
|
||||
return r.terrain->max_road / result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue