Exemplo n.º 1
0
// Prints a message to a given node.
void GameNode::print(char* szText, short nColor, short nNewlines, short nType)
{
   OutputData odMessage;
   char szBuffer[250];
   
   // Need to convert szText to an output message.
   odMessage.szMessage[0] = '\0';
   if ( szText != NULL )
      {
      if ( strlen(szText) >= 200 - 2*nNewlines )
         szText[199 - 2*nNewlines] = '\0';
      strcpy(odMessage.szMessage, szText);
      }

   // Add the specified number of newlines (1 by default)
   for ( short n = 0; n < nNewlines; n++ )
      {
      strcat(odMessage.szMessage, "\r\n");
      }

   // Set the message color, type, and player stat info
   odMessage.nColor = nColor;
   odMessage.nType = nType;
   fillStats(&odMessage);
  
   // Send the message to the slot, after converting it to a string.
   sendToSlot(hOutputSlot, odMessage.toString(szBuffer));
}