# Updates to construction: Added a start construction net message and made the selected units start working on a newly placed building after you place it.

This was SVN commit r3845.
This commit is contained in:
Matei
2006-05-04 07:40:31 +00:00
parent ccafa5204e
commit 2a2d115f4d
10 changed files with 88 additions and 3 deletions
+24
View File
@@ -331,6 +331,30 @@ uint CSimulation::TranslateMessage(CNetMessage* pMsg, uint clientMask, void* UNU
case NMT_NotifyRequest:
ENTITY_ENTITY_INT(CNotifyRequest, ORDER_NOTIFY_REQUEST);
break;
case NMT_PlaceObject:
{
CPlaceObject *msg = (CPlaceObject *) pMsg;
// Create the object
CVector3D pos(msg->m_X/1000.0f, msg->m_Y/1000.0f, msg->m_Z/1000.0f);
HEntity newObj = g_EntityManager.createFoundation( msg->m_Template, pos, msg->m_Angle/1000.0f );
if(msg->m_Entities.size() > 0)
{
newObj->SetPlayer(msg->m_Entities[0]->GetPlayer());
}
else
{
// Object might have been placed from the console just for testing
newObj->SetPlayer(g_Game->GetLocalPlayer());
}
// Order all the selected units to work on the new object using the given action
order.m_type = CEntityOrder::ORDER_START_CONSTRUCTION;
order.m_data[0].entity = newObj;
QueueOrder(order, msg->m_Entities, false);
} while(0)
break;
}