Commit 66340775 authored by Alexey Hohlov's avatar Alexey Hohlov
Browse files

Помещать созданные статики не в общий список а размещать их по ячейкам.

parent aa1d1c72
......@@ -18,10 +18,15 @@ IObjectBase* CFabric::CreateObject(string id)
IObjectBase* CFabric::CreateStatic(string id, CVector pos)
{
if (IObjectStatic* obj = (IObjectStatic*)CreateObject(id))
{
uint32_t cx, cy;
if (IObjectStatic* obj = (IObjectStatic*)CreateObject(id)) {
cx = uint32_t(pos.x) / 128;
cy = uint32_t(pos.y) / 128;
obj->pos(pos);
map->statics.push_back(obj);
map->cells[cx][cy].statics.push_back(obj);
return obj;
}
return NULL;
......@@ -30,8 +35,8 @@ IObjectBase* CFabric::CreateStatic(string id, CVector pos)
IObjectBase* CFabric::CreateDynamic(string id, CVector pos)
{
if (IObjectDynamic* obj = (IObjectDynamic*)CreateObject(id)) {
map->dynamics.push_back(obj);
obj->pos(pos);
map->dynamics.push_back(obj);
return obj;
}
return NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment