Exemplo n.º 1
0
///<summary> Shared code for initializing an info object for a new peer connection. </summary>
void initializeNewPeerInfo(POLYM_CONNECTION_INFO *connection_info, void *connection, uint16_t peerID)
{

	// initialize peer status struct
	int_array_init(&connection_info->realm_info.peer.status.connectedServices);
	int_array_init(&connection_info->realm_info.peer.status.outboundMessageQueue);

	// add new peer to list
	connection_info->connectionID = peerID;

	// set realm to peer
	connection_info->realm = POLY_REALM_PEER;
}
Exemplo n.º 2
0
PLparticles*
plNewParticleSystem(const char *name, size_t particleCount)
{
  PLparticles *ps = malloc(sizeof(PLparticles));
  ps->enabled = false;
  ps->autoDisable = false;
  ps->particleCount = particleCount;
  ps->obj = NULL;
  // Note: calloc initialise all fields to 0
  ps->particles = calloc(particleCount, sizeof(PLparticle));

  int_array_init(&ps->freeParticles);
  for (int i = 0 ; i < particleCount ; ++ i) {
    int_array_push(&ps->freeParticles, i);
  }

  return ps;
}