BWTA2
This commit is contained in:
parent
b9e0e3fcfe
commit
6065021f23
Binary file not shown.
58
bwta2-c/BWTA.h
Normal file
58
bwta2-c/BWTA.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
#include <BWTA/Chokepoint.h>
|
||||
#include <BWTA/Polygon.h>
|
||||
#include <BWTA/Region.h>
|
||||
#include <BWTA/BaseLocation.h>
|
||||
#include <BWTA/RectangleArray.h>
|
||||
namespace BWTA
|
||||
{
|
||||
void readMap();
|
||||
void analyze();
|
||||
void computeDistanceTransform();
|
||||
void balanceAnalysis();
|
||||
|
||||
int getMaxDistanceTransform();
|
||||
RectangleArray<int>* getDistanceTransformMap();
|
||||
|
||||
const std::set<Region*>& getRegions();
|
||||
const std::set<Chokepoint*>& getChokepoints();
|
||||
const std::set<BaseLocation*>& getBaseLocations();
|
||||
const std::set<BaseLocation*>& getStartLocations();
|
||||
const std::set<Polygon*>& 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<BWAPI::TilePosition, double> getNearestTilePosition(BWAPI::TilePosition start, const std::set<BWAPI::TilePosition>& targets);
|
||||
std::map<BWAPI::TilePosition, double> getGroundDistances(BWAPI::TilePosition start, const std::set<BWAPI::TilePosition>& targets);
|
||||
void getGroundDistanceMap(BWAPI::TilePosition start, RectangleArray<double>& distanceMap);
|
||||
void getGroundWalkDistanceMap(int walkx, int walky, RectangleArray<double>& distanceMap);
|
||||
std::vector<BWAPI::TilePosition> getShortestPath(BWAPI::TilePosition start, BWAPI::TilePosition end);
|
||||
std::vector<BWAPI::TilePosition> getShortestPath(BWAPI::TilePosition start, const std::set<BWAPI::TilePosition>& targets);
|
||||
|
||||
// HPA* implementation
|
||||
void buildChokeNodes();
|
||||
std::list<Chokepoint*> getShortestPath2(BWAPI::TilePosition start, BWAPI::TilePosition target);
|
||||
int getGroundDistance2(BWAPI::TilePosition start, BWAPI::TilePosition end);
|
||||
|
||||
}
|
28
bwta2-c/BWTA/BaseLocation.h
Normal file
28
bwta2-c/BWTA/BaseLocation.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
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;
|
||||
};
|
||||
}
|
15
bwta2-c/BWTA/Chokepoint.h
Normal file
15
bwta2-c/BWTA/Chokepoint.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include <utility>
|
||||
#include <BWAPI.h>
|
||||
namespace BWTA
|
||||
{
|
||||
class Region;
|
||||
class Chokepoint
|
||||
{
|
||||
public:
|
||||
virtual const std::pair<Region*,Region*>& getRegions() const=0;
|
||||
virtual const std::pair<BWAPI::Position,BWAPI::Position>& getSides() const=0;
|
||||
virtual BWAPI::Position getCenter() const=0;
|
||||
virtual double getWidth() const=0;
|
||||
};
|
||||
}
|
19
bwta2-c/BWTA/Polygon.h
Normal file
19
bwta2-c/BWTA/Polygon.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
#include <vector>
|
||||
namespace BWTA
|
||||
{
|
||||
class Polygon : public std::vector <BWAPI::Position>
|
||||
{
|
||||
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<Polygon>& getHoles() const;
|
||||
std::vector<Polygon> holes;
|
||||
};
|
||||
}
|
274
bwta2-c/BWTA/RectangleArray.h
Normal file
274
bwta2-c/BWTA/RectangleArray.h
Normal file
|
@ -0,0 +1,274 @@
|
|||
#pragma once
|
||||
|
||||
namespace BWTA
|
||||
{
|
||||
/**
|
||||
* Template used for work with dynamically initialized array with dimension 2.
|
||||
*/
|
||||
template <class Type>
|
||||
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<Type>& 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 <class Type>
|
||||
RectangleArray<Type>::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 <class Type>
|
||||
RectangleArray<Type>::RectangleArray(const RectangleArray<Type>& 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 <class Type>
|
||||
RectangleArray<Type>::~RectangleArray(void)
|
||||
{
|
||||
delete [] columns;
|
||||
if (this->owner)
|
||||
delete [] data;
|
||||
}
|
||||
//----------------------------------------------- GET WIDTH ------------------------------------------------
|
||||
template <class Type>
|
||||
unsigned int RectangleArray<Type>::getWidth(void) const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
//----------------------------------------------- SET WIDTH ------------------------------------------------
|
||||
template <class Type>
|
||||
void RectangleArray<Type>::setWidth(unsigned int width)
|
||||
{
|
||||
this->width = width;
|
||||
}
|
||||
//----------------------------------------------- GET HEIGHT -----------------------------------------------
|
||||
template <class Type>
|
||||
unsigned int RectangleArray<Type>::getHeight(void) const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
//----------------------------------------------- SET HEIGHT -----------------------------------------------
|
||||
template <class Type>
|
||||
void RectangleArray<Type>::setHeight(unsigned int height)
|
||||
{
|
||||
this->height = height;
|
||||
}
|
||||
//------------------------------------------------ GET ITEM ------------------------------------------------
|
||||
template <class Type>
|
||||
Type RectangleArray<Type>::getItem(unsigned int x, unsigned int y)
|
||||
{
|
||||
return this->getColumn(x)[y];
|
||||
}
|
||||
//------------------------------------------------ GET ITEM ------------------------------------------------
|
||||
template <class Type>
|
||||
Type RectangleArray<Type>::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 <class Type>
|
||||
void RectangleArray<Type>::setItem(unsigned int x, unsigned int y, Type* item)
|
||||
{
|
||||
this->getColumn(x)[y] = item;
|
||||
}
|
||||
//------------------------------------------------ GET LINE ------------------------------------------------
|
||||
template <class Type>
|
||||
Type* RectangleArray<Type>::getColumn(unsigned int index)
|
||||
{
|
||||
return columns[index];
|
||||
}
|
||||
//------------------------------------------------ GET LINE ------------------------------------------------
|
||||
template <class Type>
|
||||
const Type* RectangleArray<Type>::getColumn(unsigned int index) const
|
||||
{
|
||||
return columns[index];
|
||||
}
|
||||
//------------------------------------------------- RESIZE -------------------------------------------------
|
||||
template <class Type>
|
||||
void RectangleArray<Type>::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 <class Type>
|
||||
void RectangleArray<Type>::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 <class Type>
|
||||
void RectangleArray<Type>::saveToFile(const std::string& fileName)
|
||||
{
|
||||
FILE* f = fopen(fileName.c_str(), "wt");
|
||||
if (!f)
|
||||
exit(1);
|
||||
this->printToFile(f);
|
||||
fclose(f);
|
||||
}
|
||||
//------------------------------------------------- SET TO -------------------------------------------------
|
||||
template <class Type>
|
||||
void RectangleArray<Type>::setTo(const Type& value)
|
||||
{
|
||||
for (unsigned int i = 0; i < this->getWidth()*this->getHeight(); i++)
|
||||
this->data[i] = value;
|
||||
}
|
||||
//--------------------------------------------- SET BORDER TO ----------------------------------------------
|
||||
template <class Type>
|
||||
void RectangleArray<Type>::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 <class Type>
|
||||
void RectangleArray<Type>::setRectangleTo(unsigned int xLeft, unsigned int yTop, unsigned int xRight, unsigned int yBottom, const Type& value) {
|
||||
xLeft = std::max<int>(xLeft,0);
|
||||
yTop = std::max<int>(yTop,0);
|
||||
xRight = std::min<int>(xRight,this->width-1);
|
||||
yBottom = std::min<int>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
}
|
20
bwta2-c/BWTA/Region.h
Normal file
20
bwta2-c/BWTA/Region.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
#include <BWAPI.h>
|
||||
#include <set>
|
||||
#include <BWTA/Polygon.h>
|
||||
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<Chokepoint*>& getChokepoints() const=0;
|
||||
virtual const std::set<BaseLocation*>& getBaseLocations() const=0;
|
||||
virtual bool isReachable(Region* region) const=0;
|
||||
virtual const std::set<Region*>& getReachableRegions() const=0;
|
||||
virtual const int getMaxDistance() const=0;
|
||||
};
|
||||
}
|
404
c4/impl.cpp
404
c4/impl.cpp
|
@ -1,6 +1,7 @@
|
|||
#include "../concat_header4.h"
|
||||
#include <BWAPI.h>
|
||||
#include <BWAPI/Client.h>
|
||||
#include <BWTA.h>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <jni.h>
|
||||
|
@ -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, "<init>", "(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, "<init>", "(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, "<init>", "()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, "<init>", "()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, "<init>", "()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<BWTA::Region*> cresult = BWTA::getRegions();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::Region*>::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<BWTA::Chokepoint*> cresult = BWTA::getChokepoints();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::Chokepoint*>::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<BWTA::BaseLocation*> cresult = BWTA::getBaseLocations();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::BaseLocation*>::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<BWTA::BaseLocation*> cresult = BWTA::getStartLocations();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::BaseLocation*>::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<BWTA::Polygon*> cresult = BWTA::getUnwalkablePolygons();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::Polygon*>::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, "<init>", "(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, "<init>", "(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, "<init>", "(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, "<init>", "(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, "<init>", "(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<BWTA::Chokepoint*> cresult = x_region->getChokepoints();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::Chokepoint*>::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<BWTA::BaseLocation*> cresult = x_region->getBaseLocations();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::BaseLocation*>::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<BWTA::Region*> cresult = x_region->getReachableRegions();
|
||||
jclass listCls = FindCachedClass(env, "java/util/ArrayList");
|
||||
jmethodID listConsID = FindCachedMethod(env, listCls, "<init>", "()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<BWTA::Region*>::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()) {
|
||||
|
|
BIN
compiled4/bwta/BWTA.class
Normal file
BIN
compiled4/bwta/BWTA.class
Normal file
Binary file not shown.
BIN
compiled4/bwta/BaseLocation.class
Normal file
BIN
compiled4/bwta/BaseLocation.class
Normal file
Binary file not shown.
BIN
compiled4/bwta/Chokepoint.class
Normal file
BIN
compiled4/bwta/Chokepoint.class
Normal file
Binary file not shown.
BIN
compiled4/bwta/Polygon.class
Normal file
BIN
compiled4/bwta/Polygon.class
Normal file
Binary file not shown.
BIN
compiled4/bwta/Region.class
Normal file
BIN
compiled4/bwta/Region.class
Normal file
Binary file not shown.
495
concat_header4.h
495
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
|
||||
|
|
73
generated/bwta/BWTA.java
Normal file
73
generated/bwta/BWTA.java
Normal file
|
@ -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<Region> getRegions();
|
||||
|
||||
public static native List<Chokepoint> getChokepoints();
|
||||
|
||||
public static native List<BaseLocation> getBaseLocations();
|
||||
|
||||
public static native List<BaseLocation> getStartLocations();
|
||||
|
||||
public static native List<Polygon> 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);
|
||||
|
||||
|
||||
}
|
118
generated/bwta/BaseLocation.java
Normal file
118
generated/bwta/BaseLocation.java
Normal file
|
@ -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<Unit> getMinerals() {
|
||||
return getMinerals_native(pointer);
|
||||
}
|
||||
|
||||
public List<Unit> getStaticMinerals() {
|
||||
return getStaticMinerals_native(pointer);
|
||||
}
|
||||
|
||||
public List<Unit> 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<Long, BaseLocation> instances = new HashMap<Long, BaseLocation>();
|
||||
|
||||
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<Unit> getMinerals_native(long pointer);
|
||||
|
||||
private native List<Unit> getStaticMinerals_native(long pointer);
|
||||
|
||||
private native List<Unit> 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);
|
||||
|
||||
|
||||
}
|
52
generated/bwta/Chokepoint.java
Normal file
52
generated/bwta/Chokepoint.java
Normal file
|
@ -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<Long, Chokepoint> instances = new HashMap<Long, Chokepoint>();
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
68
generated/bwta/Polygon.java
Normal file
68
generated/bwta/Polygon.java
Normal file
|
@ -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<Long, Polygon> instances = new HashMap<Long, Polygon>();
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
82
generated/bwta/Region.java
Normal file
82
generated/bwta/Region.java
Normal file
|
@ -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<Chokepoint> getChokepoints() {
|
||||
return getChokepoints_native(pointer);
|
||||
}
|
||||
|
||||
public List<BaseLocation> getBaseLocations() {
|
||||
return getBaseLocations_native(pointer);
|
||||
}
|
||||
|
||||
public boolean isReachable(Region region) {
|
||||
return isReachable_native(pointer, region);
|
||||
}
|
||||
|
||||
public List<Region> getReachableRegions() {
|
||||
return getReachableRegions_native(pointer);
|
||||
}
|
||||
|
||||
public int getMaxDistance() {
|
||||
return getMaxDistance_native(pointer);
|
||||
}
|
||||
|
||||
|
||||
private static Map<Long, Region> instances = new HashMap<Long, Region>();
|
||||
|
||||
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<Chokepoint> getChokepoints_native(long pointer);
|
||||
|
||||
private native List<BaseLocation> getBaseLocations_native(long pointer);
|
||||
|
||||
private native boolean isReachable_native(long pointer, Region region);
|
||||
|
||||
private native List<Region> getReachableRegions_native(long pointer);
|
||||
|
||||
private native int getMaxDistance_native(long pointer);
|
||||
|
||||
|
||||
}
|
237
headers4/bwta_BWTA.h
Normal file
237
headers4/bwta_BWTA.h
Normal file
|
@ -0,0 +1,237 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* 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
|
117
headers4/bwta_BaseLocation.h
Normal file
117
headers4/bwta_BaseLocation.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* 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
|
29
headers4/bwta_Chokepoint.h
Normal file
29
headers4/bwta_Chokepoint.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* 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
|
53
headers4/bwta_Polygon.h
Normal file
53
headers4/bwta_Polygon.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* 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
|
69
headers4/bwta_Region.h
Normal file
69
headers4/bwta_Region.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* 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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <BWAPI.h>\n" +
|
||||
"#include <BWAPI/Client.h>\n" +
|
||||
(CJavaPipeline.isBWAPI3() ? "#include <BWTA.h>\n" : "#include <thread>\n" + "#include <chrono>\n") +
|
||||
"#include <BWTA.h>\n" +
|
||||
(CJavaPipeline.isBWAPI3() ? "" : "#include <thread>\n" + "#include <chrono>\n") +
|
||||
"#include <jni.h>\n" +
|
||||
"#include <cstring>\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" +
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -15,7 +15,7 @@ public class PointerTest {
|
|||
private static final List<String> 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) {
|
||||
|
|
Reference in a new issue