X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fstrat_db.h;h=e377ceb03753485fff7975f42d51c436d83698fb;hp=1b5314f836be6e5b7e78726691232360d31169c2;hb=HEAD;hpb=06813a0566192d90e1ad8c891dfb7cc55dedd525 diff --git a/projects/microb2010/mainboard/strat_db.h b/projects/microb2010/mainboard/strat_db.h index 1b5314f..e377ceb 100644 --- a/projects/microb2010/mainboard/strat_db.h +++ b/projects/microb2010/mainboard/strat_db.h @@ -33,7 +33,7 @@ struct corn_db { }; struct tomato_db { - /* nothing for now */ + uint8_t idx; }; /* structure describing the status of a waypoint */ @@ -54,16 +54,19 @@ struct waypoint_db { /* visited by opponent */ uint8_t opp_visited:1; - uint8_t reserved:3; + /* true if the wp is on a circuit */ + uint8_t on_circuit:1; - /* absolute position of the waypoint */ -/* int16_t x; */ -/* int16_t y; */ + uint8_t reserved:2; union { struct corn_db corn; struct tomato_db tomato; }; + + /* to monitor time when corn/ball was removed */ + /* not optimal... but... we have enough ram */ + int8_t time_removed; }; /* database reflecting the status of objects on area */ @@ -87,6 +90,14 @@ struct strat_db { /* global structure storing the database */ extern struct strat_db strat_db; +/* return the nearest waypoint */ +int8_t xycoord_to_ijcoord(int16_t *xp, int16_t *yp, uint8_t *ip, uint8_t *jp); + +/* return the nearest waypoint that is not a corn: xp and yp contains + * the input and output, and ip, jp are only outputs. return 0 on + * success. */ +int8_t xycoord_to_ijcoord_not_corn(int16_t *xp, int16_t *yp, uint8_t *ip, uint8_t *jp); + /* convert i,j coords to x,y coords */ int8_t ijcoord_to_xycoord(uint8_t i, uint8_t j, int16_t *x, int16_t *y);