コード例 #1
0
ファイル: drive_cache.cpp プロジェクト: raedwulf/dosbox
bool DOS_Drive_Cache::OpenDir(CFileInfo* dir, const char* expand, Bit16u& id) {
	id = GetFreeID(dir);
	dirSearch[id] = dir;
	char expandcopy [CROSS_LEN];
	strcpy(expandcopy,expand);   
	// Add "/"
	char end[2]={CROSS_FILESPLIT,0};
	if (expandcopy[strlen(expandcopy)-1]!=CROSS_FILESPLIT) strcat(expandcopy,end);
	// open dir
	if (dirSearch[id]) {
		// open dir
		dir_information* dirp = open_directory(expandcopy);
		if (dirp) { 
			// Reset it..
			close_directory(dirp);
			strcpy(dirPath,expandcopy);
			return true;
		}
		if (dirSearch[id]) {
			dirSearch[id]->id = MAX_OPENDIRS;
			dirSearch[id] = 0;
		}
	};
	return false;
}
コード例 #2
0
void CPlayerRealm::Add(NetObject* object, ENetPeer* peer)
{
	object->m_RealmID = GetFreeID();
	object->m_pPeer = peer;

	uint32_t new_ID;
	new_ID = object->m_RealmID;

	m_PlayerList[new_ID] = std::move(std::unique_ptr<NetObject>(object));
}
コード例 #3
0
int USBPersonManagerComponent::GenerateRandomPerson()
{
	int id = GetFreeID();

	FSBPerson person;
	person.ID = id;
	person.Hunger = FMath::RandRange(0, 10);
	
	Persons.Add(id, person);

	return id;
}
コード例 #4
0
ファイル: ffs_instance.cpp プロジェクト: JustSid/Firedrake
	KernReturn<void> Instance::Mount(__unused VFS::Context *context, VFS::Instance *instance, VFS::Directory *target, const char *name)
	{
		VFS::Mountpoint *mountpoint = VFS::Mountpoint::Alloc()->Init(name, instance, this, GetFreeID());
		if(!mountpoint)
			return Error(KERN_NO_MEMORY);

		target->Lock();
		KernReturn<void> result = target->AttachNode(mountpoint);
		target->Unlock();

		return result;
	}
コード例 #5
0
ファイル: vehicles.cpp プロジェクト: donce/city-simulator
void vehicles::Add(int vMNr, int bL[2])
{
	vehicle *vNow;
	vNow = new vehicle;

	int id = GetFreeID();

	vNow->Init(id, c, this, &vM.vM[vMNr], bL);

	if (id >= v.size()) 
	{
		v.push_back(*vNow);
	}
	else
	{
		v[id] = *vNow;//already created
	}

	idL.push_back(id);
}
コード例 #6
0
ファイル: ffs_instance.cpp プロジェクト: JustSid/Firedrake
	KernReturn<VFS::Node *> Instance::CreateDirectory(__unused VFS::Context *context, VFS::Node *parent, const char *name)
	{
		VFS::Node *node = VFS::Directory::Alloc()->Init(name, this, GetFreeID());

		if(node && parent)
		{
			VFS::Directory *directory = static_cast<VFS::Directory *>(parent);
			directory->Lock();
			KernReturn<void> result = directory->AttachNode(node);
			directory->Unlock();

			if(!result.IsValid())
			{
				node->Release();
				return result.GetError();
			}
		}

		if(!node)
			return Error(KERN_NO_MEMORY);

		return node;
	}
コード例 #7
0
ファイル: guild_mgr.cpp プロジェクト: jcon321/Server
void ZoneGuildManager::AddGuildApproval(const char* guildname,Client* owner)
{
	GuildApproval* tmp = new GuildApproval(guildname,owner,GetFreeID());
	list.Insert(tmp);
}