Gameserver - Merged with Gamelogic

This commit is contained in:
Dennis Andersen 2014-01-14 10:29:39 +01:00
commit 87b8c0c7bb
4 changed files with 10 additions and 8 deletions

View File

@ -70,7 +70,6 @@ namespace DanBias
Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj;
protocolData->object_ID = p[1].value.netInt;
char k = p[2].value.netChar;
protocolData->path = p[2].value.netCharPtr;
for(int i = 0; i< 16; i++)
{

View File

@ -66,6 +66,8 @@ bool GameState::LoadModels(std::wstring mapFile)
ModelInitData modelData;
modelData.world = Oyster::Math3D::Float4x4::identity;
Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,-2,-2));
modelData.world = modelData.world * translate;
modelData.visible = true;
modelData.modelPath = L"..\\Content\\worldDummy";
modelData.id = 0;
@ -74,7 +76,7 @@ bool GameState::LoadModels(std::wstring mapFile)
privData->object.push_back(obj);
privData->object[privData->object.size() -1 ]->Init(modelData);
Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,2,2));
translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-2,2,2));
modelData.world = modelData.world * translate;
modelData.modelPath = L"..\\Content\\worldDummy";
modelData.id ++;
@ -262,21 +264,21 @@ void GameState::Protocol( ObjPos* pos )
}
}
void GameState::Protocol( NewObj* pos )
void GameState::Protocol( NewObj* newObj )
{
Oyster::Math::Float4x4 world;
for(int i = 0; i<16; i++)
{
world[i] = pos->worldPos[i];
world[i] = newObj->worldPos[i];
}
ModelInitData modelData;
modelData.world = world;
modelData.visible = true;
modelData.id = pos->object_ID;
modelData.id = newObj->object_ID;
//not sure if this is good parsing rom char* to wstring
const char* path = pos->path;
const char* path = newObj->path;
modelData.modelPath = std::wstring(path, path + strlen(path));
// load models
C_Object* player = new C_Player();

View File

@ -34,8 +34,9 @@ namespace GameLogic
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Int;
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
for (int i = 2; i <= 17; i++)
for (int i = 3; i <= 18; i++)
{
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
}

View File

@ -22,10 +22,10 @@ struct CustomNetProtocol::PrivateData
size_t size = strlen(i->second.value.netCharPtr);
if(size == 0) continue;
attributes[i->first];
attributes[i->first].value.netCharPtr = new char[size + 1];
//strcpy_s(attributes[i->first].value.netCharPtr, size + 1, i->second.value.netCharPtr);
memcpy(&attributes[i->first].value.netCharPtr[0], &i->second.value.netCharPtr[0], size + 1);
attributes[i->first].type = NetAttributeType_CharArray;
}
else
{