Beispiel #1
0
void SendNetCommandOrNotification( SOCK ss, NetMessageType type, NetMessageCategory cat )
{ NetMessage msg;
	if( ss != NULLSOCKET ){
		msg.flags.type = type;
		msg.flags.category = cat;
		SendMessageToNet( ss, &msg, SENDTIMEOUT, FALSE, "SendNetCommandOrNotification" );
	}
}
Beispiel #2
0
//----------------------------------------------------------------------------
void DataBaseEngine::SendNpcInfo(int machineID, int mapID) 
{
	std::vector<EngineEvent> l = mDataBase->NPCInfo(mapID);

	for (std::vector<EngineEvent>::iterator it = l.begin(); 
		it != l.end(); ++it) 
	{
		it->miData["ID"] = machineID;
		SendMessageToNet(*it);
	}
}
Beispiel #3
0
void SendNetErrorNotification( SOCK ss, const char *txt, ErrCode err )
{ NetMessage msg;
	if( ss != NULLSOCKET ){
		MSGINIT( (&msg), Err, Notification );
		if( *txt ){
			strncpy( msg.data.URN, txt, sizeof(msg.data.URN) );
			msg.data.URN[sizeof(msg.data.URN)-1] = '\0';
		}
		msg.data.error = err;
		SendMessageToNet( ss, &msg, SENDTIMEOUT, FALSE, "SendNetErrorNotification" );
	}
}
Beispiel #4
0
//----------------------------------------------------------------------------
void DataBaseEngine::ProcessNpcProp(const EngineEvent &ent)
{
	EngineEvent e;
	std::map<std::string, int>::const_iterator npcID = 
		ent.miData.find("NPC_ID_REQ");
	std::map<std::string, int>::const_iterator id = ent.miData.find("ID");

	assert(npcID != ent.miData.end() && id != ent.miData.end());

	NPC n = GetNPCByID(npcID->second);
	
	std::ostringstream archiveStream;
	boost::archive::text_oarchive archive(archiveStream);
	archive << n;
	const std::string &s = archiveStream.str();
	e.mType = EngineEvent::NPC_PROP;
	e.msData["NPC_PROP"] = s;
	e.miData["ID"] = id->second;
	e.miData["NPC_ID"] = n.GetID();

	SendMessageToNet(e);
}