Beispiel #1
0
inline std::tr1::unordered_set<T>& operator>> (object o, std::tr1::unordered_set<T>& v)
{
	if(o.type != type::ARRAY) { throw type_error(); }
	object* p = o.via.array.ptr + o.via.array.size;
	object* const pbegin = o.via.array.ptr;
	while(p > pbegin) {
		--p;
		v.insert(p->as<T>());
	}
	return v;
}
void QuadTreeNode::GetOccupants(std::tr1::unordered_set<QuadTreeOccupant*> &upperOccupants, QuadTreeNode* newNode)
{
	// Assign the new node pointers while adding the occupants to the upper node
	for(std::tr1::unordered_set<QuadTreeOccupant*>::iterator it = occupants.begin(); it != occupants.end(); it++)
	{
		(*it)->pQuadTreeNode = newNode;
		upperOccupants.insert(*it);
	}

	// Recusively go through children if there are any
	if(hasChildren)
		for(unsigned int x = 0; x < 2; x++)
			for(unsigned int y = 0; y < 2; y++)
				children[x][y]->GetOccupants(upperOccupants, newNode);
}
Beispiel #3
0
// Mod Loader Implementation
bool conLoadMod(Linker::SimObject *obj,S32 argc, const char* argv[])
{
		typedef void (*LPMODINIT)(void);
		HINSTANCE hDLL = NULL;
		LPMODINIT lpInitMod = NULL;

		std::string raw = "mods\\";
		raw += argv[1];
		raw += ".dll";

		std::wstring modification(raw.begin(), raw.end());

		hDLL = LoadLibrary(modification.c_str());
		if (hDLL == NULL)
		{
			Con::errorf(0, "loadMod(): Failed to load DLL '%s'. Does it exist in GameData\\mods? (%u)", raw.c_str(), GetLastError());
			return false; // The DLL doesn't exist
		}
		
		lpInitMod = (LPMODINIT)GetProcAddress(hDLL, "ModInitialize"); // Attempt to load our entry point

		if (lpInitMod == NULL)
		{
			Con::errorf(0, "loadMod(): Failed to locate entry point 'ModInitialize' in mod DLL '%s'. Is it a good mod DLL? (%u)", raw.c_str(), GetLastError());
			return false; // Unable to load entry point
		}

		lpInitMod();
		Con::errorf(0, "loadMod(): Loaded and executed entry point code for mod DLL '%s'", raw.c_str());

		// Check if there's a server process responder in this DLL
		ServerProcessPointer serverProcess = (ServerProcessPointer)GetProcAddress(hDLL, "ServerProcess"); // Attempt to load our entry point

		if (serverProcess != NULL)
		{
			sServerProcessResponders.insert(sServerProcessResponders.end(), serverProcess);
			Con::errorf(0, "loadMod(): Added server process responder for mod");
		}

		return true;
}