Esempio n. 1
0
BOOL DUI_RadioGroup::Create(DUI_Window * Window)
{
	m_ID = NewID();
	m_Parent = Window;
	m_bVisialbe = FALSE;
	m_IDs = new vector<INT>;

	Window->m_Controls->push_back(this);
	return TRUE;
}
Esempio n. 2
0
UInt32 FModSound::addChannel(FMOD::Channel* channel)
{
    
    FMOD_RESULT result;
    result = channel->setCallback(FModSoundChannelCallback);
    FMOD_ERRCHECK(result,"FModSound::addChannel()");
    result = channel->setUserData(this);
    FMOD_ERRCHECK(result,"FModSound::addChannel()");

    UInt32 NewID(generateChannelID());
    _ChannelMap[NewID] = channel;
    return NewID;
}
Esempio n. 3
0
	virtual const char* OnRequest(Request* request)
	{
		if(strcmp(SQLREQID, request->GetId()) == 0)
		{
			SQLrequest* req = (SQLrequest*)request;
			ConnMap::iterator iter;
			if((iter = connections.find(req->dbid)) != connections.end())
			{
				req->id = NewID();
				req->error = iter->second->Query(*req);
				return SQLSUCCESS;
			}
			else
			{
				req->error.Id(SQL_BAD_DBID);
				return NULL;
			}
		}
		return NULL;
	}
	// Spawns a new particle if the time is right
	bool SpawnParticle(
		double time,
		Vec3f& position,
		Vec3f& direction,
		float& age,
		int& id
	)
	{
		float new_age = time - spawn_time - spawn_interval;
		if(new_age >= 0.0f)
		{
			spawn_time += spawn_interval;
			direction = NewDirection();
			Vec3f emitter_pos = path.Position(spawn_time/cycle_time);
			position = emitter_pos + direction;
			age = new_age;
			id = NewID();
			return true;
		}
		return false;
	}
Esempio n. 5
0
	virtual const char* OnRequest(Request* request)
	{
		if(strcmp(SQLREQID, request->GetId()) == 0)
		{
			SQLrequest* req = (SQLrequest*)request;
			ConnMap::iterator iter;
			if((iter = connections.find(req->dbid)) != connections.end())
			{
				/* Execute query */
				req->id = NewID();
				req->error = iter->second->Query(*req);

				return (req->error.Id() == SQL_NO_ERROR) ? sqlsuccess : NULL;
			}
			else
			{
				req->error.Id(SQL_BAD_DBID);
				return NULL;
			}
		}
		return NULL;
	}
Esempio n. 6
0
//---------------------------------------------------------------------------
// CROFFSystem::Cache
//	Pre-caches roff data to avoid file hits during gameplay.  Disallows
//		repeated caches of existing roffs.
//
// INPUTS:
//	pass in the filepath of the roff to cache
//
// RETURN:
//	returns ID of the roff, whether its an existing one or new one.
//---------------------------------------------------------------------------
int CROFFSystem::Cache( const char *file, qboolean isClient )
{
	// See if this item is already cached
	int				len;
	int				id = GetID( file );
	unsigned char	*data;	
	CROFF			*cROFF;

	if ( id )
	{
#ifdef _DEBUG
		Com_Printf( S_COLOR_YELLOW"Ignoring. File '%s' already cached.\n", file );
#endif
	}
	else
	{ // Read the file in one fell swoop
		len = FS_ReadFile( file, (void**) &data);

		if ( len <= 0 )
		{
			char otherPath[1024];
			COM_StripExtension(file, otherPath, sizeof( otherPath ));
			len = FS_ReadFile( va("scripts/%s.rof", otherPath), (void**) &data);
			if (len <= 0)
			{
				Com_Printf( S_COLOR_RED"Could not open .ROF file '%s'\n", file );
				return 0;
			}
		}

		// Make sure that the file is roff
		if ( !IsROFF( data ) )
		{
			Com_Printf( S_COLOR_RED"cache failed: roff <%s> does not exist or is not a valid roff\n", file );
			FS_FreeFile( data );

			return 0;
		}

		// Things are looking good so far, so create a new CROFF object
		id = NewID();

		cROFF = new CROFF( file, id );
	
		mROFFList[id] = cROFF;

		if ( !InitROFF( data, cROFF ) )
		{ // something failed, so get rid of the object
			Unload( id );
			id = 0;
		}

		FS_FreeFile( data );
	}

	cROFF = (*mROFFList.find( id )).second;
	if (isClient)
	{
		cROFF->mUsedByClient = qtrue;
	}
	else
	{
		cROFF->mUsedByServer = qtrue;
	}

	// If we haven't requested a new ID, we'll just be returning the ID of the existing roff
	return id;
}
Esempio n. 7
0
CFlexWnd::CFlexWnd() : m_nID(NewID()),
	m_hWnd(m_privhWnd), m_privhWnd(NULL), m_hRenderInto(NULL),
	m_bIsDialog(FALSE),	m_bRender(FALSE),
	m_bReadOnly(FALSE)
{
}