1
0
forked from mirrors/0ad

# Support AI construction of buildings.

Pass terrain passability data to AI scripts.
Expand pathfinder passability data to 16 bits per tile, to allow more
classes.
Support 16-bit ints in serializer.
Partially support JS typed arrays.
Allow foundations to be placed on top of units (fixes #499).
Stop farms and fishes blocking movement (fixes #534).
Add obstruction flags to allow finer control over what they block.
Associate entity IDs with obstruction shapes, to allow finding colliding
entities.
Support moving to the edge of a target entity with inactive obstruction.
Support foundation entities in AI.
Support playing as non-hele civs.

This was SVN commit r8899.
This commit is contained in:
Ykkrosh
2011-02-10 16:06:28 +00:00
parent 556664d477
commit b8925fbbc9
55 changed files with 1562 additions and 268 deletions
+10 -1
View File
@@ -25,6 +25,10 @@
#include "js/jsapi.h"
#define signbit std::signbit
#include "js/jstypedarray.h"
#undef signbit
#define FAIL(msg) STMT(JS_ReportError(cx, msg); return false)
// Implicit type conversions often hide bugs, so warn about them
@@ -146,6 +150,11 @@ template<> jsval ScriptInterface::ToJSVal<i32>(JSContext* UNUSED(cx), const i32&
return INT_TO_JSVAL(val);
}
template<> jsval ScriptInterface::ToJSVal<u16>(JSContext* UNUSED(cx), const u16& val)
{
return INT_TO_JSVAL(val);
}
template<> jsval ScriptInterface::ToJSVal<u32>(JSContext* cx, const u32& val)
{
if (val <= JSVAL_INT_MAX)
@@ -225,7 +234,7 @@ template<typename T> static jsval ToJSVal_vector(JSContext* cx, const std::vecto
template<typename T> static bool FromJSVal_vector(JSContext* cx, jsval v, std::vector<T>& out)
{
JSObject* obj;
if (!JS_ValueToObject(cx, v, &obj) || obj == NULL || !JS_IsArrayObject(cx, obj))
if (!JS_ValueToObject(cx, v, &obj) || obj == NULL || !(JS_IsArrayObject(cx, obj) || js_IsTypedArray(obj)))
FAIL("Argument must be an array");
jsuint length;
if (!JS_GetArrayLength(cx, obj, &length))