Untitled

 avatar
unknown
plain_text
7 months ago
1.8 kB
5
Indexable


#include "Action.h"
#include "../../Utils/Parser.h"
#include "../../World/WorldPool.h"
#include <fmt/core.h>
namespace gserver::actions
{
	void join_request(EventContext evt)
	{
		std::shared_ptr<Player> player{ evt.m_player };

		rtvar var = rtvar::parse(evt.cch);

		size_t start_pos = 0;
		while ((start_pos = evt.cch.find("\n", start_pos)) != std::string::npos) evt.cch.replace(start_pos, 1, "|"), start_pos += 1;

		std::string world_name = var.get("name");
		fmt::print("Join requested to WORLD:{}", world_name);
	
		std::shared_ptr<World> world{ evt.m_worldpool->get_world(world_name) };

		if (!world) world = evt.m_worldpool->new_world(world_name);
		world->send_data(player);

		//const auto& spawn_pos{ world->get_tile_pos(6) };
		//player->set_world(world_name);
		//player->set_net_id(world->add_player(player));
		//player->set_position(spawn_pos.x, spawn_pos.y);
	}
}


1>JoinRequest.obj : error LNK2001: unresolved external symbol "public: class std::shared_ptr<class gserver::World> __cdecl gserver::WorldPool::get_world(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?get_world@WorldPool@gserver@@QEAA?AV?$shared_ptr@VWorld@gserver@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z)
1>JoinRequest.obj : error LNK2001: unresolved external symbol "public: class std::shared_ptr<class gserver::World> __cdecl gserver::WorldPool::new_world(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?new_world@WorldPool@gserver@@QEAA?AV?$shared_ptr@VWorld@gserver@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z)
1>C:\Users\Administrator\Desktop\x\\x64\Server\GrowServer.exe : fatal error LNK1120: 2 unresolved externals
Editor is loading...
Leave a Comment