diff --git a/bwapi_bridge2_0.exp b/bwapi_bridge2_0.exp index 0d67629..aa1f45a 100644 Binary files a/bwapi_bridge2_0.exp and b/bwapi_bridge2_0.exp differ diff --git a/bwta2-c/BWTA.h b/bwta2-c/BWTA.h new file mode 100644 index 0000000..61395ba --- /dev/null +++ b/bwta2-c/BWTA.h @@ -0,0 +1,58 @@ +#pragma once +#include +#include +#include +#include +#include +#include +namespace BWTA +{ + void readMap(); + void analyze(); + void computeDistanceTransform(); + void balanceAnalysis(); + + int getMaxDistanceTransform(); + RectangleArray* getDistanceTransformMap(); + + const std::set& getRegions(); + const std::set& getChokepoints(); + const std::set& getBaseLocations(); + const std::set& getStartLocations(); + const std::set& getUnwalkablePolygons(); + + BaseLocation* getStartLocation(BWAPI::Player player); + + Region* getRegion(int x, int y); + Region* getRegion(BWAPI::TilePosition tileposition); + Region* getRegion(BWAPI::Position position); + + Chokepoint* getNearestChokepoint(int x, int y); + Chokepoint* getNearestChokepoint(BWAPI::TilePosition tileposition); + Chokepoint* getNearestChokepoint(BWAPI::Position position); + + BaseLocation* getNearestBaseLocation(int x, int y); + BaseLocation* getNearestBaseLocation(BWAPI::TilePosition tileposition); + BaseLocation* getNearestBaseLocation(BWAPI::Position position); + + Polygon* getNearestUnwalkablePolygon(int x, int y); + Polygon* getNearestUnwalkablePolygon(BWAPI::TilePosition tileposition); + BWAPI::Position getNearestUnwalkablePosition(BWAPI::Position position); + + bool isConnected(int x1, int y1, int x2, int y2); + bool isConnected(BWAPI::TilePosition a, BWAPI::TilePosition b); + + double getGroundDistance(BWAPI::TilePosition start, BWAPI::TilePosition end); + std::pair getNearestTilePosition(BWAPI::TilePosition start, const std::set& targets); + std::map getGroundDistances(BWAPI::TilePosition start, const std::set& targets); + void getGroundDistanceMap(BWAPI::TilePosition start, RectangleArray& distanceMap); + void getGroundWalkDistanceMap(int walkx, int walky, RectangleArray& distanceMap); + std::vector getShortestPath(BWAPI::TilePosition start, BWAPI::TilePosition end); + std::vector getShortestPath(BWAPI::TilePosition start, const std::set& targets); + + // HPA* implementation + void buildChokeNodes(); + std::list getShortestPath2(BWAPI::TilePosition start, BWAPI::TilePosition target); + int getGroundDistance2(BWAPI::TilePosition start, BWAPI::TilePosition end); + +} \ No newline at end of file diff --git a/bwta2-c/BWTA/BaseLocation.h b/bwta2-c/BWTA/BaseLocation.h new file mode 100644 index 0000000..67bcf12 --- /dev/null +++ b/bwta2-c/BWTA/BaseLocation.h @@ -0,0 +1,28 @@ +#pragma once +#include +namespace BWTA +{ + class Region; + class BaseLocation + { + public: + virtual BWAPI::Position getPosition() const=0; + virtual BWAPI::TilePosition getTilePosition() const=0; + + virtual Region* getRegion() const=0; + + virtual int minerals() const=0; + virtual int gas() const=0; + + virtual const BWAPI::Unitset &getMinerals()=0; + virtual const BWAPI::Unitset &getStaticMinerals() const=0; + virtual const BWAPI::Unitset &getGeysers() const=0; + + virtual double getGroundDistance(BaseLocation* other) const=0; + virtual double getAirDistance(BaseLocation* other) const=0; + + virtual bool isIsland() const=0; + virtual bool isMineralOnly() const=0; + virtual bool isStartLocation() const=0; + }; +} \ No newline at end of file diff --git a/bwta2-c/BWTA/Chokepoint.h b/bwta2-c/BWTA/Chokepoint.h new file mode 100644 index 0000000..5e58458 --- /dev/null +++ b/bwta2-c/BWTA/Chokepoint.h @@ -0,0 +1,15 @@ +#pragma once +#include +#include +namespace BWTA +{ + class Region; + class Chokepoint + { + public: + virtual const std::pair& getRegions() const=0; + virtual const std::pair& getSides() const=0; + virtual BWAPI::Position getCenter() const=0; + virtual double getWidth() const=0; + }; +} \ No newline at end of file diff --git a/bwta2-c/BWTA/Polygon.h b/bwta2-c/BWTA/Polygon.h new file mode 100644 index 0000000..d65ca16 --- /dev/null +++ b/bwta2-c/BWTA/Polygon.h @@ -0,0 +1,19 @@ +#pragma once +#include +#include +namespace BWTA +{ + class Polygon : public std::vector + { + public: + Polygon(); + Polygon(const Polygon& b); + double getArea() const; + double getPerimeter() const; + BWAPI::Position getCenter() const; + bool isInside(BWAPI::Position p) const; + BWAPI::Position getNearestPoint(BWAPI::Position p) const; + const std::vector& getHoles() const; + std::vector holes; + }; +} \ No newline at end of file diff --git a/bwta2-c/BWTA/RectangleArray.h b/bwta2-c/BWTA/RectangleArray.h new file mode 100644 index 0000000..7a44d0a --- /dev/null +++ b/bwta2-c/BWTA/RectangleArray.h @@ -0,0 +1,274 @@ +#pragma once + +namespace BWTA +{ + /** + * Template used for work with dynamically initialized array with dimension 2. + */ + template + class RectangleArray + { + public : + /** + * Creates the array with the specified proportions. + * @param width Width of the new array. + * @param height Height of the new array. + */ + RectangleArray(unsigned int width = 1, unsigned int height = 1, Type* data = NULL); + /** Copy constructor */ + RectangleArray(const RectangleArray& rectangleArray); + /** Destorys the array and deletes all content of array. */ + ~RectangleArray(void); + /** + * Gets the width of the array. + * @return width of the array. + */ + unsigned int getWidth(void) const; + /** + * Gets the height of the array. + * @return height of the array. + */ + unsigned int getHeight(void) const; + /** + * Gets item of the array on the specified position. + * @param x horizontal index of the array position. + * @param y vertical index of the array position. + * @return item on the specified position. + */ + Type getItem(unsigned int x, unsigned int y); + Type getItemSafe(unsigned int x, unsigned int y); + inline Type* operator[](int i) { return this->getColumn(i); } + inline Type const * const operator[](int i) const {return this->getColumn(i); } + /** + * Sets item of the array on the specified position. + * @param x horizontal index of the array position. + * @param y vertical index of the array position. + * @param item new value of the field. + */ + void setItem(unsigned int x, unsigned int y, Type *item); + void resize(unsigned int width, unsigned int height); + void printToFile(FILE* f); + void saveToFile(const std::string& fileName); + /** Sets all fields of the array to the specified value */ + void setTo(const Type& value); + void setBorderTo(const Type& value); + /** Set a rectangle area of the array to the specified values */ + void setRectangleTo(unsigned int xLeft, unsigned int yTop, unsigned int xRight, unsigned int yBottom, const Type& value); + private : + bool owner; + /** width of array */ + unsigned int width; + /** height of array */ + unsigned int height; + /** Array data, stored as linear array of size width*height */ + Type *data; + /** Pointers to begins of lines*/ + Type **columns; + /** + * Gets data item on the specified index + * @param index index of the data to be returned. + */ + Type getData(unsigned int index); + /** + * Gets the pointer in data to the beginning of line with the specified + * index. + * @param index index of the line. + */ + Type *getColumn(unsigned int index); + /** + * Gets the pointer in data to the beginning of line with the specified + * index. + * @param index index of the line. + */ + const Type *getColumn(unsigned int index) const; + /** + * Sets the width of the array. + * @param width New width of the array. + */ + void setWidth(unsigned int width); + /** + * Sets the height of the array. + * @param height New height of the array. + */ + void setHeight(unsigned int height); + }; + //---------------------------------------------- CONSTRUCTOR ----------------------------------------------- + template + RectangleArray::RectangleArray(unsigned int width, unsigned int height, Type* data) + { + this->setWidth(width); + this->setHeight(height); + this->owner = (data == NULL); + if (this->owner) + this->data = new Type[this->getWidth()*this->getHeight()]; + else + this->data = data; + + columns = new Type*[this->getWidth()]; + unsigned int i = 0; + for (unsigned int position = 0;i < width; i ++,position += height) + columns[i] = &this->data[position]; + } + //---------------------------------------------- CONSTRUCTOR ----------------------------------------------- + template + RectangleArray::RectangleArray(const RectangleArray& rectangleArray) + :owner(true) + { + this->setWidth(rectangleArray.getWidth()); + this->setHeight(rectangleArray.getHeight()); + this->data = new Type[this->getWidth()*this->getHeight()]; + columns = new Type*[this->getWidth()]; + + unsigned int i = 0; + for (unsigned int position = 0;i < width; i ++,position += height) + columns[i] = &data[position]; + memcpy(this->data, rectangleArray.data, sizeof(Type)*this->getWidth()*this->getHeight()); + } + //----------------------------------------------- DESTRUCTOR ----------------------------------------------- + template + RectangleArray::~RectangleArray(void) + { + delete [] columns; + if (this->owner) + delete [] data; + } + //----------------------------------------------- GET WIDTH ------------------------------------------------ + template + unsigned int RectangleArray::getWidth(void) const + { + return this->width; + } + //----------------------------------------------- SET WIDTH ------------------------------------------------ + template + void RectangleArray::setWidth(unsigned int width) + { + this->width = width; + } + //----------------------------------------------- GET HEIGHT ----------------------------------------------- + template + unsigned int RectangleArray::getHeight(void) const + { + return this->height; + } + //----------------------------------------------- SET HEIGHT ----------------------------------------------- + template + void RectangleArray::setHeight(unsigned int height) + { + this->height = height; + } + //------------------------------------------------ GET ITEM ------------------------------------------------ + template + Type RectangleArray::getItem(unsigned int x, unsigned int y) + { + return this->getColumn(x)[y]; + } + //------------------------------------------------ GET ITEM ------------------------------------------------ + template + Type RectangleArray::getItemSafe(unsigned int x, unsigned int y) + { + if (x<0 || y<0 || x>=this->width || y>=this->height) + { + return (Type)NULL; + } + return this->getColumn(x)[y]; + } + //------------------------------------------------ SET ITEM ------------------------------------------------ + template + void RectangleArray::setItem(unsigned int x, unsigned int y, Type* item) + { + this->getColumn(x)[y] = item; + } + //------------------------------------------------ GET LINE ------------------------------------------------ + template + Type* RectangleArray::getColumn(unsigned int index) + { + return columns[index]; + } + //------------------------------------------------ GET LINE ------------------------------------------------ + template + const Type* RectangleArray::getColumn(unsigned int index) const + { + return columns[index]; + } + //------------------------------------------------- RESIZE ------------------------------------------------- + template + void RectangleArray::resize(unsigned int width, unsigned int height) + { + if (this->getWidth() == width && + this->getHeight() == height) + return; + + delete [] this->columns; + delete [] this->data; + + this->setWidth(width); + this->setHeight(height); + + this->data = new Type[this->width * this->height]; + + this->columns = new Type*[this->width]; + unsigned int i = 0; + for (unsigned int position = 0;i < this->width; i ++,position += this->height) + columns[i] = &data[position]; + } + //--------------------------------------------- PRINT TO FILE ---------------------------------------------- + template + void RectangleArray::printToFile(FILE* f) + { + for (unsigned int y = 0; y < this->getHeight(); y++) + { + for (unsigned int x = 0; x < this->getWidth(); x++) + { + char ch = this->getColumn(x)[y]; + fprintf_s(f, "%c", ch); + } + fprintf_s(f, "\n"); + } + } + //---------------------------------------------- SAVE TO FILE ---------------------------------------------- + template + void RectangleArray::saveToFile(const std::string& fileName) + { + FILE* f = fopen(fileName.c_str(), "wt"); + if (!f) + exit(1); + this->printToFile(f); + fclose(f); + } + //------------------------------------------------- SET TO ------------------------------------------------- + template + void RectangleArray::setTo(const Type& value) + { + for (unsigned int i = 0; i < this->getWidth()*this->getHeight(); i++) + this->data[i] = value; + } + //--------------------------------------------- SET BORDER TO ---------------------------------------------- + template + void RectangleArray::setBorderTo(const Type& value) + { + for (unsigned int i = 0; i < this->width; i++) + { + this->getColumn(i)[0] = value; + this->getColumn(i)[this->height - 1] = value; + } + for (unsigned int i = 0; i < this->height; i++) + { + this->getColumn(0)[i] = value; + this->getColumn(this->width - 1)[i] = value; + } + } + //------------------------------------------- SET RECTANGLE TO --------------------------------------------- + template + void RectangleArray::setRectangleTo(unsigned int xLeft, unsigned int yTop, unsigned int xRight, unsigned int yBottom, const Type& value) { + xLeft = std::max(xLeft,0); + yTop = std::max(yTop,0); + xRight = std::min(xRight,this->width-1); + yBottom = std::min(yBottom,this->height-1); + for (unsigned int x = xLeft; x <= xRight; x++) { + for (unsigned int y = yTop; y <= yBottom; y++) { + this->getColumn(x)[y] = value; + } + } + } + //---------------------------------------------------------------------------------------------------------- +} \ No newline at end of file diff --git a/bwta2-c/BWTA/Region.h b/bwta2-c/BWTA/Region.h new file mode 100644 index 0000000..7892332 --- /dev/null +++ b/bwta2-c/BWTA/Region.h @@ -0,0 +1,20 @@ +#pragma once +#include +#include +#include +namespace BWTA +{ + class Chokepoint; + class BaseLocation; + class Region + { + public: + virtual const Polygon& getPolygon() const=0; + virtual const BWAPI::Position& getCenter() const=0; + virtual const std::set& getChokepoints() const=0; + virtual const std::set& getBaseLocations() const=0; + virtual bool isReachable(Region* region) const=0; + virtual const std::set& getReachableRegions() const=0; + virtual const int getMaxDistance() const=0; + }; +} \ No newline at end of file diff --git a/c4/impl.cpp b/c4/impl.cpp index 4c56a6f..9c31e55 100644 --- a/c4/impl.cpp +++ b/c4/impl.cpp @@ -1,6 +1,7 @@ #include "../concat_header4.h" #include #include +#include #include #include #include @@ -5824,6 +5825,409 @@ JNIEXPORT jboolean JNICALL Java_bwapi_WeaponType_targetsOwn_1native(JNIEnv * env WeaponType* x_weaponType = (WeaponType*)pointer; return x_weaponType->targetsOwn(); } +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getPosition_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +Position cresult = x_baseLocation->getPosition(); +jclass retcls = FindCachedClass(env, "bwapi/Position"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getTilePosition_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +TilePosition cresult = x_baseLocation->getTilePosition(); +jclass retcls = FindCachedClass(env, "bwapi/TilePosition"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getRegion_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +jlong resptr = (jlong)x_baseLocation->getRegion(); +jclass retcls = FindCachedClass(env, "bwta/Region"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Region;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jint JNICALL Java_bwta_BaseLocation_minerals_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +return x_baseLocation->minerals(); +} +JNIEXPORT jint JNICALL Java_bwta_BaseLocation_gas_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +return x_baseLocation->gas(); +} +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getMinerals_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +Unitset cresult = x_baseLocation->getMinerals(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Unit"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Unit;"); +for(Unitset::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const Unit elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getStaticMinerals_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +Unitset cresult = x_baseLocation->getStaticMinerals(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Unit"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Unit;"); +for(Unitset::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const Unit elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getGeysers_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +Unitset cresult = x_baseLocation->getGeysers(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Unit"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Unit;"); +for(Unitset::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const Unit elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jdouble JNICALL Java_bwta_BaseLocation_getGroundDistance_1native(JNIEnv * env, jobject obj, jlong pointer, jobject p_other){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +BWTA::BaseLocation* other = (BWTA::BaseLocation*)env->GetLongField(p_other, FindCachedField(env, env->GetObjectClass(p_other), "pointer", "J")); +return x_baseLocation->getGroundDistance(other); +} +JNIEXPORT jdouble JNICALL Java_bwta_BaseLocation_getAirDistance_1native(JNIEnv * env, jobject obj, jlong pointer, jobject p_other){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +BWTA::BaseLocation* other = (BWTA::BaseLocation*)env->GetLongField(p_other, FindCachedField(env, env->GetObjectClass(p_other), "pointer", "J")); +return x_baseLocation->getAirDistance(other); +} +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isIsland_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +return x_baseLocation->isIsland(); +} +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isMineralOnly_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +return x_baseLocation->isMineralOnly(); +} +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isStartLocation_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::BaseLocation* x_baseLocation = (BWTA::BaseLocation*)pointer; +return x_baseLocation->isStartLocation(); +} +JNIEXPORT void JNICALL Java_bwta_BWTA_readMap(JNIEnv * env, jclass jclz){ +BWTA::readMap(); +} +JNIEXPORT void JNICALL Java_bwta_BWTA_analyze(JNIEnv * env, jclass jclz){ +BWTA::analyze(); +} +JNIEXPORT void JNICALL Java_bwta_BWTA_computeDistanceTransform(JNIEnv * env, jclass jclz){ +BWTA::computeDistanceTransform(); +} +JNIEXPORT void JNICALL Java_bwta_BWTA_balanceAnalysis(JNIEnv * env, jclass jclz){ +BWTA::balanceAnalysis(); +} +JNIEXPORT jint JNICALL Java_bwta_BWTA_getMaxDistanceTransform(JNIEnv * env, jclass jclz){ +return BWTA::getMaxDistanceTransform(); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegions(JNIEnv * env, jclass jclz){ +std::set cresult = BWTA::getRegions(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Region"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Region;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::Region* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getChokepoints(JNIEnv * env, jclass jclz){ +std::set cresult = BWTA::getChokepoints(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Chokepoint"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Chokepoint;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::Chokepoint* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getBaseLocations(JNIEnv * env, jclass jclz){ +std::set cresult = BWTA::getBaseLocations(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/BaseLocation;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::BaseLocation* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getStartLocations(JNIEnv * env, jclass jclz){ +std::set cresult = BWTA::getStartLocations(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/BaseLocation;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::BaseLocation* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getUnwalkablePolygons(JNIEnv * env, jclass jclz){ +std::set cresult = BWTA::getUnwalkablePolygons(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Polygon"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Polygon;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::Polygon* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getStartLocation(JNIEnv * env, jclass jclz, jobject p_player){ +Player player = (Player)env->GetLongField(p_player, FindCachedField(env, env->GetObjectClass(p_player), "pointer", "J")); +jlong resptr = (jlong)BWTA::getStartLocation(player); +jclass retcls = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/BaseLocation;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__II(JNIEnv * env, jclass jclz, jint x, jint y){ +jlong resptr = (jlong)BWTA::getRegion(x, y); +jclass retcls = FindCachedClass(env, "bwta/Region"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Region;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__Lbwapi_TilePosition_2(JNIEnv * env, jclass jclz, jobject p_tileposition){ +TilePosition tileposition((int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "x", "I")), (int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "y", "I"))); +jlong resptr = (jlong)BWTA::getRegion(tileposition); +jclass retcls = FindCachedClass(env, "bwta/Region"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Region;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__Lbwapi_Position_2(JNIEnv * env, jclass jclz, jobject p_position){ +Position position((int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "x", "I")), (int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "y", "I"))); +jlong resptr = (jlong)BWTA::getRegion(position); +jclass retcls = FindCachedClass(env, "bwta/Region"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Region;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__II(JNIEnv * env, jclass jclz, jint x, jint y){ +jlong resptr = (jlong)BWTA::getNearestChokepoint(x, y); +jclass retcls = FindCachedClass(env, "bwta/Chokepoint"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Chokepoint;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__Lbwapi_TilePosition_2(JNIEnv * env, jclass jclz, jobject p_tileposition){ +TilePosition tileposition((int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "x", "I")), (int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "y", "I"))); +jlong resptr = (jlong)BWTA::getNearestChokepoint(tileposition); +jclass retcls = FindCachedClass(env, "bwta/Chokepoint"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Chokepoint;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__Lbwapi_Position_2(JNIEnv * env, jclass jclz, jobject p_position){ +Position position((int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "x", "I")), (int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "y", "I"))); +jlong resptr = (jlong)BWTA::getNearestChokepoint(position); +jclass retcls = FindCachedClass(env, "bwta/Chokepoint"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Chokepoint;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__II(JNIEnv * env, jclass jclz, jint x, jint y){ +jlong resptr = (jlong)BWTA::getNearestBaseLocation(x, y); +jclass retcls = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/BaseLocation;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__Lbwapi_TilePosition_2(JNIEnv * env, jclass jclz, jobject p_tileposition){ +TilePosition tileposition((int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "x", "I")), (int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "y", "I"))); +jlong resptr = (jlong)BWTA::getNearestBaseLocation(tileposition); +jclass retcls = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/BaseLocation;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__Lbwapi_Position_2(JNIEnv * env, jclass jclz, jobject p_position){ +Position position((int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "x", "I")), (int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "y", "I"))); +jlong resptr = (jlong)BWTA::getNearestBaseLocation(position); +jclass retcls = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/BaseLocation;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePolygon__II(JNIEnv * env, jclass jclz, jint x, jint y){ +jlong resptr = (jlong)BWTA::getNearestUnwalkablePolygon(x, y); +jclass retcls = FindCachedClass(env, "bwta/Polygon"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Polygon;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePolygon__Lbwapi_TilePosition_2(JNIEnv * env, jclass jclz, jobject p_tileposition){ +TilePosition tileposition((int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "x", "I")), (int)env->GetIntField(p_tileposition, FindCachedField(env, env->GetObjectClass(p_tileposition), "y", "I"))); +jlong resptr = (jlong)BWTA::getNearestUnwalkablePolygon(tileposition); +jclass retcls = FindCachedClass(env, "bwta/Polygon"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Polygon;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePosition(JNIEnv * env, jclass jclz, jobject p_position){ +Position position((int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "x", "I")), (int)env->GetIntField(p_position, FindCachedField(env, env->GetObjectClass(p_position), "y", "I"))); +Position cresult = BWTA::getNearestUnwalkablePosition(position); +jclass retcls = FindCachedClass(env, "bwapi/Position"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jboolean JNICALL Java_bwta_BWTA_isConnected__IIII(JNIEnv * env, jclass jclz, jint x1, jint y1, jint x2, jint y2){ +return BWTA::isConnected(x1, y1, x2, y2); +} +JNIEXPORT jboolean JNICALL Java_bwta_BWTA_isConnected__Lbwapi_TilePosition_2Lbwapi_TilePosition_2(JNIEnv * env, jclass jclz, jobject p_a, jobject p_b){ +TilePosition a((int)env->GetIntField(p_a, FindCachedField(env, env->GetObjectClass(p_a), "x", "I")), (int)env->GetIntField(p_a, FindCachedField(env, env->GetObjectClass(p_a), "y", "I"))); +TilePosition b((int)env->GetIntField(p_b, FindCachedField(env, env->GetObjectClass(p_b), "x", "I")), (int)env->GetIntField(p_b, FindCachedField(env, env->GetObjectClass(p_b), "y", "I"))); +return BWTA::isConnected(a, b); +} +JNIEXPORT jdouble JNICALL Java_bwta_BWTA_getGroundDistance(JNIEnv * env, jclass jclz, jobject p_start, jobject p_end){ +TilePosition start((int)env->GetIntField(p_start, FindCachedField(env, env->GetObjectClass(p_start), "x", "I")), (int)env->GetIntField(p_start, FindCachedField(env, env->GetObjectClass(p_start), "y", "I"))); +TilePosition end((int)env->GetIntField(p_end, FindCachedField(env, env->GetObjectClass(p_end), "x", "I")), (int)env->GetIntField(p_end, FindCachedField(env, env->GetObjectClass(p_end), "y", "I"))); +return BWTA::getGroundDistance(start, end); +} +JNIEXPORT void JNICALL Java_bwta_BWTA_buildChokeNodes(JNIEnv * env, jclass jclz){ +BWTA::buildChokeNodes(); +} +JNIEXPORT jint JNICALL Java_bwta_BWTA_getGroundDistance2(JNIEnv * env, jclass jclz, jobject p_start, jobject p_end){ +TilePosition start((int)env->GetIntField(p_start, FindCachedField(env, env->GetObjectClass(p_start), "x", "I")), (int)env->GetIntField(p_start, FindCachedField(env, env->GetObjectClass(p_start), "y", "I"))); +TilePosition end((int)env->GetIntField(p_end, FindCachedField(env, env->GetObjectClass(p_end), "x", "I")), (int)env->GetIntField(p_end, FindCachedField(env, env->GetObjectClass(p_end), "y", "I"))); +return BWTA::getGroundDistance2(start, end); +} +JNIEXPORT jobject JNICALL Java_bwta_Chokepoint_getCenter_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Chokepoint* x_chokepoint = (BWTA::Chokepoint*)pointer; +Position cresult = x_chokepoint->getCenter(); +jclass retcls = FindCachedClass(env, "bwapi/Position"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jdouble JNICALL Java_bwta_Chokepoint_getWidth_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Chokepoint* x_chokepoint = (BWTA::Chokepoint*)pointer; +return x_chokepoint->getWidth(); +} +JNIEXPORT jdouble JNICALL Java_bwta_Polygon_getArea_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Polygon* x_polygon = (BWTA::Polygon*)pointer; +return x_polygon->getArea(); +} +JNIEXPORT jdouble JNICALL Java_bwta_Polygon_getPerimeter_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Polygon* x_polygon = (BWTA::Polygon*)pointer; +return x_polygon->getPerimeter(); +} +JNIEXPORT jobject JNICALL Java_bwta_Polygon_getCenter_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Polygon* x_polygon = (BWTA::Polygon*)pointer; +Position cresult = x_polygon->getCenter(); +jclass retcls = FindCachedClass(env, "bwapi/Position"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jboolean JNICALL Java_bwta_Polygon_isInside_1native(JNIEnv * env, jobject obj, jlong pointer, jobject p_p){ +BWTA::Polygon* x_polygon = (BWTA::Polygon*)pointer; +Position p((int)env->GetIntField(p_p, FindCachedField(env, env->GetObjectClass(p_p), "x", "I")), (int)env->GetIntField(p_p, FindCachedField(env, env->GetObjectClass(p_p), "y", "I"))); +return x_polygon->isInside(p); +} +JNIEXPORT jobject JNICALL Java_bwta_Polygon_getNearestPoint_1native(JNIEnv * env, jobject obj, jlong pointer, jobject p_p){ +BWTA::Polygon* x_polygon = (BWTA::Polygon*)pointer; +Position p((int)env->GetIntField(p_p, FindCachedField(env, env->GetObjectClass(p_p), "x", "I")), (int)env->GetIntField(p_p, FindCachedField(env, env->GetObjectClass(p_p), "y", "I"))); +Position cresult = x_polygon->getNearestPoint(p); +jclass retcls = FindCachedClass(env, "bwapi/Position"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_Region_getPolygon_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +jlong resptr = (jlong)&x_region->getPolygon(); +jclass retcls = FindCachedClass(env, "bwta/Polygon"); +jmethodID mid = FindCachedMethodStatic(env, retcls, "get", "(J)Lbwta/Polygon;"); +return env->CallStaticObjectMethod(retcls, mid, resptr); +} +JNIEXPORT jobject JNICALL Java_bwta_Region_getCenter_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +Position cresult = x_region->getCenter(); +jclass retcls = FindCachedClass(env, "bwapi/Position"); +jmethodID retConsID = FindCachedMethod(env, retcls, "", "(II)V"); +jobject result = env->NewObject(retcls, retConsID, cresult.x, cresult.y); +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_Region_getChokepoints_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +std::set cresult = x_region->getChokepoints(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Chokepoint"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Chokepoint;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::Chokepoint* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jobject JNICALL Java_bwta_Region_getBaseLocations_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +std::set cresult = x_region->getBaseLocations(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/BaseLocation"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/BaseLocation;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::BaseLocation* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jboolean JNICALL Java_bwta_Region_isReachable_1native(JNIEnv * env, jobject obj, jlong pointer, jobject p_region){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +BWTA::Region* region = (BWTA::Region*)env->GetLongField(p_region, FindCachedField(env, env->GetObjectClass(p_region), "pointer", "J")); +return x_region->isReachable(region); +} +JNIEXPORT jobject JNICALL Java_bwta_Region_getReachableRegions_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +std::set cresult = x_region->getReachableRegions(); +jclass listCls = FindCachedClass(env, "java/util/ArrayList"); +jmethodID listConsID = FindCachedMethod(env, listCls, "", "()V"); +jobject result = env->NewObject(listCls, listConsID); +jmethodID addMethodID = FindCachedMethod(env, listCls, "add", "(Ljava/lang/Object;)Z"); +jclass elemClass = FindCachedClass(env, "bwta/Region"); +jmethodID getMethodID = FindCachedMethodStatic(env, elemClass, "get", "(J)Lbwta/Region;"); +for(std::set::const_iterator it = cresult.begin(); it != cresult.end(); it++ ){const BWTA::Region* elem_ptr = *it; +jobject elem = env->CallStaticObjectMethod(elemClass, getMethodID, (long)elem_ptr) ; +env->CallVoidMethod(result, addMethodID, elem); +} +return result; +} +JNIEXPORT jint JNICALL Java_bwta_Region_getMaxDistance_1native(JNIEnv * env, jobject obj, jlong pointer){ +BWTA::Region* x_region = (BWTA::Region*)pointer; +return x_region->getMaxDistance(); +} void reconnect() { while (!BWAPIClient.connect()) { diff --git a/compiled4/bwta/BWTA.class b/compiled4/bwta/BWTA.class new file mode 100644 index 0000000..8f3973f Binary files /dev/null and b/compiled4/bwta/BWTA.class differ diff --git a/compiled4/bwta/BaseLocation.class b/compiled4/bwta/BaseLocation.class new file mode 100644 index 0000000..b80e6f9 Binary files /dev/null and b/compiled4/bwta/BaseLocation.class differ diff --git a/compiled4/bwta/Chokepoint.class b/compiled4/bwta/Chokepoint.class new file mode 100644 index 0000000..724a744 Binary files /dev/null and b/compiled4/bwta/Chokepoint.class differ diff --git a/compiled4/bwta/Polygon.class b/compiled4/bwta/Polygon.class new file mode 100644 index 0000000..f4db15f Binary files /dev/null and b/compiled4/bwta/Polygon.class differ diff --git a/compiled4/bwta/Region.class b/compiled4/bwta/Region.class new file mode 100644 index 0000000..9f75dc1 Binary files /dev/null and b/compiled4/bwta/Region.class differ diff --git a/concat_header4.h b/concat_header4.h index d7424f3..ae9882c 100644 --- a/concat_header4.h +++ b/concat_header4.h @@ -8894,3 +8894,498 @@ JNIEXPORT jboolean JNICALL Java_bwapi_WeaponType_targetsOwn_1native } #endif #endif +/* Header for class bwta_BaseLocation */ + +#ifndef _Included_bwta_BaseLocation +#define _Included_bwta_BaseLocation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_BaseLocation + * Method: getPosition_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getPosition_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getTilePosition_native + * Signature: (J)Lbwapi/TilePosition; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getTilePosition_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getRegion_native + * Signature: (J)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getRegion_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: minerals_native + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_bwta_BaseLocation_minerals_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: gas_native + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_bwta_BaseLocation_gas_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getMinerals_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getMinerals_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getStaticMinerals_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getStaticMinerals_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getGeysers_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getGeysers_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getGroundDistance_native + * Signature: (JLbwta/BaseLocation;)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_BaseLocation_getGroundDistance_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_BaseLocation + * Method: getAirDistance_native + * Signature: (JLbwta/BaseLocation;)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_BaseLocation_getAirDistance_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_BaseLocation + * Method: isIsland_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isIsland_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: isMineralOnly_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isMineralOnly_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: isStartLocation_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isStartLocation_1native + (JNIEnv *, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class bwta_BWTA */ + +#ifndef _Included_bwta_BWTA +#define _Included_bwta_BWTA +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_BWTA + * Method: readMap + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_readMap + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: analyze + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_analyze + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: computeDistanceTransform + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_computeDistanceTransform + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: balanceAnalysis + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_balanceAnalysis + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getMaxDistanceTransform + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_bwta_BWTA_getMaxDistanceTransform + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getRegions + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegions + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getChokepoints + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getChokepoints + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getBaseLocations + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getBaseLocations + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getStartLocations + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getStartLocations + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getUnwalkablePolygons + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getUnwalkablePolygons + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getStartLocation + * Signature: (Lbwapi/Player;)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getStartLocation + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getRegion + * Signature: (II)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getRegion + * Signature: (Lbwapi/TilePosition;)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getRegion + * Signature: (Lbwapi/Position;)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__Lbwapi_Position_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestChokepoint + * Signature: (II)Lbwta/Chokepoint; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getNearestChokepoint + * Signature: (Lbwapi/TilePosition;)Lbwta/Chokepoint; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestChokepoint + * Signature: (Lbwapi/Position;)Lbwta/Chokepoint; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__Lbwapi_Position_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestBaseLocation + * Signature: (II)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getNearestBaseLocation + * Signature: (Lbwapi/TilePosition;)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestBaseLocation + * Signature: (Lbwapi/Position;)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__Lbwapi_Position_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestUnwalkablePolygon + * Signature: (II)Lbwta/Polygon; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePolygon__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getNearestUnwalkablePolygon + * Signature: (Lbwapi/TilePosition;)Lbwta/Polygon; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePolygon__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestUnwalkablePosition + * Signature: (Lbwapi/Position;)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePosition + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: isConnected + * Signature: (IIII)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BWTA_isConnected__IIII + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: bwta_BWTA + * Method: isConnected + * Signature: (Lbwapi/TilePosition;Lbwapi/TilePosition;)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BWTA_isConnected__Lbwapi_TilePosition_2Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: bwta_BWTA + * Method: getGroundDistance + * Signature: (Lbwapi/TilePosition;Lbwapi/TilePosition;)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_BWTA_getGroundDistance + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: bwta_BWTA + * Method: buildChokeNodes + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_buildChokeNodes + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getGroundDistance2 + * Signature: (Lbwapi/TilePosition;Lbwapi/TilePosition;)I + */ +JNIEXPORT jint JNICALL Java_bwta_BWTA_getGroundDistance2 + (JNIEnv *, jclass, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class bwta_Chokepoint */ + +#ifndef _Included_bwta_Chokepoint +#define _Included_bwta_Chokepoint +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_Chokepoint + * Method: getCenter_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Chokepoint_getCenter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Chokepoint + * Method: getWidth_native + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_Chokepoint_getWidth_1native + (JNIEnv *, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class bwta_Polygon */ + +#ifndef _Included_bwta_Polygon +#define _Included_bwta_Polygon +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_Polygon + * Method: getArea_native + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_Polygon_getArea_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Polygon + * Method: getPerimeter_native + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_Polygon_getPerimeter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Polygon + * Method: getCenter_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Polygon_getCenter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Polygon + * Method: isInside_native + * Signature: (JLbwapi/Position;)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_Polygon_isInside_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_Polygon + * Method: getNearestPoint_native + * Signature: (JLbwapi/Position;)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Polygon_getNearestPoint_1native + (JNIEnv *, jobject, jlong, jobject); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class bwta_Region */ + +#ifndef _Included_bwta_Region +#define _Included_bwta_Region +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_Region + * Method: getPolygon_native + * Signature: (J)Lbwta/Polygon; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getPolygon_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getCenter_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getCenter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getChokepoints_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getChokepoints_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getBaseLocations_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getBaseLocations_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: isReachable_native + * Signature: (JLbwta/Region;)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_Region_isReachable_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_Region + * Method: getReachableRegions_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getReachableRegions_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getMaxDistance_native + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_bwta_Region_getMaxDistance_1native + (JNIEnv *, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/generated/bwta/BWTA.java b/generated/bwta/BWTA.java new file mode 100644 index 0000000..060be1c --- /dev/null +++ b/generated/bwta/BWTA.java @@ -0,0 +1,73 @@ +package bwta; + +import bwta.*; + +import java.util.Map; +import java.util.HashMap; +import java.util.Collection; +import java.util.List; +import bwapi.Position; +import bwapi.TilePosition; +import bwapi.Player; +import bwapi.Unit; + +public class BWTA { + + public static native void readMap(); + + public static native void analyze(); + + public static native void computeDistanceTransform(); + + public static native void balanceAnalysis(); + + public static native int getMaxDistanceTransform(); + + public static native List getRegions(); + + public static native List getChokepoints(); + + public static native List getBaseLocations(); + + public static native List getStartLocations(); + + public static native List getUnwalkablePolygons(); + + public static native BaseLocation getStartLocation(Player player); + + public static native Region getRegion(int x, int y); + + public static native Region getRegion(TilePosition tileposition); + + public static native Region getRegion(Position position); + + public static native Chokepoint getNearestChokepoint(int x, int y); + + public static native Chokepoint getNearestChokepoint(TilePosition tileposition); + + public static native Chokepoint getNearestChokepoint(Position position); + + public static native BaseLocation getNearestBaseLocation(int x, int y); + + public static native BaseLocation getNearestBaseLocation(TilePosition tileposition); + + public static native BaseLocation getNearestBaseLocation(Position position); + + public static native Polygon getNearestUnwalkablePolygon(int x, int y); + + public static native Polygon getNearestUnwalkablePolygon(TilePosition tileposition); + + public static native Position getNearestUnwalkablePosition(Position position); + + public static native boolean isConnected(int x1, int y1, int x2, int y2); + + public static native boolean isConnected(TilePosition a, TilePosition b); + + public static native double getGroundDistance(TilePosition start, TilePosition end); + + public static native void buildChokeNodes(); + + public static native int getGroundDistance2(TilePosition start, TilePosition end); + + +} diff --git a/generated/bwta/BaseLocation.java b/generated/bwta/BaseLocation.java new file mode 100644 index 0000000..ea2353a --- /dev/null +++ b/generated/bwta/BaseLocation.java @@ -0,0 +1,118 @@ +package bwta; + +import bwta.*; + +import java.util.Map; +import java.util.HashMap; +import java.util.Collection; +import java.util.List; +import bwapi.Position; +import bwapi.TilePosition; +import bwapi.Player; +import bwapi.Unit; +import bwapi.PositionedObject; + +public class BaseLocation extends PositionedObject +{ + + public Position getPosition() { + return getPosition_native(pointer); + } + + public TilePosition getTilePosition() { + return getTilePosition_native(pointer); + } + + public Region getRegion() { + return getRegion_native(pointer); + } + + public int minerals() { + return minerals_native(pointer); + } + + public int gas() { + return gas_native(pointer); + } + + public List getMinerals() { + return getMinerals_native(pointer); + } + + public List getStaticMinerals() { + return getStaticMinerals_native(pointer); + } + + public List getGeysers() { + return getGeysers_native(pointer); + } + + public double getGroundDistance(BaseLocation other) { + return getGroundDistance_native(pointer, other); + } + + public double getAirDistance(BaseLocation other) { + return getAirDistance_native(pointer, other); + } + + public boolean isIsland() { + return isIsland_native(pointer); + } + + public boolean isMineralOnly() { + return isMineralOnly_native(pointer); + } + + public boolean isStartLocation() { + return isStartLocation_native(pointer); + } + + + private static Map instances = new HashMap(); + + private BaseLocation(long pointer) { + this.pointer = pointer; + } + + private static BaseLocation get(long pointer) { + if (pointer == 0 ) { + return null; + } + BaseLocation instance = instances.get(pointer); + if (instance == null ) { + instance = new BaseLocation(pointer); + instances.put(pointer, instance); + } + return instance; + } + + private long pointer; + + private native Position getPosition_native(long pointer); + + private native TilePosition getTilePosition_native(long pointer); + + private native Region getRegion_native(long pointer); + + private native int minerals_native(long pointer); + + private native int gas_native(long pointer); + + private native List getMinerals_native(long pointer); + + private native List getStaticMinerals_native(long pointer); + + private native List getGeysers_native(long pointer); + + private native double getGroundDistance_native(long pointer, BaseLocation other); + + private native double getAirDistance_native(long pointer, BaseLocation other); + + private native boolean isIsland_native(long pointer); + + private native boolean isMineralOnly_native(long pointer); + + private native boolean isStartLocation_native(long pointer); + + +} diff --git a/generated/bwta/Chokepoint.java b/generated/bwta/Chokepoint.java new file mode 100644 index 0000000..5f4906c --- /dev/null +++ b/generated/bwta/Chokepoint.java @@ -0,0 +1,52 @@ +package bwta; + +import bwta.*; + +import java.util.Map; +import java.util.HashMap; +import java.util.Collection; +import java.util.List; +import bwapi.Position; +import bwapi.TilePosition; +import bwapi.Player; +import bwapi.Unit; +import bwapi.CenteredObject; + +public class Chokepoint extends CenteredObject +{ + + public Position getCenter() { + return getCenter_native(pointer); + } + + public double getWidth() { + return getWidth_native(pointer); + } + + + private static Map instances = new HashMap(); + + private Chokepoint(long pointer) { + this.pointer = pointer; + } + + private static Chokepoint get(long pointer) { + if (pointer == 0 ) { + return null; + } + Chokepoint instance = instances.get(pointer); + if (instance == null ) { + instance = new Chokepoint(pointer); + instances.put(pointer, instance); + } + return instance; + } + + private long pointer; + + private native Position getCenter_native(long pointer); + + private native double getWidth_native(long pointer); + + +} diff --git a/generated/bwta/Polygon.java b/generated/bwta/Polygon.java new file mode 100644 index 0000000..33a062e --- /dev/null +++ b/generated/bwta/Polygon.java @@ -0,0 +1,68 @@ +package bwta; + +import bwta.*; + +import java.util.Map; +import java.util.HashMap; +import java.util.Collection; +import java.util.List; +import bwapi.Position; +import bwapi.TilePosition; +import bwapi.Player; +import bwapi.Unit; + +public class Polygon { + + public double getArea() { + return getArea_native(pointer); + } + + public double getPerimeter() { + return getPerimeter_native(pointer); + } + + public Position getCenter() { + return getCenter_native(pointer); + } + + public boolean isInside(Position p) { + return isInside_native(pointer, p); + } + + public Position getNearestPoint(Position p) { + return getNearestPoint_native(pointer, p); + } + + + private static Map instances = new HashMap(); + + private Polygon(long pointer) { + this.pointer = pointer; + } + + private static Polygon get(long pointer) { + if (pointer == 0 ) { + return null; + } + Polygon instance = instances.get(pointer); + if (instance == null ) { + instance = new Polygon(pointer); + instances.put(pointer, instance); + } + return instance; + } + + private long pointer; + + private native double getArea_native(long pointer); + + private native double getPerimeter_native(long pointer); + + private native Position getCenter_native(long pointer); + + private native boolean isInside_native(long pointer, Position p); + + private native Position getNearestPoint_native(long pointer, Position p); + + +} diff --git a/generated/bwta/Region.java b/generated/bwta/Region.java new file mode 100644 index 0000000..82f2885 --- /dev/null +++ b/generated/bwta/Region.java @@ -0,0 +1,82 @@ +package bwta; + +import bwta.*; + +import java.util.Map; +import java.util.HashMap; +import java.util.Collection; +import java.util.List; +import bwapi.Position; +import bwapi.TilePosition; +import bwapi.Player; +import bwapi.Unit; +import bwapi.CenteredObject; + +public class Region extends CenteredObject +{ + + public Polygon getPolygon() { + return getPolygon_native(pointer); + } + + public Position getCenter() { + return getCenter_native(pointer); + } + + public List getChokepoints() { + return getChokepoints_native(pointer); + } + + public List getBaseLocations() { + return getBaseLocations_native(pointer); + } + + public boolean isReachable(Region region) { + return isReachable_native(pointer, region); + } + + public List getReachableRegions() { + return getReachableRegions_native(pointer); + } + + public int getMaxDistance() { + return getMaxDistance_native(pointer); + } + + + private static Map instances = new HashMap(); + + private Region(long pointer) { + this.pointer = pointer; + } + + private static Region get(long pointer) { + if (pointer == 0 ) { + return null; + } + Region instance = instances.get(pointer); + if (instance == null ) { + instance = new Region(pointer); + instances.put(pointer, instance); + } + return instance; + } + + private long pointer; + + private native Polygon getPolygon_native(long pointer); + + private native Position getCenter_native(long pointer); + + private native List getChokepoints_native(long pointer); + + private native List getBaseLocations_native(long pointer); + + private native boolean isReachable_native(long pointer, Region region); + + private native List getReachableRegions_native(long pointer); + + private native int getMaxDistance_native(long pointer); + + +} diff --git a/headers4/bwta_BWTA.h b/headers4/bwta_BWTA.h new file mode 100644 index 0000000..37bd90c --- /dev/null +++ b/headers4/bwta_BWTA.h @@ -0,0 +1,237 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class bwta_BWTA */ + +#ifndef _Included_bwta_BWTA +#define _Included_bwta_BWTA +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_BWTA + * Method: readMap + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_readMap + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: analyze + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_analyze + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: computeDistanceTransform + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_computeDistanceTransform + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: balanceAnalysis + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_balanceAnalysis + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getMaxDistanceTransform + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_bwta_BWTA_getMaxDistanceTransform + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getRegions + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegions + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getChokepoints + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getChokepoints + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getBaseLocations + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getBaseLocations + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getStartLocations + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getStartLocations + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getUnwalkablePolygons + * Signature: ()Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getUnwalkablePolygons + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getStartLocation + * Signature: (Lbwapi/Player;)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getStartLocation + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getRegion + * Signature: (II)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getRegion + * Signature: (Lbwapi/TilePosition;)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getRegion + * Signature: (Lbwapi/Position;)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getRegion__Lbwapi_Position_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestChokepoint + * Signature: (II)Lbwta/Chokepoint; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getNearestChokepoint + * Signature: (Lbwapi/TilePosition;)Lbwta/Chokepoint; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestChokepoint + * Signature: (Lbwapi/Position;)Lbwta/Chokepoint; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestChokepoint__Lbwapi_Position_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestBaseLocation + * Signature: (II)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getNearestBaseLocation + * Signature: (Lbwapi/TilePosition;)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestBaseLocation + * Signature: (Lbwapi/Position;)Lbwta/BaseLocation; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestBaseLocation__Lbwapi_Position_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestUnwalkablePolygon + * Signature: (II)Lbwta/Polygon; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePolygon__II + (JNIEnv *, jclass, jint, jint); + +/* + * Class: bwta_BWTA + * Method: getNearestUnwalkablePolygon + * Signature: (Lbwapi/TilePosition;)Lbwta/Polygon; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePolygon__Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: getNearestUnwalkablePosition + * Signature: (Lbwapi/Position;)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_BWTA_getNearestUnwalkablePosition + (JNIEnv *, jclass, jobject); + +/* + * Class: bwta_BWTA + * Method: isConnected + * Signature: (IIII)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BWTA_isConnected__IIII + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: bwta_BWTA + * Method: isConnected + * Signature: (Lbwapi/TilePosition;Lbwapi/TilePosition;)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BWTA_isConnected__Lbwapi_TilePosition_2Lbwapi_TilePosition_2 + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: bwta_BWTA + * Method: getGroundDistance + * Signature: (Lbwapi/TilePosition;Lbwapi/TilePosition;)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_BWTA_getGroundDistance + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: bwta_BWTA + * Method: buildChokeNodes + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_bwta_BWTA_buildChokeNodes + (JNIEnv *, jclass); + +/* + * Class: bwta_BWTA + * Method: getGroundDistance2 + * Signature: (Lbwapi/TilePosition;Lbwapi/TilePosition;)I + */ +JNIEXPORT jint JNICALL Java_bwta_BWTA_getGroundDistance2 + (JNIEnv *, jclass, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/headers4/bwta_BaseLocation.h b/headers4/bwta_BaseLocation.h new file mode 100644 index 0000000..41d8fb2 --- /dev/null +++ b/headers4/bwta_BaseLocation.h @@ -0,0 +1,117 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class bwta_BaseLocation */ + +#ifndef _Included_bwta_BaseLocation +#define _Included_bwta_BaseLocation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_BaseLocation + * Method: getPosition_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getPosition_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getTilePosition_native + * Signature: (J)Lbwapi/TilePosition; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getTilePosition_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getRegion_native + * Signature: (J)Lbwta/Region; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getRegion_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: minerals_native + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_bwta_BaseLocation_minerals_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: gas_native + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_bwta_BaseLocation_gas_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getMinerals_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getMinerals_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getStaticMinerals_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getStaticMinerals_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getGeysers_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_BaseLocation_getGeysers_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: getGroundDistance_native + * Signature: (JLbwta/BaseLocation;)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_BaseLocation_getGroundDistance_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_BaseLocation + * Method: getAirDistance_native + * Signature: (JLbwta/BaseLocation;)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_BaseLocation_getAirDistance_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_BaseLocation + * Method: isIsland_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isIsland_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: isMineralOnly_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isMineralOnly_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_BaseLocation + * Method: isStartLocation_native + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_BaseLocation_isStartLocation_1native + (JNIEnv *, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/headers4/bwta_Chokepoint.h b/headers4/bwta_Chokepoint.h new file mode 100644 index 0000000..fa4b2dd --- /dev/null +++ b/headers4/bwta_Chokepoint.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class bwta_Chokepoint */ + +#ifndef _Included_bwta_Chokepoint +#define _Included_bwta_Chokepoint +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_Chokepoint + * Method: getCenter_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Chokepoint_getCenter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Chokepoint + * Method: getWidth_native + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_Chokepoint_getWidth_1native + (JNIEnv *, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/headers4/bwta_Polygon.h b/headers4/bwta_Polygon.h new file mode 100644 index 0000000..80e661b --- /dev/null +++ b/headers4/bwta_Polygon.h @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class bwta_Polygon */ + +#ifndef _Included_bwta_Polygon +#define _Included_bwta_Polygon +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_Polygon + * Method: getArea_native + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_Polygon_getArea_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Polygon + * Method: getPerimeter_native + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_bwta_Polygon_getPerimeter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Polygon + * Method: getCenter_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Polygon_getCenter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Polygon + * Method: isInside_native + * Signature: (JLbwapi/Position;)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_Polygon_isInside_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_Polygon + * Method: getNearestPoint_native + * Signature: (JLbwapi/Position;)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Polygon_getNearestPoint_1native + (JNIEnv *, jobject, jlong, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/headers4/bwta_Region.h b/headers4/bwta_Region.h new file mode 100644 index 0000000..c2198ae --- /dev/null +++ b/headers4/bwta_Region.h @@ -0,0 +1,69 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class bwta_Region */ + +#ifndef _Included_bwta_Region +#define _Included_bwta_Region +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: bwta_Region + * Method: getPolygon_native + * Signature: (J)Lbwta/Polygon; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getPolygon_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getCenter_native + * Signature: (J)Lbwapi/Position; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getCenter_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getChokepoints_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getChokepoints_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getBaseLocations_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getBaseLocations_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: isReachable_native + * Signature: (JLbwta/Region;)Z + */ +JNIEXPORT jboolean JNICALL Java_bwta_Region_isReachable_1native + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: bwta_Region + * Method: getReachableRegions_native + * Signature: (J)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_bwta_Region_getReachableRegions_1native + (JNIEnv *, jobject, jlong); + +/* + * Class: bwta_Region + * Method: getMaxDistance_native + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_bwta_Region_getMaxDistance_1native + (JNIEnv *, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/out/production/InvokeGenerator/generator/CJavaPipeline$1.class b/out/production/InvokeGenerator/generator/CJavaPipeline$1.class index 90c8149..2d2f755 100644 Binary files a/out/production/InvokeGenerator/generator/CJavaPipeline$1.class and b/out/production/InvokeGenerator/generator/CJavaPipeline$1.class differ diff --git a/out/production/InvokeGenerator/generator/CJavaPipeline$2.class b/out/production/InvokeGenerator/generator/CJavaPipeline$2.class index 4574e27..1fd7853 100644 Binary files a/out/production/InvokeGenerator/generator/CJavaPipeline$2.class and b/out/production/InvokeGenerator/generator/CJavaPipeline$2.class differ diff --git a/out/production/InvokeGenerator/generator/CJavaPipeline.class b/out/production/InvokeGenerator/generator/CJavaPipeline.class index 25236ff..d5b4444 100644 Binary files a/out/production/InvokeGenerator/generator/CJavaPipeline.class and b/out/production/InvokeGenerator/generator/CJavaPipeline.class differ diff --git a/out/production/InvokeGenerator/generator/ccalls/CallImplementer.class b/out/production/InvokeGenerator/generator/ccalls/CallImplementer.class index 54bb58e..26f72b3 100644 Binary files a/out/production/InvokeGenerator/generator/ccalls/CallImplementer.class and b/out/production/InvokeGenerator/generator/ccalls/CallImplementer.class differ diff --git a/out/production/InvokeGenerator/generator/java/Mirror.class b/out/production/InvokeGenerator/generator/java/Mirror.class index b3878d8..7a329ae 100644 Binary files a/out/production/InvokeGenerator/generator/java/Mirror.class and b/out/production/InvokeGenerator/generator/java/Mirror.class differ diff --git a/out/production/InvokeGenerator/test/api/TestBot1$1.class b/out/production/InvokeGenerator/test/api/TestBot1$1.class index a1832cf..2ac80bc 100644 Binary files a/out/production/InvokeGenerator/test/api/TestBot1$1.class and b/out/production/InvokeGenerator/test/api/TestBot1$1.class differ diff --git a/out/production/InvokeGenerator/test/api/TestBot1.class b/out/production/InvokeGenerator/test/api/TestBot1.class index 2bf247c..3800468 100644 Binary files a/out/production/InvokeGenerator/test/api/TestBot1.class and b/out/production/InvokeGenerator/test/api/TestBot1.class differ diff --git a/out/production/InvokeGenerator/util/PointerTest.class b/out/production/InvokeGenerator/util/PointerTest.class index 0f082cc..63e8400 100644 Binary files a/out/production/InvokeGenerator/util/PointerTest.class and b/out/production/InvokeGenerator/util/PointerTest.class differ diff --git a/src/generator/CJavaPipeline.java b/src/generator/CJavaPipeline.java index 0cd4444..71dc4cc 100644 --- a/src/generator/CJavaPipeline.java +++ b/src/generator/CJavaPipeline.java @@ -14,7 +14,6 @@ import impl.Clazz; import util.FileUtils; import java.io.*; -import java.lang.reflect.Array; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.*; @@ -134,7 +133,7 @@ public class CJavaPipeline { MyJavaCompiler compiler = new MyJavaCompiler(); for (PackageProcessOptions pkg : packages) { - compiler.run(new File(processingOptions.get(GENERATE_TO_DIR) + "/" + pkg.packageName), javaOut); + compiler.run(new File(processingOptions.get(GENERATE_TO_DIR) + "/" + pkg.packageName), javaOut); } /** @@ -145,7 +144,7 @@ public class CJavaPipeline { packageDirNames.add(pkg.packageName); } HeaderMaker hm = new HeaderMaker(); - hm.run(packageDirNames, javaOut, processingOptions.getProperty(HEADER_FILE_PROPERTY) , processingOptions.getProperty(HEADERS_DIR_PROPERTY)); + hm.run(packageDirNames, javaOut, processingOptions.getProperty(HEADER_FILE_PROPERTY), processingOptions.getProperty(HEADERS_DIR_PROPERTY)); /** * Phase 6 - implementation of native functions @@ -189,7 +188,7 @@ public class CJavaPipeline { callImplementer.notifyPackageStart(); - for (File file : new File(processingOptions.getProperty(GENERATE_TO_DIR) +"/" + pkg.packageName).listFiles(new FilenameFilter() { + for (File file : new File(processingOptions.getProperty(GENERATE_TO_DIR) + "/" + pkg.packageName).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { //we skip mirror.java as it has a native function which we implement manually @@ -215,6 +214,7 @@ public class CJavaPipeline { * Bind constants together and create initialisation function */ + javaContext.setPackageName(packages[0].packageName); Bind bind = new Bind(javaContext); bind.setOut(out); bind.implementBind(allDecs); @@ -255,6 +255,11 @@ public class CJavaPipeline { bwapiOptions.cHeadersDir = new File("bwapi4-includes"); bwapiOptions.manualCopyClassesDir = new File("manual-bwapi4"); + PackageProcessOptions bwtaOptions = new PackageProcessOptions(); + bwtaOptions.packageName = "bwta"; + bwtaOptions.cHeadersDir = new File("bwta2-c"); + bwtaOptions.additionalImportClasses = Arrays.asList("bwapi.Position", "bwapi.TilePosition", "bwapi.Player", "bwapi.Unit"); + bwtaOptions.globalClassName = "BWTA"; Properties props = new Properties(); props.put(COMPILE_DIR_PROPERTY, "compiled4"); @@ -263,7 +268,7 @@ public class CJavaPipeline { props.put(C_IMPLEMENTATION_FILE_PROPERTY, "c4/impl.cpp"); props.put(GENERATE_TO_DIR, "generated"); - new CJavaPipeline().run(new PackageProcessOptions[]{bwapiOptions}, props); + new CJavaPipeline().run(new PackageProcessOptions[]{bwapiOptions, bwtaOptions}, props); } } @@ -274,7 +279,7 @@ public class CJavaPipeline { private static final String HEADER_FILE_PROPERTY = "header_file"; private static final String GENERATE_TO_DIR = "generate_to_dir"; - public static boolean isBWAPI3(){ + public static boolean isBWAPI3() { return BWAPI_VERSION == BWAPI_V3; } diff --git a/src/generator/ccalls/CallImplementer.java b/src/generator/ccalls/CallImplementer.java index ab01240..a31105e 100644 --- a/src/generator/ccalls/CallImplementer.java +++ b/src/generator/ccalls/CallImplementer.java @@ -47,13 +47,16 @@ public class CallImplementer { private static final String VARIABLE_PREFIX = "x_"; + private boolean customFunctionsWritten = false; + public void setOut(PrintStream out) { this.out = out; out.print("#include \"../concat_header" + (CJavaPipeline.isBWAPI3() ? "" : "4")+ ".h\"\n" + "#include \n" + "#include \n" + - (CJavaPipeline.isBWAPI3() ? "#include \n" : "#include \n" + "#include \n") + + "#include \n" + + (CJavaPipeline.isBWAPI3() ? "" : "#include \n" + "#include \n") + "#include \n" + "#include \n" + (CJavaPipeline.isBWAPI3() ? "#include \"../BWTA_Result.h\"" : "")+ @@ -169,7 +172,7 @@ public class CallImplementer { private String wrapInCCollection(String genericType) { String buffer = ""; - boolean isBWAPI4Collection = !CJavaPipeline.isBWAPI3(); + boolean isBWAPI4Collection = !CJavaPipeline.isBWAPI3() && !genericType.startsWith("BWTA::"); if (!isBWAPI4Collection) { buffer += "std::set<"; } @@ -396,6 +399,10 @@ public class CallImplementer { } public void notifyPackageStart() { + if(customFunctionsWritten){ + return; + } + customFunctionsWritten = true; out.println("PositionOrUnit convertPositionOrUnit(JNIEnv * env, jobject obj){ \n" + "\tjclass clz = FindCachedClass(env, \"" + javaContext.getPackageName() + "/PositionOrUnit\");\n" + "\tjmethodID typeMethodId = FindCachedMethod(env, clz, \"isUnit\", \"()Z\");\n" + diff --git a/src/generator/java/Mirror.java b/src/generator/java/Mirror.java index 31906b2..58f4037 100644 --- a/src/generator/java/Mirror.java +++ b/src/generator/java/Mirror.java @@ -94,7 +94,7 @@ public abstract class Mirror { out.println("import" + SPACE + pkg + SEMICOLON); } if (superClass != null) { - out.println("import" + SPACE + context.getPackage() + "." + superClass + SEMICOLON); + out.println("import" + SPACE + /*context.getPackage() +*/ "bwapi." + superClass + SEMICOLON); } out.println(); writeJavadoc(getDecl()); diff --git a/src/test/api/TestBot1.java b/src/test/api/TestBot1.java index 758899f..e8ff5ff 100644 --- a/src/test/api/TestBot1.java +++ b/src/test/api/TestBot1.java @@ -2,6 +2,9 @@ package test.api; import bwapi.*; import bwapi.Text.Size.Enum; +import bwta.BWTA; + +import java.io.File; /** * User: PC @@ -11,6 +14,7 @@ import bwapi.Text.Size.Enum; public class TestBot1 { + public void run() { final Mirror mirror = new Mirror(); mirror.getModule().setEventListener(new DefaultBWListener() { @@ -22,8 +26,8 @@ public class TestBot1 { @Override public void onStart() { System.out.println("-------Analysing map-------"); - //BWTA.readMap(); - //BWTA.analyze(); + BWTA.readMap(); + BWTA.analyze(); System.out.println(); mirror.getGame().enableFlag(bwapi.Flag.Enum.UserInput.getValue()); diff --git a/src/util/PointerTest.java b/src/util/PointerTest.java index a90bc35..6f810ed 100644 --- a/src/util/PointerTest.java +++ b/src/util/PointerTest.java @@ -15,7 +15,7 @@ public class PointerTest { private static final List BWAPI4_INTERFACES = Arrays.asList("Client", "Game", "AIModule" ,"Event", "Race", "Error"); private static boolean testCls(String cls){ - return BWAPI4_INTERFACES.contains(cls) || cls.endsWith("set") || cls.endsWith("Type"); + return BWAPI4_INTERFACES.contains(cls) || cls.endsWith("set") || cls.endsWith("Type") || cls.startsWith("BWTA"); } public static String test(String cls) {