# move ps/Network into top level project (and static lib).
This was SVN commit r4249.
This commit is contained in:
parent
855e9bce02
commit
7d3d8fdbf3
@ -154,8 +154,10 @@ void CTerrain::CalcNormal(u32 i, u32 j, CVector3D& normal) const
|
|||||||
// out of bounds
|
// out of bounds
|
||||||
CPatch* CTerrain::GetPatch(i32 i, i32 j) const
|
CPatch* CTerrain::GetPatch(i32 i, i32 j) const
|
||||||
{
|
{
|
||||||
if (i<0 || i>=i32(m_MapSizePatches)) return 0;
|
// range check: >= 0 and < m_MapSizePatches
|
||||||
if (j<0 || j>=i32(m_MapSizePatches)) return 0;
|
if( (unsigned)i >= m_MapSizePatches || (unsigned)j >= m_MapSizePatches )
|
||||||
|
return 0;
|
||||||
|
|
||||||
return &m_Patches[(j*m_MapSizePatches)+i];
|
return &m_Patches[(j*m_MapSizePatches)+i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +167,9 @@ CPatch* CTerrain::GetPatch(i32 i, i32 j) const
|
|||||||
// of bounds
|
// of bounds
|
||||||
CMiniPatch* CTerrain::GetTile(i32 i, i32 j) const
|
CMiniPatch* CTerrain::GetTile(i32 i, i32 j) const
|
||||||
{
|
{
|
||||||
if (i<0 || i>=i32(m_MapSize)-1) return 0;
|
// see above
|
||||||
if (j<0 || j>=i32(m_MapSize)-1) return 0;
|
if( (unsigned)i >= m_MapSize-1 || (unsigned)j >= m_MapSize-1 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
CPatch* patch=GetPatch(i/PATCH_SIZE, j/PATCH_SIZE);
|
CPatch* patch=GetPatch(i/PATCH_SIZE, j/PATCH_SIZE);
|
||||||
return &patch->m_MiniPatches[j%PATCH_SIZE][i%PATCH_SIZE];
|
return &patch->m_MiniPatches[j%PATCH_SIZE][i%PATCH_SIZE];
|
||||||
@ -195,23 +198,8 @@ float CTerrain::getSlope(float x, float z) const
|
|||||||
int xi = (int)floor(x);
|
int xi = (int)floor(x);
|
||||||
int zi = (int)floor(z);
|
int zi = (int)floor(z);
|
||||||
|
|
||||||
if (xi < 0)
|
clampCoordToMap(xi);
|
||||||
{
|
clampCoordToMap(zi);
|
||||||
xi = 0;
|
|
||||||
}
|
|
||||||
else if (xi >= (int)m_MapSize-1)
|
|
||||||
{
|
|
||||||
xi = m_MapSize - 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zi < 0)
|
|
||||||
{
|
|
||||||
zi = 0;
|
|
||||||
}
|
|
||||||
else if (zi >= (int)m_MapSize-1)
|
|
||||||
{
|
|
||||||
zi = m_MapSize - 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
float h00 = m_Heightmap[zi*m_MapSize + xi];
|
float h00 = m_Heightmap[zi*m_MapSize + xi];
|
||||||
float h01 = m_Heightmap[zi*m_MapSize + xi + m_MapSize];
|
float h01 = m_Heightmap[zi*m_MapSize + xi + m_MapSize];
|
||||||
@ -244,14 +232,8 @@ CVector2D CTerrain::getSlopeAngleFace(float x, float y, CEntity*& entity ) const
|
|||||||
side += 8;
|
side += 8;
|
||||||
|
|
||||||
//Keep it in bounds
|
//Keep it in bounds
|
||||||
if (xi < 0)
|
clampCoordToMap(xi);
|
||||||
xi = 0;
|
clampCoordToMap(yi);
|
||||||
else if (xi >= (int)m_MapSize-1)
|
|
||||||
xi = m_MapSize - 2;
|
|
||||||
if (yi < 0)
|
|
||||||
yi = 0;
|
|
||||||
else if (yi >= (int)m_MapSize-1)
|
|
||||||
yi = m_MapSize - 2;
|
|
||||||
|
|
||||||
float h00 = m_Heightmap[yi*m_MapSize + xi] * HEIGHT_SCALE;
|
float h00 = m_Heightmap[yi*m_MapSize + xi] * HEIGHT_SCALE;
|
||||||
float h01 = m_Heightmap[yi*m_MapSize + xi + m_MapSize] * HEIGHT_SCALE;
|
float h01 = m_Heightmap[yi*m_MapSize + xi + m_MapSize] * HEIGHT_SCALE;
|
||||||
@ -355,13 +337,6 @@ float CTerrain::getExactGroundLevel(float x, float z) const
|
|||||||
zi = m_MapSize - 2; zf = 1.0f;
|
zi = m_MapSize - 2; zf = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
debug_assert( isOnMap( x, y ) );
|
|
||||||
|
|
||||||
if( !isOnMap( x, y ) )
|
|
||||||
return 0.0f;
|
|
||||||
*/
|
|
||||||
|
|
||||||
float h00 = m_Heightmap[zi*m_MapSize + xi];
|
float h00 = m_Heightmap[zi*m_MapSize + xi];
|
||||||
float h01 = m_Heightmap[zi*m_MapSize + xi + m_MapSize];
|
float h01 = m_Heightmap[zi*m_MapSize + xi + m_MapSize];
|
||||||
float h10 = m_Heightmap[zi*m_MapSize + xi + 1];
|
float h10 = m_Heightmap[zi*m_MapSize + xi + 1];
|
||||||
|
@ -55,6 +55,14 @@ public:
|
|||||||
}
|
}
|
||||||
bool isOnMap(const CVector2D& v) const;
|
bool isOnMap(const CVector2D& v) const;
|
||||||
|
|
||||||
|
void clampCoordToMap(int& index) const
|
||||||
|
{
|
||||||
|
if(index < 0)
|
||||||
|
index = 0;
|
||||||
|
else if(index >= (int)m_MapSize-1)
|
||||||
|
index = m_MapSize - 2;
|
||||||
|
}
|
||||||
|
|
||||||
float getVertexGroundLevel(int i, int j) const;
|
float getVertexGroundLevel(int i, int j) const;
|
||||||
float getExactGroundLevel(float x, float z) const;
|
float getExactGroundLevel(float x, float z) const;
|
||||||
float getExactGroundLevel(const CVector2D& v) const;
|
float getExactGroundLevel(const CVector2D& v) const;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "maths/Bound.h"
|
#include "maths/Bound.h"
|
||||||
#include "ps/Game.h"
|
#include "ps/Game.h"
|
||||||
#include "ps/Interact.h"
|
#include "ps/Interact.h"
|
||||||
#include "ps/Network/NetMessage.h"
|
#include "network/NetMessage.h"
|
||||||
#include "ps/Profile.h"
|
#include "ps/Profile.h"
|
||||||
#include "renderer/Renderer.h"
|
#include "renderer/Renderer.h"
|
||||||
#include "renderer/WaterManager.h"
|
#include "renderer/WaterManager.h"
|
||||||
|
@ -31,7 +31,7 @@ that of Atlas depending on commandline parameters.
|
|||||||
#include "ps/Hotkey.h"
|
#include "ps/Hotkey.h"
|
||||||
#include "ps/Globals.h"
|
#include "ps/Globals.h"
|
||||||
#include "ps/Interact.h"
|
#include "ps/Interact.h"
|
||||||
#include "ps/Network/SessionManager.h"
|
#include "network/SessionManager.h"
|
||||||
#include "graphics/GameView.h"
|
#include "graphics/GameView.h"
|
||||||
#include "simulation/Scheduler.h"
|
#include "simulation/Scheduler.h"
|
||||||
#include "sound/CMusicPlayer.h"
|
#include "sound/CMusicPlayer.h"
|
||||||
|
1
source/pch/network/precompiled.cpp
Normal file
1
source/pch/network/precompiled.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "precompiled.h"
|
7
source/pch/network/precompiled.h
Normal file
7
source/pch/network/precompiled.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "lib/precompiled.h" // common precompiled header
|
||||||
|
|
||||||
|
// network-specific PCH:
|
||||||
|
|
||||||
|
#if HAVE_PCH
|
||||||
|
|
||||||
|
#endif // HAVE_PCH
|
@ -13,8 +13,8 @@
|
|||||||
#include "ps/Globals.h"
|
#include "ps/Globals.h"
|
||||||
#include "ps/Hotkey.h"
|
#include "ps/Hotkey.h"
|
||||||
#include "ps/Interact.h"
|
#include "ps/Interact.h"
|
||||||
#include "ps/Network/Client.h"
|
#include "network/Client.h"
|
||||||
#include "ps/Network/Server.h"
|
#include "network/Server.h"
|
||||||
#include "ps/Pyrogenesis.h"
|
#include "ps/Pyrogenesis.h"
|
||||||
#include "scripting/ScriptingHost.h"
|
#include "scripting/ScriptingHost.h"
|
||||||
#include "simulation/Entity.h"
|
#include "simulation/Entity.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#define CStr_CPP_FIRST
|
#define CStr_CPP_FIRST
|
||||||
|
|
||||||
#include "lib/posix.h" // for htons, ntohs
|
#include "lib/posix.h" // for htons, ntohs
|
||||||
#include "ps/Network/Serialization.h"
|
#include "network/Serialization.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "GameAttributes.h"
|
#include "GameAttributes.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ConfigDB.h"
|
#include "ConfigDB.h"
|
||||||
#include "ps/Network/ServerSession.h"
|
#include "network/ServerSession.h"
|
||||||
#include "CLogger.h"
|
#include "CLogger.h"
|
||||||
#include "ps/XML/Xeromyces.h"
|
#include "ps/XML/Xeromyces.h"
|
||||||
|
|
||||||
|
@ -78,9 +78,9 @@
|
|||||||
#include "sound/CMusicPlayer.h"
|
#include "sound/CMusicPlayer.h"
|
||||||
#include "sound/JSI_Sound.h"
|
#include "sound/JSI_Sound.h"
|
||||||
|
|
||||||
#include "ps/Network/SessionManager.h"
|
#include "network/SessionManager.h"
|
||||||
#include "ps/Network/Server.h"
|
#include "network/Server.h"
|
||||||
#include "ps/Network/Client.h"
|
#include "network/Client.h"
|
||||||
|
|
||||||
#include "Atlas.h"
|
#include "Atlas.h"
|
||||||
#include "GameSetup.h"
|
#include "GameSetup.h"
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "lib/timer.h"
|
#include "lib/timer.h"
|
||||||
#include "maths/MathUtil.h"
|
#include "maths/MathUtil.h"
|
||||||
#include "ps/Globals.h"
|
#include "ps/Globals.h"
|
||||||
#include "ps/Network/NetMessage.h"
|
#include "network/NetMessage.h"
|
||||||
#include "ps/Player.h"
|
#include "ps/Player.h"
|
||||||
#include "ps/VFSUtil.h"
|
#include "ps/VFSUtil.h"
|
||||||
#include "ps/World.h"
|
#include "ps/World.h"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ps/Network/NetMessage.h"
|
#include "network/NetMessage.h"
|
||||||
#include "simulation/Entity.h"
|
#include "simulation/Entity.h"
|
||||||
#include "simulation/EntityManager.h"
|
#include "simulation/EntityManager.h"
|
||||||
#include "ps/scripting/JSCollection.h"
|
#include "ps/scripting/JSCollection.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Mark Thompson (mark@wildfiregames.com / mot20@cam.ac.uk)
|
// Mark Thompson (mark@wildfiregames.com / mot20@cam.ac.uk)
|
||||||
// WIP, not yet functional
|
// WIP, not yet functional
|
||||||
|
|
||||||
#include "ps/Network/Serialization.h"
|
#include "network/Serialization.h"
|
||||||
#include "JSConversions.h"
|
#include "JSConversions.h"
|
||||||
#include "ps/CStr.h"
|
#include "ps/CStr.h"
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#include "ps/Game.h"
|
#include "ps/Game.h"
|
||||||
#include "ps/GameSetup/GameSetup.h"
|
#include "ps/GameSetup/GameSetup.h"
|
||||||
#include "ps/Interact.h"
|
#include "ps/Interact.h"
|
||||||
#include "ps/Network/Client.h"
|
#include "network/Client.h"
|
||||||
#include "ps/Network/Server.h"
|
#include "network/Server.h"
|
||||||
#include "ps/i18n.h"
|
#include "ps/i18n.h"
|
||||||
#include "ps/Hotkey.h"
|
#include "ps/Hotkey.h"
|
||||||
#include "ps/scripting/JSCollection.h"
|
#include "ps/scripting/JSCollection.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "Simulation.h"
|
#include "Simulation.h"
|
||||||
#include "ps/Game.h"
|
#include "ps/Game.h"
|
||||||
#include "ps/Interact.h"
|
#include "ps/Interact.h"
|
||||||
#include "ps/Network/NetMessage.h"
|
#include "network/NetMessage.h"
|
||||||
|
|
||||||
CEntityFormation::CEntityFormation( CFormation*& base, size_t index )
|
CEntityFormation::CEntityFormation( CFormation*& base, size_t index )
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "ps/CStr.h"
|
#include "ps/CStr.h"
|
||||||
#include "ps/Network/Serialization.h"
|
#include "network/Serialization.h"
|
||||||
|
|
||||||
CHandle::CHandle()
|
CHandle::CHandle()
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "ps/GameAttributes.h"
|
#include "ps/GameAttributes.h"
|
||||||
#include "ps/Loader.h"
|
#include "ps/Loader.h"
|
||||||
#include "ps/LoaderThunks.h"
|
#include "ps/LoaderThunks.h"
|
||||||
#include "ps/Network/NetMessage.h"
|
#include "network/NetMessage.h"
|
||||||
#include "ps/Profile.h"
|
#include "ps/Profile.h"
|
||||||
#include "renderer/Renderer.h"
|
#include "renderer/Renderer.h"
|
||||||
#include "renderer/WaterManager.h"
|
#include "renderer/WaterManager.h"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
#include "TurnManager.h"
|
#include "TurnManager.h"
|
||||||
#include "ps/Network/NetMessage.h"
|
#include "network/NetMessage.h"
|
||||||
#include "ps/Network/Network.h"
|
#include "network/Network.h"
|
||||||
#include "ps/GameRecord.h"
|
#include "ps/GameRecord.h"
|
||||||
#include "ps/CLogger.h"
|
#include "ps/CLogger.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user