示例#1
0
/************************************************************************
  X Error Handler
************************************************************************/
XErrorHandler ErrorHandler(Display *d, XErrorEvent *event)
  {
  char errmsg[256];

  XGetErrorText(d, event->error_code, errmsg, 256);
  ConsoleMessage("%s failed request: %s\n", Module, errmsg);
  ConsoleMessage("Major opcode: 0x%x, resource id: 0x%x\n",
                  event->request_code, event->resourceid);
  }
示例#2
0
/************************************************************************
  X Error Handler
************************************************************************/
int ErrorHandler(Display *d, XErrorEvent *event)
{
    char errmsg[256];

    XGetErrorText(d, event->error_code, errmsg, sizeof(errmsg));
    ConsoleMessage("%s failed request: %s\n", Module, errmsg);
    ConsoleMessage("Major opcode: 0x%x, resource id: 0x%x\n",
                   event->request_code, (unsigned int)event->resourceid);
    return 0;
}
示例#3
0
void IrcBot::Command_QuickSay(const std::string &message)
{
	if (message.length() <= 0)
	{	
		ConsoleMessage("No message input. Usage: !s [some message] (without brackets)");
		return;
	}
	std::string m = "PRIVMSG " + channel + " :" + message + "\r\n";
	ConsoleMessage("Sending: " + m);
	Send(m);
	//Sleep(500);
}
示例#4
0
//---------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------
void InitRealtimeDebugInterface()
{
	if(g_ServerData->pDebugInterface != NULL)
	{
		ConsoleMessage("Server: RealtimeDebugInterface ACTIVE");
		singletons::g_pRealtimeDebugInterface = (IRealtimeDebugInterface*)g_ServerData->pDebugInterface;
	}
	else
	{
		ConsoleMessage("Server: RealtimeDebugInterface NOT active.");
		singletons::g_pRealtimeDebugInterface = new CRealtimeDebugInterfaceDummy();
	}
}
示例#5
0
int CBanner( void )
{
    int     count;

    count = 0;
    if( !CompFlags.banner_printed && !CompFlags.quiet_mode ) {
#if defined( _BETAVER )
        ConsoleMessage( banner1w1( "C++ " _TARGET_ " Optimizing Compiler" ) );
        ++count;
        ConsoleMessage( banner1w2( _WPP_VERSION_ ) );
        ++count;
#else
        ConsoleMessage( banner1w( "C++ " _TARGET_ " Optimizing Compiler", _WPP_VERSION_ ) );
        ++count;
#endif
        ConsoleMessage( banner2 );
        ++count;
        ConsoleMessage( banner2a( "1989" ) );
        ++count;
        ConsoleMessage( banner3 );
        ++count;
        ConsoleMessage( banner3a );
        ++count;
        if( Token[0] != '$' ) {             /* if finger print present */
            ConsoleMessage( Token );                /* - print it */
            ++count;
        }
        CompFlags.banner_printed = 1;
    }
    return( count );
}
示例#6
0
void IrcBot::Command_Part(const std::string &command)
{
	if (command.length() <= 0)
		return;
	std::string target = command.substr(0, command.find_first_of(' '));
	if (target.length() <= 0)
	{
		ConsoleMessage("No channel input. Usage: !part [#channel] (without brackets)");
		return;
	}
	std::string irc_message = "PART " + target + "\r\n";
	ConsoleMessage("Parting " + target);
	Send(irc_message);
	//Sleep(300);
}
示例#7
0
void IrcBot::ReadHandler(const boost::system::error_code &error, std::size_t bytesRead)
{
	if (shuttingDown)
	{
		return;
	}
	if (!error)
	{
		messageString = readBuffer.data();

		std::cout << std::string(readBuffer.data(), bytesRead);
		HandlePing(messageString);

		// handle welcome message 001
		if (messageString.find(serverWelcomeMessage) == 0)//if (messageString.find(":" + serverName + " 001") == 0)
		{
			Send(join);
		}
		HandleRequest(messageString);

		if (activeGame != NONE)
		{
			HandleGameInput(messageString);
		}

		readBuffer.fill('\0');
		sock.async_read_some(buffer(readBuffer), [this](boost::system::error_code ec, std::size_t bytesRead) { ReadHandler(ec, bytesRead); });
	}
	else
	{
		ConsoleMessage(error.message());
	}
}
示例#8
0
void IrcBot::Send_Say(const std::string &channel, const std::string message)
{
	if (channel.length() <= 0)
	{
		ConsoleMessage("No channel input. Usage: !say [#channel] [some message] (without brackets)");
		return;
	}
	if (message.length() <= 0)
	{
		ConsoleMessage("No message input. Usage: !say [#channel] [some message] (without brackets)");
		return;
	}
	std::string irc_message = "PRIVMSG " + channel + " :" + message + "\r\n";
	ConsoleMessage("Sending: " + irc_message);
	Send(irc_message);
}
示例#9
0
void IrcBot::Command_Quit(const std::string &command)
{
	std::string message = command;
	std::string irc_message = "QUIT " + message + "\r\n";
	ConsoleMessage("Quitting with message: " + message);
	Send(irc_message);
	//Sleep(300);
}
示例#10
0
void IrcBot::Hangman_IncorrectGuess(const std::string &message)
{
	std::stringstream ss;
	ss << " Incorrect characters: " << hangmanUsedCharacters << " (";
	ss << hangmanCurrentGuesses << "/" << hangmanMaxGuesses << ")";
	Send_Say(channel, ss.str());
	ConsoleMessage("Incorrect character chosen " + ss.str());
	Sleep(500);

	if (hangmanCurrentGuesses >= hangmanMaxGuesses)
	{
		std::string loser = message.substr(1, message.find_first_of("!") - 1);
		ConsoleMessage("The game is lost (lost by " + loser + ")");
		Send_Say(channel, "The poor dude is hanging from the gallows, courtesy of " + loser + "!");
		Hangman_NextWord();
	}
}
示例#11
0
int scriptFieldDecl_getRoutingOffset(struct ScriptFieldDecl* me)
{
 if (me == NULL) {
	ConsoleMessage ("call to scriptFieldDecl_getRoutingOffset made with NULL input");
	return INT_ID_UNDEFINED;
 }
 return fieldDecl_getShaderScriptIndex(me->fieldDecl);
}
示例#12
0
void IrcBot::Request_HangmanGame(const std::string &request)
{
	ConsoleMessage("HangmanGame START: ");

	if (hangmanWords.empty())
	{
		ConsoleMessage("HangmanGame - No words loaded, cant start game. ");
		Send_Say(channel, "Hangman game load failure. Cannot start.");
		return;
	}

	if (IrcBot::TryActivateGame(HANGMAN, "Hangman game starting! How to play: guess letters by typing single letters. Guess complete word by %word [guess] (without brackets)."))
	{
		Hangman_NextWord();

	}
}
示例#13
0
void IrcBot::Command_Say(const std::string &command)
{
	if (command.length() <= 0)
		return;
	std::string target = command.substr(0, command.find_first_of(' '));
	std::string message = command.substr(std::min<int>(command.find_first_of(target) + target.length() + 1, command.length()));
	if (message.length() <= 0)
	{
		ConsoleMessage("No message input. Usage: !say [#channel] [some message] (without brackets)");
		return;
	}
	std::string irc_message = "PRIVMSG " + target + " :" + message + "\r\n";
	ConsoleMessage("Sending: " + irc_message);
	Send(irc_message);
	//	Send("The current word: ____________________________________________");
	//Sleep(500);
}
示例#14
0
void IrcBot::Request_WordscrambleGame(const std::string &request)
{
	ConsoleMessage("WordscrambleGame START: ");

	if (hangmanWords.empty())
	{
		ConsoleMessage("WordscrambleGame - No words loaded, cant start game. ");
		Send_Say(channel, "Wordscramble game load failure. Cannot start.");
		return;
	}

	if (IrcBot::TryActivateGame(WORDSCRAMBLE, "Wordscramble game starting! How to play: guess what the scrambled word is by typing the correct word."))
	{
		Wordscramble_NextWord();

	}
}
示例#15
0
//---------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------
void CPropPhysics::Update( void )
{
	CBaseEntity::Update();
	if( this->GetOrigin().y < destroy_phys_ent_min_y ) {
		ConsoleMessage( "CPropPhysics#Update(): Destroying entity with model \"%s\" because it fell under the map", GetFilename().c_str() );
		Destroy();
	}
}
示例#16
0
文件: XLibrary.cpp 项目: xahgo/tama
void XLibrary::Console( LPCTSTR szMsg )
{
	if( XBREAK(m_bEntered) )		// 중복호출됨. 잘못된 호출
		return;
	m_bEntered = true;
	//
	ConsoleMessage( szMsg );		// virtual
	//
	m_bEntered = false;
}
示例#17
0
void IrcBot::Command_Custom(const std::string &command)
{
	if (command.length() <= 0)
		return;


	ConsoleMessage("Custom command: " + command);
	Send(command + "\r\n");
	//Sleep(500);
}
示例#18
0
void CSkyBox::LoadSkyTextures( const char *pSkyName )
{
	//store names
	if( !m_bSkyLoaded )
	{
		strcpy( m_pSkyName, pSkyName );
	}

	const char pchSkyAppends[6][4] = { "_px", "_nx", "_py", "_ny", "_pz", "_nz" };

	int texTargets[] = {
		GL_TEXTURE_CUBE_MAP_POSITIVE_X,
		GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
		GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
		GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
		GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
		GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
	};

	glGenTextures( 1, &m_iCubeMapTex );

	for( int i = 0; i < 6; i++ )
	{
		string skyFileName("textures/sky/");
		skyFileName += pSkyName;
		skyFileName += pchSkyAppends[i];
		skyFileName += ".dds";

		//Set clamping
		g_LoadingMutex->SetOrWait();

		//Load the cube map texture
		glBindTexture( GL_TEXTURE_2D, 0 );
		glEnable(GL_TEXTURE_CUBE_MAP);
		glBindTexture( GL_TEXTURE_CUBE_MAP, m_iCubeMapTex );
		texture_t tex;
		tex.index = m_iCubeMapTex;
		g_LoadingMutex->Release();
		ConsoleMessage("Loading sky-tex \"%s\"", skyFileName.c_str());
		if( !g_RenderInterf->GetTextureManager()->LoadImageFromFile( skyFileName.c_str(), m_iCubeMapTex, tex, texTargets[i], true, true ) )
			error("Error loading sky \"%s\", expect black sky.", pSkyName);
	}

	g_LoadingMutex->SetOrWait();
	glBindTexture( GL_TEXTURE_CUBE_MAP, m_iCubeMapTex );
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
	g_LoadingMutex->Release();

	m_bSkyLoaded = true;

	m_pShader = (CShaderUnlit*)GetShaderManager()->GetShader( "Unlit" );
	m_pShaderSky = (CShaderSky*)GetShaderManager()->GetShader( "Sky" );
}
示例#19
0
void IrcBot::HandlePing(const std::string &message)
{
	int pingIndex = message.find("PING");
	if (pingIndex != std::string::npos) // && pingIndex == 0)
	{
		int len = 11;
		ConsoleMessage("sending pong");
		std::string p = "PONG " + message.substr(pingIndex + 5, len) + "\r\n";
		Send(p);
	}
}
示例#20
0
void IrcBot::ConnectHandler(const boost::system::error_code &error)
{
	ConsoleMessage("connect handler");
	if (!error)
	{
		boost::asio::write(sock, buffer(pass));
		boost::asio::write(sock, buffer(nick));
		boost::asio::write(sock, buffer(user));
		sock.async_read_some(buffer(readBuffer), [this](boost::system::error_code ec, std::size_t bytesRead) { ReadHandler(ec, bytesRead); });
	}
}
示例#21
0
文件: Start.c 项目: att/uwin
int StartButtonUpdate(const char *title, int state)
{
#if 0
  if (title != NULL)
    ConsoleMessage("Updating StartTitle not supported yet...\n");
  ButtonUpdate(StartButton, title, state);
#else
  ButtonUpdate(StartButton, NULL, state);
#endif
  return StartButton->needsupdate;
}
示例#22
0
/* used to test new hits */



//struct X3D_Group *_rootNode=NULL;	/* scene graph root node */
struct X3D_Group *rootNode()
{
	// ConsoleMessage ("rootNode called");
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;	
if (p==NULL) {
	ConsoleMessage ("rootNode, p null");
	return NULL;
}


	return p->rootNode;
}
示例#23
0
struct Vector* newVector_(int elSize, int initSize,char *fi, int line) {
 	struct Vector* ret=MALLOC(struct Vector *, sizeof(struct Vector));
 	ASSERT(ret);
 	ret->n=0;
 	ret->allocn=initSize;
 	ret->data=MALLOC(void *, elSize*ret->allocn);
 	ASSERT(ret->data);
	#ifdef DEBUG_MALLOC
		ConsoleMessage ("vector, new  %x, data %x, size %d at %s:%d",ret, ret->data, initSize,fi,line);
	#endif
	
	return ret;
}
示例#24
0
int StartButtonUpdate(const char *title, int index, int state)
{
  int i=0;
  StartAndLaunchButtonItem *tempPtr = First_Start_Button;
#if 0
  if (title != NULL)
    ConsoleMessage("Updating StartTitle not supported yet...\n");
  if(index != -1)
  {
    for(i=0; i<index; i++)
      tempPtr = tempPtr->tail;
    ButtonUpdate(tempPtr->buttonItem, title, state);
  }
  else
    while(tempPtr != NULL)
    {
      ButtonUpdate(tempPtr->buttonItem, title, state);
      tempPtr = tempPtr->tail;
    }

#else

  if (!First_Start_Button)
  {
	  return 0;
  }

  if(index != -1)
  {
    for(i=0; i<index; i++)
      tempPtr = tempPtr->tail;
    ButtonUpdate(tempPtr->buttonItem, title, state);
  }
  else
    while(tempPtr != NULL)
    {
      ButtonUpdate(tempPtr->buttonItem, title, state);
      tempPtr = tempPtr->tail;
    }

#endif
  tempPtr = First_Start_Button;
  while(tempPtr != NULL)
  {
    if (tempPtr->buttonItem->needsupdate)
      return 1;
    tempPtr = tempPtr->tail;
  }
  return 0;
}
示例#25
0
void deleteVector_(char *file, int line, int elSize, struct Vector** myp) {
#else
void deleteVector_(int elSize, struct Vector** myp) {
#endif

	struct Vector *me = *myp;

	if (!me) {
		ConsoleMessage ("Vector - already empty");
		return;
	}

	ASSERT(me);
	#ifdef DEBUG_MALLOC
		ConsoleMessage ("vector, deleting me %x data %x at %s:%d\n",me,me->data,file,line);
	#endif
	if(me->data) {FREE_IF_NZ(me->data);}
	FREE_IF_NZ(me);
	*myp = NULL;
}

/* Ensures there's at least one space free. */
void vector_ensureSpace_(int elSize, struct Vector* me) {
	ASSERT(me);
	if(me->n==me->allocn) {
		if(me->allocn) me->allocn*=2;
		else me->allocn=1;

		me->data=REALLOC(me->data, elSize*me->allocn);
		#ifdef DEBUG_MALLOC
			printf ("vector, ensureSpace, me %x, data %x\n",me, me->data);
		#endif
		ASSERT(me->data);
	}
	ASSERT(me->n<me->allocn);
}
示例#26
0
bool IrcBot::TryActivateGame(IrcBot::GameTypes game, const std::string &gameStartMessage)
{
	if (activeGame == NONE)
	{
		activeGame = game;
		Send_Say(channel, gameStartMessage);
		return true;
	}
	else
	{
		ConsoleMessage("Request for start game while game already active.");
		Send_Say(channel, "A game is already active. Use %stopgame to stop the active game.");
		Sleep(500);
		return false;
	}
}
示例#27
0
void IrcBot::Wordscramble_NextWord()
{
	int r = rand();
	hangmanCurrentWordIndex = r % hangmanWords.size();
	hangmanCurrentWord = hangmanWords[hangmanCurrentWordIndex];
	std::transform(hangmanCurrentWord.begin(), hangmanCurrentWord.end(), hangmanCurrentWord.begin(), ::tolower);
	hangmanCurrentGuessedWord = hangmanCurrentWord;
	//std::transform(hangmanCurrentGuessedWord.begin(), hangmanCurrentGuessedWord.end(), hangmanCurrentGuessedWord.begin(), ::tolower);
	std::random_shuffle(hangmanCurrentGuessedWord.begin(), hangmanCurrentGuessedWord.end());


	
	ConsoleMessage("wordscramblegame current word: " + hangmanCurrentWord);
	Send_Say(channel, hangmanCurrentGuessedWord);
	Sleep(500);
}
示例#28
0
void IrcBot::Send(const std::string &message)
{
	//writeBuffer = message.data();
	for (int i = 0; i < message.size(); i++)
	{
		wbuf[i] = message[i];
	}
	try
	{
		async_write(sock, buffer(wbuf, message.size() * sizeof(char)), [this](boost::system::error_code ec, std::size_t bytesWritten) { WriteHandler(ec, bytesWritten); });
	}
	catch (boost::system::system_error writeError)
	{
		ConsoleMessage("Error encountered while sending/writing.");
	}
}
示例#29
0
void IrcBot::Hangman_NextWord()
{
	hangmanCurrentWordIndex = rand() % hangmanWords.size();
	hangmanCurrentWord = hangmanWords[hangmanCurrentWordIndex];
	hangmanCurrentGuessedWord = "";
	hangmanUsedCharacters = "";
	hangmanCurrentGuesses = 0;

	for (std::string::iterator it = hangmanCurrentWord.begin(); it != hangmanCurrentWord.end(); ++it)
	{
		if (*it != ' ')
			hangmanCurrentGuessedWord += "_ ";
		else
			hangmanCurrentGuessedWord += "  ";
	}

	ConsoleMessage("hangmangame current word: " + hangmanCurrentWord);
	Send_Say(channel, "The current word: " + hangmanCurrentGuessedWord);
	Sleep(500);
	//	Command_Say(channel + " Incorrect characters: " + hangmanUsedCharacters);
}
示例#30
0
文件: XLibrary.cpp 项目: xahgo/tama
void XLibrary::Consolef( LPCTSTR szFormat, ... ) 
{
	if( XBREAK( m_bEntered ) )		// 중복호출됨. 잘못된 호출
		return;
	m_bEntered = true;
//	XLOCK_OBJ;
// 	_XNoRecursiveStack _nrStack( &_m_nrInstance );
// 	// ConsoleMessage내부에서 재호출을 금지시킴
// 	if( _nrStack.IsLock() == TRUE ) {
// 		XBREAK_POINT();		// 재호출은 이제 완전 금지라서 브레이크 걸어둠.
// 		return;
// 	}
// 	XBREAK( _nrStack.IsLock() == TRUE );	
// 	_nrStack.Lock();
	//
	TCHAR buff[1024*10];
	va_list	vl;
	va_start(vl, szFormat);

	_vstprintf_s(buff, szFormat, vl);
	va_end(vl);
	ConsoleMessage( buff );		// virtual
	m_bEntered = false;
}