diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 5d1a95ec..6fed6ec2 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -46,7 +46,7 @@ using namespace GameLogic; break; case ObjectSpecialType::ObjectSpecialType_CrystalFormation: - PlayerVLethalObject(*player,*realObj, kineticEnergyLoss,realObj->getExtraDamageOnCollision()); + PlayerVLethalObject(*player,*realObj, kineticEnergyLoss,realObj->GetExtraDamageOnCollision()); //player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING; break; } @@ -181,7 +181,7 @@ using namespace GameLogic; } } - Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) + Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultOnCollision(Oyster::Physics::ICustomBody *rigidBodyObject, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) { return Physics::ICustomBody::SubscriptMessage_none; } diff --git a/Code/Game/GameLogic/Game.cpp b/Code/Game/GameLogic/Game.cpp index ba294349..8b77dea4 100644 --- a/Code/Game/GameLogic/Game.cpp +++ b/Code/Game/GameLogic/Game.cpp @@ -68,12 +68,33 @@ void Game::GetAllPlayerPositions() const Game::PlayerData* Game::CreatePlayer() { // Find a free space in array or insert at end - int i = InsertObject(this->players, (PlayerData*)0); + int insert = InsertObject(this->players, (PlayerData*)0); + int freeID = 0; + bool found = false; - this->players[i] = new PlayerData(); - this->players[i]->player->GetRigidBody()->SetSubscription(Game::PhysicsOnMove); + for(int i = 0; i < 100; i++) + { + found = true; + freeID = i; - return this->players[i]; + for(int j = 0; j < players.Size(); j++) + { + + if(this->players[j] && this->players[j]->GetID() == freeID) + { + found = false; + } + + if(!found) break; + } + + if(found) break; + } + + this->players[insert] = new PlayerData(freeID, 0); // user constructor with objectID and teamID + this->players[insert]->player->GetRigidBody()->SetSubscription(Game::PhysicsOnMove); + + return this->players[insert]; } Game::LevelData* Game::CreateLevel(const wchar_t mapName[255]) @@ -95,21 +116,15 @@ bool Game::NewFrame() { for (unsigned int i = 0; i < this->players.Size(); i++) { - if(this->players[i]->player) this->players[i]->player->BeginFrame(); + if(this->players[i] && this->players[i]->player) this->players[i]->player->BeginFrame(); } API::Instance().UpdateWorld(); for (unsigned int i = 0; i < this->players.Size(); i++) { - if(this->players[i]->player) this->players[i]->player->EndFrame(); - gameInstance.onMoveFnc(this->players[i]); + if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame(); } - for (unsigned int i = 0; i < this->level->level->dynamicObjects.Size(); i++) - { - gameInstance.onMoveFnc(this->level->level->dynamicObjects[i]); - } - return true; } diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index f403c04c..ca0746e8 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -21,13 +21,23 @@ Game::PlayerData::PlayerData() rigidBody->SetAngularFactor(0.0f); //create player with this rigid body this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,0,0); - - //this->player->GetRigidBody()->SetCustomTag(this); - player->EndFrame(); } Game::PlayerData::PlayerData(int playerID,int teamID) { - this->player = new Player(); + Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(50,130,0); + + Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,2.0f,0.5f); + Oyster::Math::Float mass = 60; + Oyster::Math::Float restitutionCoeff = 0.5f; + Oyster::Math::Float frictionCoeff_Static = 0.4f; + Oyster::Math::Float frictionCoeff_Dynamic = 0.3f; + //sbDesc.quaternion = Oyster::Math::Float3(0, Oyster::Math::pi, 0); + + //create rigid body + Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f ); + rigidBody->SetAngularFactor(0.0f); + //create player with this rigid body + this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,playerID,teamID); } Game::PlayerData::~PlayerData() { diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index a5d42657..85d82c68 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -26,14 +26,14 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) { case ObjectSpecialType_None: { - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_Sky: { float skySize = ((SkyAttributes*)obj)->skySize; - //gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + //gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_World: @@ -44,21 +44,21 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) float worldSize = ((WorldAttributes*)obj)->worldSize; float atmosphereSize = ((WorldAttributes*)obj)->atmoSphereSize; - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_Building: { - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } case ObjectSpecialType_Stone: { - gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_StandardBox: { - gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_RedExplosiveBox: @@ -75,24 +75,24 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) // break; case ObjectSpecialType_SpikeBox: { - gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_Spike: { - gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_CrystalFormation: { int dmg = 50; //gameObj = new Crystal(rigidBody); - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_CrystalShard: { - gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new DynamicObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; case ObjectSpecialType_JumpPad: @@ -122,12 +122,12 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) break; case ObjectSpecialType_Generic: { - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; default: { - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID); + gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objID); } break; } @@ -357,14 +357,14 @@ bool Level::InitiateLevel(float radius) { rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(0.0f, 605.0f + i*5.0f, 10.0f), 5.0f, 0.5f, 0.8f, 0.6f); - this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox, Object::DefaultCollisionAfter, ObjectSpecialType_StandardBox, idCount++)); + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox, Object::DefaultOnCollision, ObjectSpecialType_StandardBox, idCount++)); } /*offset += nrOfBoxex; for(int i =0; i< nrOfBoxex; i ++) { rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0,5, -605 -( i*5)), 5); - this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultOnCollision, OBJECT_TYPE::OBJECT_TYPE_BOX)); rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]); } @@ -373,7 +373,7 @@ bool Level::InitiateLevel(float radius) { rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(200, 620 + ( i*7), 0), 5); - this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultOnCollision, OBJECT_TYPE::OBJECT_TYPE_BOX)); rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i+offset]); } offset += nrOfBoxex; @@ -381,18 +381,18 @@ bool Level::InitiateLevel(float radius) { rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(5, 605 + i*5, 0), 5); - this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX)); + this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultOnCollision, OBJECT_TYPE::OBJECT_TYPE_BOX)); rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i]); }*/ // add crystal ICustomBody* rigidBody_Crystal = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(10.0f, 605.0f, 0.0f), 5.0f, 0.5f, 0.8f, 0.6f); - this->dynamicObjects.Push(new DynamicObject(rigidBody_Crystal, Object::DefaultCollisionAfter, ObjectSpecialType_StandardBox, idCount++)); + this->dynamicObjects.Push(new DynamicObject(rigidBody_Crystal, Object::DefaultOnCollision, ObjectSpecialType_StandardBox, idCount++)); // add house ICustomBody* rigidBody_House =API::Instance().AddCollisionBox(Oyster::Math::Float3(20.0f, 20.0f, 20.0f), Oyster::Math::Float4(0.0f, 0.0f, 0.0f, 1.0f), Oyster::Math::Float3(-50.0f, 590.0f, 0.0f), 0.0f, 0.5f, 0.8f, 0.6f); - this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultCollisionAfter, ObjectSpecialType_Generic, idCount++)); + this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultOnCollision, ObjectSpecialType_Generic, idCount++)); // add jumppad diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index 751dc454..1f43263b 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -15,11 +15,11 @@ const Game *Object::gameInstance = (Game*)(&Game::Instance()); Object::Object() { - this->rigidBody = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.0f, 0.0f, 0.0f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 0, 0), 0, 0.5f, 0.8f, 0.6f); this->type = ObjectSpecialType_Unknown; this->objectID = -1; + this->scale = Float3(1.0f, 1.0f, 1.0f); } Object::Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID) @@ -48,39 +48,12 @@ Object::~Object(void) } -ObjectSpecialType Object::GetObjectType() const + +void Object::SetOnCollision(OnCollisionCallback func) { - return this->type; -} -int Object::GetID() const -{ - return this->objectID; + this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(func)); } -Oyster::Physics::ICustomBody* Object::GetRigidBody() -{ - return this->rigidBody; -} - - -void Object::BeginFrame() -{ - -} -// update physic -void Object::EndFrame() -{ - -} - -void Object::setBeforeCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter)) -{ - //this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse)(collisionFuncBefore)); -} -void Object::setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)) -{ - this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter)); -} Oyster::Math::Float3 Object::GetPosition() { @@ -94,21 +67,9 @@ Oyster::Math::Quaternion Object::GetRotation() state = this->rigidBody->GetState(); return state.quaternion; } -Oyster::Math::Float3 Object::GetScale() -{ - Oyster::Physics::ICustomBody::State state; - state = this->rigidBody->GetState(); - return Float3(); -} Oyster::Math::Float4x4 Object::GetOrientation() { Oyster::Physics::ICustomBody::State state; state = this->rigidBody->GetState(); return state.GetOrientation(); } - - -Oyster::Math::Float Object::getExtraDamageOnCollision() -{ - return this->extraDamageOnCollision; -} \ No newline at end of file diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index 73853bd8..075236fe 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -16,47 +16,39 @@ namespace GameLogic class Object :public IObjectData { + public: + typedef Oyster::Physics::ICustomBody::SubscriptMessage (*OnCollisionCallback)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss); + public: Object(); - Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID); Object(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID); ~Object(void); - ObjectSpecialType GetObjectType() const override; - int GetID() const override; - void setID(int id); - Oyster::Math::Float3 GetPosition() override; - Oyster::Math::Quaternion GetRotation() override; - Oyster::Math::Float3 GetScale() override; - Oyster::Math::Float4x4 GetOrientation() override; + inline ObjectSpecialType GetObjectType() const override { return this->type; } + inline int GetID() const override { return this->objectID; } + inline Oyster::Math::Float3 GetScale() override { return this->scale; } + inline Oyster::Math::Float3 GetPosition() override; + inline Oyster::Math::Quaternion GetRotation() override; + inline Oyster::Math::Float4x4 GetOrientation() override; + inline Oyster::Physics::ICustomBody* GetRigidBody() { return this->rigidBody; } + inline Oyster::Math::Float GetExtraDamageOnCollision() { return this->extraDamageOnCollision; } - Oyster::Math::Float getExtraDamageOnCollision(); + virtual void BeginFrame() { }; + virtual void EndFrame() { }; - // API overrides - - - - Oyster::Physics::ICustomBody* GetRigidBody(); - - virtual void BeginFrame(); - virtual void EndFrame(); - - void setBeforeCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter)); - void setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)); - - static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); - - - public: //TODO: Hax This should be private when level is dynamic + void SetOnCollision(OnCollisionCallback func); + static Oyster::Physics::ICustomBody::SubscriptMessage DefaultOnCollision(Oyster::Physics::ICustomBody *rigidBodyObject, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); protected: Oyster::Physics::ICustomBody *rigidBody; static const Game* gameInstance; - Oyster::Math::Float3 currLook; - Oyster::Math::Float3 newLook; + + Oyster::Math::Float3 lookDirection; //The look direction for the camera + Oyster::Math::Float3 forwardDirection; //The forward direction of the rigid body + Oyster::Math::Float3 scale; //The scale of both rigid body and the mesh ObjectSpecialType type; int objectID; diff --git a/Code/Game/GameServer/Implementation/GameClient.cpp b/Code/Game/GameServer/Implementation/GameClient.cpp index 81066450..9c04007f 100644 --- a/Code/Game/GameServer/Implementation/GameClient.cpp +++ b/Code/Game/GameServer/Implementation/GameClient.cpp @@ -17,7 +17,7 @@ GameClient::GameClient(Utility::DynamicMemory::SmartPointerclient = nwClient; this->player = 0; isReady = false; - this->character = L"Unknown"; + this->character = L"crate_colonists.dan"; this->alias = L"Unknown"; this->secondsSinceLastResponse = 0.0f; } @@ -25,7 +25,7 @@ GameClient::~GameClient() { this->player = 0; this->isReady = false; - this->character = L"Unknown"; + this->character = L"crate_colonists.dan"; this->alias = L"Unknown"; this->secondsSinceLastResponse = 0.0f; } diff --git a/Code/Game/GameServer/Implementation/GameSession_General.cpp b/Code/Game/GameServer/Implementation/GameSession_General.cpp index 933807a4..30eabed2 100644 --- a/Code/Game/GameServer/Implementation/GameSession_General.cpp +++ b/Code/Game/GameServer/Implementation/GameSession_General.cpp @@ -165,7 +165,8 @@ void GameSession::ThreadEntry( ) IPlayerData* pl = this->gClients[k]->GetPlayer(); Protocol_ObjectCreatePlayer p( pl->GetPosition(), pl->GetRotation(), pl->GetScale(), pl->GetID(), true, this->gClients[k]->GetPlayer()->GetTeamID(), - /*nwClient->GetAlias()*/"", /*playerData->GetMesh()*/"char_white.dan"); + Utility::String::WStringToString(this->gClients[k]->GetAlias(), std::string()), + Utility::String::WStringToString(this->gClients[k]->GetCharacter(), std::string())); readyList[i]->GetClient()->Send(p); } } @@ -204,7 +205,8 @@ bool GameSession::Join(gClient gameClient) { Protocol_ObjectCreatePlayer oc( playerData->GetPosition(), playerData->GetRotation(), playerData->GetScale(), playerData->GetID(), true, playerData->GetTeamID(), - /*nwClient->GetAlias()*/"Unknown", /*playerData->GetMesh()*/"char_white.dan"); + Utility::String::WStringToString(gameClient->GetAlias(), std::string()), + Utility::String::WStringToString(gameClient->GetCharacter(), std::string())); nwClient->Send(oc); } @@ -217,7 +219,8 @@ bool GameSession::Join(gClient gameClient) IPlayerData* temp = this->gClients[i]->GetPlayer(); Protocol_ObjectCreatePlayer oc( temp->GetPosition(), temp->GetRotation(), temp->GetScale(), temp->GetID(), false, temp->GetTeamID(), - /*nwClient->GetAlias()*/"Unknown", /*playerData->GetMesh()*/"char_white.dan"); + Utility::String::WStringToString(this->gClients[i]->GetAlias(), std::string()), + Utility::String::WStringToString(this->gClients[i]->GetCharacter(), std::string())); nwClient->Send(oc); } } diff --git a/Code/Misc/Utilities/Utilities.h b/Code/Misc/Utilities/Utilities.h index b97d62d7..c259a845 100644 --- a/Code/Misc/Utilities/Utilities.h +++ b/Code/Misc/Utilities/Utilities.h @@ -337,11 +337,7 @@ namespace Utility template inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max ) - { - if( value < min ) return min; - if( value > max ) return max; - return value; - } + { return value < min ? Max( value, max ) : min; } template inline ValueType Average( const ValueType &valueA, const ValueType &valueB )