Clarify usage of CheckPlacement. Check if the losRangeQuery exists before disabling it.

This was SVN commit r13504.
This commit is contained in:
leper 2013-06-26 18:41:06 +00:00
parent 5e289f51c2
commit 6cbdc13e08
2 changed files with 7 additions and 2 deletions

View file

@ -78,7 +78,7 @@ BuildRestrictions.prototype.Init = function()
* 2. Check foundation
* a. Doesn't obstruct foundation-blocking entities
* b. On valid terrain, based on passability class
* 3. Territory type is allowed
* 3. Territory type is allowed (see note below)
* 4. Dock is on shoreline and facing into water
* 5. Distance constraints satisfied
*
@ -87,6 +87,10 @@ BuildRestrictions.prototype.Init = function()
* "success": true iff the placement is valid, else false
* "message": message to display in UI for invalid placement, else empty string
* }
*
* Note: The entity which is used to check this should be a preview entity
* (template name should be "preview|"+templateName), as otherwise territory
* checks for buildings with territory influence will not work as expected.
*/
BuildRestrictions.prototype.CheckPlacement = function()
{

View file

@ -1180,7 +1180,8 @@ var UnitFsmSpec = {
"leave": function() {
var rangeMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
rangeMan.DisableActiveQuery(this.losRangeQuery);
if (this.losRangeQuery)
rangeMan.DisableActiveQuery(this.losRangeQuery);
if (this.losHealRangeQuery)
rangeMan.DisableActiveQuery(this.losHealRangeQuery);