예제 #1
0
파일: Nub.cpp 프로젝트: bigrpg/joyengine
dove::Nub::SOCKETSTATUS Nub::onWrite()
{
	if(fdStatus_ == SOCKET_CONNECTING)
		return checkConnected();

	return sendLastRemain();
}
PvaClientNTMultiMonitorPtr PvaClientMultiChannel::createNTMonitor(std::string const &request)
{
    checkConnected();
    PVStructurePtr pvRequest = createRequest->createRequest(request);
    if(!pvRequest) {
        string message = " PvaClientMultiChannel::createNTMonitor invalid pvRequest: "
             + createRequest->getMessage();
        throw std::runtime_error(message);
    }
    return PvaClientNTMultiMonitor::create(getPtrSelf(), pvaClientChannelArray,pvRequest);
}
PvaClientNTMultiGetPtr PvaClientMultiChannel::createNTGet(std::string const &request)
{
    checkConnected();
    PVStructurePtr pvRequest = createRequest->createRequest(request);
    if(!pvRequest) {
        string message = " PvaClientMultiChannel::createNTGet invalid pvRequest: "
             + createRequest->getMessage();
        throw std::runtime_error(message);
    }
    return PvaClientNTMultiGet::create(shared_from_this(), pvaClientChannelArray,pvRequest);
}
예제 #4
0
bool
SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
{
  if (!checkConnected()) {
    return false;
  }
  
  if(!setupBuffersDone) 
  {
    setupBuffers();
    setupBuffersDone=true;
  }

  if(setupBuffersDone) 
  {
    NdbSleep_MilliSleep(m_timeOutMillis);
    if(*serverStatusFlag == 1 && *clientStatusFlag == 1)
      return true;
  }

  DBUG_PRINT("error", ("Failed to set up buffers to node %d",
              remoteNodeId));
  return false;
}
예제 #5
0
// builds and rebuilds the managed sockets for select calls
buildFDSet(){
	checkConnected();
	//printf("build fd set called\n");
	FD_ZERO(&managedSet);
	if (largestSock < partSock){
		largestSock = partSock;
	}
	FD_SET(partSock, &managedSet);
	if(largestSock < obsSock){
		largestSock = obsSock;
	}
	FD_SET(obsSock, &managedSet);

	int i;
	for (i = 0; i<64; i++){
		if(participants[i] != 0){
			if(largestSock < participants[i]){
				largestSock = participants[i];
			}
			FD_SET(participants[i], &managedSet);
			//printf("added participant %d to list of managed sockets\n", i);
		}
	}
}
PvaClientNTMultiPutPtr PvaClientMultiChannel::createNTPut()
{
    checkConnected();
    return PvaClientNTMultiPut::create(getPtrSelf(), pvaClientChannelArray);
}
PvaClientMultiMonitorDoublePtr PvaClientMultiChannel::createMonitor()
{
    checkConnected();
     return PvaClientMultiMonitorDouble::create(getPtrSelf(), pvaClientChannelArray);
}
PvaClientNTMultiPutPtr PvaClientMultiChannel::createNTPut()
{
    checkConnected();
    return PvaClientNTMultiPut::create(shared_from_this(), pvaClientChannelArray);
}
PvaClientMultiMonitorDoublePtr PvaClientMultiChannel::createMonitor()
{
    checkConnected();
     return PvaClientMultiMonitorDouble::create(shared_from_this(), pvaClientChannelArray);
}
예제 #10
0
파일: mapgen.cpp 프로젝트: nornagon/torch
void generate_terrarium() {
	game.map.resize(128,128);
	torch.buf.resize(128,128);

	s16 cx = torch.buf.getw()/2, cy = torch.buf.geth()/2;

	torch.buf.reset();
	torch.buf.cache.reset();
	game.map.reset();

	// glass on the rim
	filledCircle(cx, cy, 60, set_tile_i, (void*)GROUND);
	hollowCircle(cx, cy, 60, set_tile_i, (void*)GLASS);

	AddStars();

	u32 timerVal;

	printf("Growing trees... ");
	startTimer();
	CATrees();
	timerVal = stopTimer();
	printf("done (%.2fs).\n", timerVal*1024/33.513982e6);

	printf("Filling lakes... ");
	startTimer();
	CALakes();
	timerVal = stopTimer();
	printf("done (%.2fs).\n", timerVal*1024/33.513982e6);

	printf("Buying shrubberies... ");
	startTimer();
	AddGrass();
	timerVal = stopTimer();
	printf("done (%.2fs).\n", timerVal*1024/33.513982e6);

	printf("Checking connectivity... ");
	if (checkConnected()) {
		printf("connected.\n");
	} else {
		printf("\1\x1f\x01unconnected\2.\n");
	}

	printf("Simulating inhabitation... ");
	Inhabit();
	printf("done.\n");

	printf("Spawning creatures... ");
	SpawnCreatures();
	printf("done.\n");

	printf("Dropping items... ");
	for (int i = 0; i < 60; i++) {
		s16 x = rand32() % torch.buf.getw(), y = rand32() % torch.buf.geth();
		if (!game.map.solid(x,y)) {
			Object *on = new Object(ROCK);
			stack_item_push(game.map.at(x,y)->objects, on);
		} else i--;
	}
	printf("done.\n");

	s16 x = cx, y = cy;
	while (!game.map.walkable(x, y))
		randwalk(x, y);
	game.player.x = x;
	game.player.y = y;

	game.player.setPos(x,y);
	game.map.at(x,y)->creature = &game.player;

	Object *on = new Object(BATON);
	stack_item_push(game.map.at(x,y)->objects, on);
	on = new Object(LEATHER_JACKET);
	stack_item_push(game.map.at(x,y)->objects, on);
	on = new Object(PAIR_OF_BLUNDSTONE_BOOTS);
	stack_item_push(game.map.at(x,y)->objects, on);

	x = cx; y = cy;

	set_tile(cx+40, cy, FIRE);
	lightsource *li = new lightsource;
	li->set(9<<12, (int)(0.1*(1<<12)), (int)(1.0*(1<<12)), (int)(0.1*(1<<12)));
	li->orig_intensity = li->intensity = 1<<11;
	li->x = (cx+40)<<12; li->y = cy<<12;
	li->flicker = FLICKER_RADIUS;
	game.map.lights.push(li);
	set_tile(cx+30, cy, FIRE);
	li = new lightsource;
	li->set(9<<12, (int)(1.0*(1<<12)), (int)(0.1*(1<<12)), (int)(0.1*(1<<12)));
	li->orig_intensity = li->intensity = 1<<11;
	li->x = (cx+30)<<12; li->y = cy<<12;
	li->flicker = FLICKER_RADIUS;
	game.map.lights.push(li);
	set_tile(cx+35, cy-7, FIRE);
	li = new lightsource;
	li->set(9<<12, (int)(0.1*(1<<12)), (int)(0.1*(1<<12)), (int)(1.0*(1<<12)));
	li->orig_intensity = li->intensity = 1<<11;
	li->x = (cx+35)<<12; li->y = (cy-7)<<12;
	li->flicker = FLICKER_RADIUS;
	game.map.lights.push(li);

	game.map.block.refresh_blocked_from();
	torch.dirty_screen();
	torch.reset_luminance();
}
예제 #11
0
파일: Nub.cpp 프로젝트: bigrpg/joyengine
dove::Nub::SOCKETSTATUS Nub::onRead()
{
	if(fdStatus_ == SOCKET_CONNECTING)
		return checkConnected();
	return processAllReachMsg();
}