added a first implementation to main
fixed compilation (apart from trial->alive)
This commit is contained in:
parent
4fd79e8035
commit
6ec6d6015b
11
src/main.c
11
src/main.c
@ -1,10 +1,12 @@
|
||||
|
||||
#include "control.h"
|
||||
#include "path.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
trial *t;
|
||||
path *p;
|
||||
|
||||
if (argc <= 2) {
|
||||
fprintf(stderr, "Syntax: %s hostname port\n", argv[0]);
|
||||
@ -15,6 +17,15 @@ int main(int argc, char **argv) {
|
||||
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);
|
||||
|
||||
return 0;
|
||||
|
@ -1,19 +1,24 @@
|
||||
#ifndef _PATH_H
|
||||
#define _PATH_H
|
||||
|
||||
#include "control.h"
|
||||
|
||||
|
||||
struct path;
|
||||
typedef struct path path;
|
||||
|
||||
struct command;
|
||||
typedef struct command command;
|
||||
|
||||
struct command{
|
||||
timestamp ts;
|
||||
accel_t accel;
|
||||
turn_t turn;
|
||||
}
|
||||
};
|
||||
|
||||
struct path {
|
||||
GQueue* commands;
|
||||
}
|
||||
};
|
||||
|
||||
command *command_new(timestamp ts, accel_t a, turn_t t);
|
||||
void command_free(command* c);
|
||||
|
@ -6,6 +6,7 @@
|
||||
main_source = '''
|
||||
main.c
|
||||
control.c
|
||||
path.c
|
||||
'''
|
||||
|
||||
def build(bld):
|
||||
|
Loading…
Reference in New Issue
Block a user