Loading...   


void handle_rc_get_initial_entity_positions(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> &params) {
	std::string error;
	std::map<std::string, std::string> res;

	std::list<NPC*> npc_list;
	entity_list.GetNPCList(npc_list);
	for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
		NPC* npc = *itr;
		res["ent_id"] = std::to_string((long)npc->GetID());
		res["race_id"] = std::to_string((long)npc->GetRace());
		res["class_id"] = std::to_string((long)npc->GetClass()); 
		res["type"] = "NPC";
		res["name"] = npc->GetCleanName();
		res["x"] = std::to_string((double)npc->GetX());
		res["y"] = std::to_string((double)npc->GetY());
		res["z"] = std::to_string((double)npc->GetZ());
		res["h"] = std::to_string((double)npc->GetHeading());
		RemoteCallResponse(connection_id, request_id, res, error);
	}
	std::list<Client*> client_list;
	entity_list.GetClientList(client_list);
	for (std::list<Client*>::iterator itr = client_list.begin(); itr != client_list.end(); ++itr) {
		Client* c = *itr;
		res["ent_id"] = itoa(c->GetID());
		res["race_id"] = std::to_string((long)c->GetRace());
		res["class_id"] = std::to_string((long)c->GetClass());
		res["type"] = "Client";
		res["name"] = c->GetCleanName(); 
		res["x"] = itoa(c->GetX());
		res["y"] = itoa(c->GetY());
		res["z"] = itoa(c->GetZ());
		res["h"] = itoa(c->GetHeading());
		RemoteCallResponse(connection_id, request_id, res, error); 
	}
	std::list<Corpse*> corpse_list;
	entity_list.GetCorpseList(corpse_list);
	for (std::list<Corpse*>::iterator itr = corpse_list.begin(); itr != corpse_list.end(); ++itr) {
		Corpse* c = *itr;
		res["ent_id"] = itoa(c->GetID());
		res["race_id"] = std::to_string((long)c->GetRace());
		res["class_id"] = std::to_string((long)c->GetClass());
		res["type"] = "Corpse";
		res["name"] = c->GetCleanName();
		res["x"] = itoa(c->GetX());
		res["y"] = itoa(c->GetY());
		res["z"] = itoa(c->GetZ());
		res["h"] = itoa(c->GetHeading());
		RemoteCallResponse(connection_id, request_id, res, error);
	}
	// std::list<Doors*> door_list;
	// entity_list.GetDoorsList(door_list);
	// std::list<Doors*>::iterator iter = door_list.begin(); 
	// while (iter != door_list.end()) {
	// 	Doors *c = (*iter);
	// 	res["ent_id"] = itoa(c->GetID());
	// 	res["type"] = "Door";
	// 	res["x"] = itoa(c->GetX());
	// 	res["y"] = itoa(c->GetY());
	// 	res["z"] = itoa(c->GetZ());
	// 	res["h"] = itoa(c->GetHeading());
	// 	RemoteCallResponse(connection_id, request_id, res, error);
	// }
}

Raw Paste Data