added a first implementation to main

fixed compilation (apart from trial->alive)
This commit is contained in:
Johannes Reinhardt 2008-07-12 02:00:11 +02:00
parent 4fd79e8035
commit 6ec6d6015b
3 changed files with 19 additions and 2 deletions

View File

@ -1,10 +1,12 @@
#include "control.h" #include "control.h"
#include "path.h"
#include <stdio.h> #include <stdio.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
trial *t; trial *t;
path *p;
if (argc <= 2) { if (argc <= 2) {
fprintf(stderr, "Syntax: %s hostname port\n", argv[0]); fprintf(stderr, "Syntax: %s hostname port\n", argv[0]);
@ -15,6 +17,15 @@ int main(int argc, char **argv) {
return 2; return 2;
} }
/*create trivial path towards the origin*/
p = path_new(&t->map,&t->vehicle);
while(t->alive){
trial_wait_for_input(t);
path_execute(t,p);
}
path_free(p);
trial_free(t); trial_free(t);
return 0; return 0;

View File

@ -1,19 +1,24 @@
#ifndef _PATH_H #ifndef _PATH_H
#define _PATH_H #define _PATH_H
#include "control.h"
struct path; struct path;
typedef struct path path; typedef struct path path;
struct command;
typedef struct command command;
struct command{ struct command{
timestamp ts; timestamp ts;
accel_t accel; accel_t accel;
turn_t turn; turn_t turn;
} };
struct path { struct path {
GQueue* commands; GQueue* commands;
} };
command *command_new(timestamp ts, accel_t a, turn_t t); command *command_new(timestamp ts, accel_t a, turn_t t);
void command_free(command* c); void command_free(command* c);

View File

@ -6,6 +6,7 @@
main_source = ''' main_source = '''
main.c main.c
control.c control.c
path.c
''' '''
def build(bld): def build(bld):