Revision 329
trying to make it work
proj_func.c | ||
---|---|---|
31 | 31 |
host_info_t *ret = (host_info_t*)malloc(sizeof(host_info_t)); |
32 | 32 |
if (ret == NULL) return ret; |
33 | 33 |
|
34 |
ret->host_x = gunner_get_x (host); |
|
35 |
ret->host_y = gunner_get_y (host); |
|
36 |
ret->host_angle = gunner_get_angle (host); |
|
37 |
ret->host_health = gunner_get_health (host); |
|
38 |
ret->host_current_health = gunner_get_curr_health(host); |
|
34 |
ret->host_x = (int16_t)gunner_get_x (host);
|
|
35 |
ret->host_y = (int16_t)gunner_get_y (host);
|
|
36 |
ret->host_angle = (int16_t)gunner_get_angle (host);
|
|
37 |
ret->host_health = (int16_t)gunner_get_health (host);
|
|
38 |
ret->host_current_health = (int16_t)gunner_get_curr_health(host);
|
|
39 | 39 |
|
40 | 40 |
// remote |
41 |
ret->remote_x = gunner_get_x (remote); |
|
42 |
ret->remote_y = gunner_get_y (remote); |
|
43 |
ret->remote_angle = gunner_get_angle (remote); |
|
44 |
ret->remote_health = gunner_get_health (remote); |
|
45 |
ret->remote_current_health = gunner_get_curr_health(remote); |
|
41 |
ret->remote_x = (int16_t)gunner_get_x (remote);
|
|
42 |
ret->remote_y = (int16_t)gunner_get_y (remote);
|
|
43 |
ret->remote_angle = (int16_t)gunner_get_angle (remote);
|
|
44 |
ret->remote_health = (int16_t)gunner_get_health (remote);
|
|
45 |
ret->remote_current_health = (int16_t)gunner_get_curr_health(remote);
|
|
46 | 46 |
|
47 | 47 |
ret->no_bullets = 0; |
48 | 48 |
|
... | ... | |
320 | 320 |
|
321 | 321 |
void build_host_structure(host_info_t *p, gunner_t *host, gunner_t *remote, list_t *bullet_list) { |
322 | 322 |
// host |
323 |
p->host_x = gunner_get_x (host); |
|
324 |
p->host_y = gunner_get_y (host); |
|
325 |
p->host_angle = gunner_get_angle (host); |
|
326 |
p->host_health = gunner_get_health (host); |
|
327 |
p->host_current_health = gunner_get_curr_health(host); |
|
323 |
p->host_x = (int16_t)gunner_get_x (host);
|
|
324 |
p->host_y = (int16_t)gunner_get_y (host);
|
|
325 |
p->host_angle = (int16_t)gunner_get_angle (host);
|
|
326 |
p->host_health = (int16_t)gunner_get_health (host);
|
|
327 |
p->host_current_health = (int16_t)gunner_get_curr_health(host);
|
|
328 | 328 |
|
329 | 329 |
// remote |
330 |
p->remote_x = gunner_get_x (remote); |
|
331 |
p->remote_y = gunner_get_y (remote); |
|
332 |
p->remote_angle = gunner_get_angle (remote); |
|
333 |
p->remote_health = gunner_get_health (remote); |
|
334 |
p->remote_current_health = gunner_get_curr_health(remote); |
|
330 |
p->remote_x = (int16_t)gunner_get_x (remote);
|
|
331 |
p->remote_y = (int16_t)gunner_get_y (remote);
|
|
332 |
p->remote_angle = (int16_t)gunner_get_angle (remote);
|
|
333 |
p->remote_health = (int16_t)gunner_get_health (remote);
|
|
334 |
p->remote_current_health = (int16_t)gunner_get_curr_health(remote);
|
|
335 | 335 |
|
336 | 336 |
// bullets |
337 | 337 |
size_t sz = list_size(bullet_list); |
338 | 338 |
p->no_bullets = sz; |
339 |
p->bullets_x = (float*)realloc(p->bullets_x , sz * sizeof(float));
|
|
340 |
p->bullets_y = (float*)realloc(p->bullets_y , sz * sizeof(float));
|
|
341 |
p->bullets_vx = (float*)realloc(p->bullets_vx , sz * sizeof(float));
|
|
342 |
p->bullets_vy = (float*)realloc(p->bullets_vy , sz * sizeof(float));
|
|
343 |
p->bullets_shooter = (bool*) realloc(p->bullets_shooter , sz * sizeof(bool )); |
|
339 |
p->bullets_x = (int16_t*)realloc(p->bullets_x , sz * sizeof(int16_t));
|
|
340 |
p->bullets_y = (int16_t*)realloc(p->bullets_y , sz * sizeof(int16_t));
|
|
341 |
p->bullets_vx = (int16_t*)realloc(p->bullets_vx , sz * sizeof(int16_t));
|
|
342 |
p->bullets_vy = (int16_t*)realloc(p->bullets_vy , sz * sizeof(int16_t));
|
|
343 |
p->bullets_shooter = (bool*) realloc(p->bullets_shooter , sz * sizeof(bool ));
|
|
344 | 344 |
|
345 | 345 |
list_node_t *it = list_begin(bullet_list); |
346 | 346 |
size_t i = 0; |
347 | 347 |
while (it != list_end(bullet_list)) { |
348 | 348 |
bullet_t *bullet = *list_node_val(it); |
349 |
p->bullets_x [i] = bullet_get_x (bullet); |
|
350 |
p->bullets_y [i] = bullet_get_y (bullet); |
|
351 |
p->bullets_vx [i] = bullet_get_vx (bullet); |
|
352 |
p->bullets_vy [i] = bullet_get_vy (bullet); |
|
349 |
p->bullets_x [i] = (int16_t)bullet_get_x (bullet);
|
|
350 |
p->bullets_y [i] = (int16_t)bullet_get_y (bullet);
|
|
351 |
p->bullets_vx [i] = (int16_t)bullet_get_vx (bullet);
|
|
352 |
p->bullets_vy [i] = (int16_t)bullet_get_vy (bullet);
|
|
353 | 353 |
p->bullets_shooter [i] = gunner_get_team(bullet_get_shooter(bullet)) != gunner_get_team(host); |
354 | 354 |
it = list_node_next(it); |
355 | 355 |
i++; |
Also available in: Unified diff