Exemple #1
0
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;
}
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));
}
int USBPersonManagerComponent::GenerateRandomPerson()
{
	int id = GetFreeID();

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

	return id;
}
Exemple #4
0
	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;
	}
Exemple #5
0
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);
}
Exemple #6
0
	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;
	}
Exemple #7
0
void ZoneGuildManager::AddGuildApproval(const char* guildname,Client* owner)
{
	GuildApproval* tmp = new GuildApproval(guildname,owner,GetFreeID());
	list.Insert(tmp);
}