summaryrefslogtreecommitdiff
path: root/server.cpp
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-07-03 15:31:06 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-07-03 15:31:06 +0200
commitc24d988742997af9e4689e0836a6073cdd302c1f (patch)
tree1327de6e00fb2dcc4156a85896393b1e7c668714 /server.cpp
parent7add4dd07e17c5a6ba0a2a1d9700d72055b812ae (diff)
Generate trees.HEADmaster
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)