/************************************************************************** Send details of src's spaceship (or spaceships of all players if src is NULL) to specified destinations. If dest is NULL then game.est_connections is used. **************************************************************************/ void send_spaceship_info(struct player *src, struct conn_list *dest) { if (!dest) { dest = game.est_connections; } players_iterate(pplayer) { if (!src || pplayer == src) { struct packet_spaceship_info info; struct player_spaceship *ship = &pplayer->spaceship; info.player_num = player_number(pplayer); info.sship_state = ship->state; info.structurals = ship->structurals; info.components = ship->components; info.modules = ship->modules; info.fuel = ship->fuel; info.propulsion = ship->propulsion; info.habitation = ship->habitation; info.life_support = ship->life_support; info.solar_panels = ship->solar_panels; info.launch_year = ship->launch_year; info.population = ship->population; info.mass = ship->mass; info.support_rate = ship->support_rate; info.energy_rate = ship->energy_rate; info.success_rate = ship->success_rate; info.travel_time = ship->travel_time; info.structure = ship->structure; lsend_packet_spaceship_info(dest, &info); } } players_iterate_end; }
send_spaceship_info (void) { int j; struct player *pplayer; struct packet_spaceship_info info; struct player_spaceship *ship = &pplayer->spaceship; for (j = 0; j < 32; j++) { info.structure[j] = ship->structure[j] ? '1' : '0'; } lsend_packet_spaceship_info (&info); }