70 int chars_read = 0, i = 0, num = 0;
77 while(chars_read != EOF)
82 if(chars_read == 0 || chars_read == EOF || line[0] ==
'#')
92 num = strtol(line, &end_ptr, 10);
100 pch = strtok(line,
" ,");
101 (*room)[i].x = strtol(pch, &end_ptr, 10);
102 pch = strtok(NULL,
" ,");
103 (*room)[i].y = strtol(pch, &end_ptr, 10);
128 int chars_read = 0, i = 0, num = 0;
135 while(chars_read != EOF)
140 if(chars_read == 0 || chars_read == EOF || line[0] ==
'#')
150 num = strtol(line, &end_ptr, 10);
159 pch = strtok(line,
" ,");
160 (*tags)[i].x = strtol(pch, &end_ptr, 10);
162 pch = strtok(NULL,
" ,");
163 (*tags)[i].y = strtol(pch, &end_ptr, 10);
165 pch = strtok(NULL,
" ,");
166 memcpy((*tags)[i].
id, pch, 10);
167 (*tags)[i].id[10] =
'\0';
169 pch = strtok(line,
" ,");
170 (*tags)[i].enable = strtol(pch, &end_ptr, 10);
192 unsigned int i, max_width = 0, max_height = 0;
198 if(max_width < env->room[i].x)
200 max_width = env->
room[i].
x;
203 if(max_height < env->room[i].y)
205 max_height = env->
room[i].
y;
232 if(strcmp(env->
tags[i].
id, tag_id) == 0)
int enviroment_tags_load(enviroment_tag_t **tags, const char *filename)
Room point definition - x, y.
int file_readln(file_t *fs, char *buffer, size_t buflen)
file_t * file_open(const char *name, const char *mode)
void enviroment_calc_room_dimensions(enviroment_t *env)
int enviroment_room_load(enviroment_room_point_t **room, const char *filename)
int file_close(file_t *fs)
int enviroment_tag_check(enviroment_t *env, char tag_id[11])
#define s_CONFIG_RFID_EMPTY_TAG
#define s_ENVIROMENT_TAG_UNKNOWN
void enviroment_destroy(enviroment_t *env)
enviroment_t * enviroment_load(char *room_def_path, char *tags_def_path)
#define s_ENVIROMENT_TAG_ZEROS
Tag definition - x, y, id.
enviroment_room_point_t * room
#define s_ENVIROMENT_TAG_DISABLED
Enviroment Structure - room points, tags, room point number, tag number.