summaryrefslogtreecommitdiff
path: root/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server.cpp')
-rw-r--r--server.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/server.cpp b/server.cpp
index 891708c..e532eb0 100644
--- a/server.cpp
+++ b/server.cpp
@@ -106,6 +106,7 @@ void Server::handle_pos(Connection::p c) {
m.recv(c->socket);
c->pos = m.get_pos();
+ TerrainGenerator::p tg = boost::static_pointer_cast<TerrainGenerator>(cache->tl);
std::set<std::pair<int64_t, int64_t> > chunks = c->check_chunks();
for(std::set<std::pair<int64_t, int64_t> >::iterator it = chunks.begin(); it != chunks.end(); it++) {
// TODO: fix sizes
@@ -113,6 +114,12 @@ void Server::handle_pos(Connection::p c) {
message::Chunk chunk(it->first, it->second);
chunk.set_data(obj->heights);
chunk.send(c->socket);
+
+ std::list<Vector3> trees = tg->get_objects(it->first, it->second, 35, 35);
+ for(std::list<Vector3>::iterator it = trees.begin(); it != trees.end(); it++) {
+ message::Object tree(0, *it);
+ tree.send(c->socket);
+ }
}
for(std::list<Connection::p>::iterator it = clients.begin(); it != clients.end(); it++) {
if(*it == c)