how to invoke the this four CalcPath function in XSTools ???

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
common123
Human
Human
Posts: 33
Joined: 05 Apr 2008, 06:42

how to invoke the this four CalcPath function in XSTools ???

#1 Post by common123 »

i fount there is four function in XSTools relate to the CalcPath...

they are Calcpath_init,Calcpath_new,Calcpath_pathStep,Calcpath_init_destroy ...

and i know it need a field file which let openkore know which block can walk or not
i have tested something but always get a error.... anyone can help me???

in this case:

mapblocks=unpack(fieldfile) so a is a list which like [56, 1, 136, 1, 1, 1, 1, 1, 1, 1.....]

and my char 's coords is (30,45) and destination is (145,200)

and i want give that four function these parameters,so i can get the pathStep which maybe
like [(35,50),(40,55),(45,60).....(140,195),(145,200)]

how can i get the path steps just like above"[(35,50),(40,55),(45,60).....(140,195),(145,200)]"

what parameters i need to send to these functions ,it will return that list which i need...

Calcpath_init("is there need a parameter?") maybe it's Calcpath_init(mapblocks) or what?

then maybe Calcpath_new(("is there need a parameter too?")

is this Calcpath_pathStep($start_coords,$dist_coords) is this format right to invoke function??

then it can return me a path steps list???

sli
Perl Monk
Perl Monk
Posts: 810
Joined: 04 Apr 2008, 17:26
Noob?: No

Re: how to invoke the this four CalcPath function in XSTools ???

#2 Post by sli »

A ridiculously simple grep pretty much answered all of your questions. Do you even READ the source code you're asking about before you ask?

Code: Select all

/* found in algorithm.h */
typedef struct {
	pos_list solution;
	pos_ai_list fullList;
	index_list openList;
	lookups_list lookup;
	const char* map;
	const unsigned char* weight;
	unsigned long width;
	unsigned long height;
	pos * start;
	pos * dest;
	unsigned long time_max;
	int first_time;

	void *map_sv;
	void *weight_sv;
} CalcPath_session;

CalcPath_session *CalcPath_new ();
CalcPath_session *CalcPath_init (CalcPath_session *session, const char* map, const unsigned char* weight,
	unsigned long width, unsigned long height,
	pos * start, pos * dest, unsigned long time_max);
int CalcPath_pathStep (CalcPath_session *session);
void CalcPath_destroy (CalcPath_session *session);
Read PathFinding.xs as well.
cs : ee : realist

Locked