Browse Source

Move configuration values to Config.h.in

Daniele Bartolini 12 years ago
parent
commit
eeab5879ee
3 changed files with 18 additions and 17 deletions
  1. 7 1
      engine/Config.h.in
  2. 5 5
      engine/world/Unit.cpp
  3. 6 11
      engine/world/Unit.h

+ 7 - 1
engine/Config.h.in

@@ -56,7 +56,13 @@ OTHER DEALINGS IN THE SOFTWARE.
 #define CE_MAX_JOINTS						512					// Per world
 #define CE_MAX_SOUND_INSTANCES				64					// Per world
 #define CE_MAX_RAYCASTS						8					// Per World
-#define CE_MAX_RAY_INTERSECTIONS			16					
+#define CE_MAX_RAY_INTERSECTIONS			16
+
+#define CE_MAX_CAMERA_COMPONENTS			16					// Per unit
+#define CE_MAX_MESH_COMPONENTS				16					// Per unit
+#define CE_MAX_SPRITE_COMPONENTS			16					// Per unit
+#define CE_MAX_ACTOR_COMPONENTS				16					// Per unit
+#define CE_MAX_MATERIAL_COMPONENTS			16					// Per unit				
 
 #define CE_MAX_CONSOLE_CLIENTS				32
 

+ 5 - 5
engine/world/Unit.cpp

@@ -396,7 +396,7 @@ Id Unit::find_component_by_index(StringId32 name, uint32_t size, Component* arra
 //-----------------------------------------------------------------------------
 void Unit::add_camera(StringId32 name, CameraId camera)
 {
-	CE_ASSERT(m_num_cameras < MAX_CAMERA_COMPONENTS, "Max camera number reached");
+	CE_ASSERT(m_num_cameras < CE_MAX_CAMERA_COMPONENTS, "Max camera number reached");
 
 	add_component(name, camera, m_num_cameras, m_cameras);
 }
@@ -404,7 +404,7 @@ void Unit::add_camera(StringId32 name, CameraId camera)
 //-----------------------------------------------------------------------------
 void Unit::add_mesh(StringId32 name, MeshId mesh)
 {
-	CE_ASSERT(m_num_meshes < MAX_MESH_COMPONENTS, "Max mesh number reached");
+	CE_ASSERT(m_num_meshes < CE_MAX_MESH_COMPONENTS, "Max mesh number reached");
 
 	add_component(name, mesh, m_num_meshes, m_meshes);
 }
@@ -412,7 +412,7 @@ void Unit::add_mesh(StringId32 name, MeshId mesh)
 //-----------------------------------------------------------------------------
 void Unit::add_sprite(StringId32 name, SpriteId sprite)
 {
-	CE_ASSERT(m_num_sprites < MAX_SPRITE_COMPONENTS, "Max sprite number reached");
+	CE_ASSERT(m_num_sprites < CE_MAX_SPRITE_COMPONENTS, "Max sprite number reached");
 
 	add_component(name, sprite, m_num_sprites, m_sprites);
 }
@@ -420,7 +420,7 @@ void Unit::add_sprite(StringId32 name, SpriteId sprite)
 //-----------------------------------------------------------------------------
 void Unit::add_actor(StringId32 name, ActorId actor)
 {
-	CE_ASSERT(m_num_actors < MAX_ACTOR_COMPONENTS, "Max actor number reached");
+	CE_ASSERT(m_num_actors < CE_MAX_ACTOR_COMPONENTS, "Max actor number reached");
 
 	add_component(name, actor, m_num_actors, m_actors);
 }
@@ -428,7 +428,7 @@ void Unit::add_actor(StringId32 name, ActorId actor)
 //-----------------------------------------------------------------------------
 void Unit::add_material(StringId32 name, MaterialId material)
 {
-	CE_ASSERT(m_num_materials < MAX_MATERIAL_COMPONENTS, "Max material number reached");
+	CE_ASSERT(m_num_materials < CE_MAX_MATERIAL_COMPONENTS, "Max material number reached");
 
 	add_component(name, material, m_num_materials, m_materials);
 }

+ 6 - 11
engine/world/Unit.h

@@ -36,6 +36,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "PhysicsTypes.h"
 #include "WorldTypes.h"
 #include "RenderWorldTypes.h"
+#include "Config.h"
 
 namespace crown
 {
@@ -72,12 +73,6 @@ struct Mesh;
 struct Sprite;
 struct UnitResource;
 
-#define MAX_CAMERA_COMPONENTS 16
-#define MAX_MESH_COMPONENTS 16
-#define MAX_SPRITE_COMPONENTS 16
-#define MAX_ACTOR_COMPONENTS 16
-#define MAX_MATERIAL_COMPONENTS 16
-
 struct Unit
 {
 						Unit(World& w, const UnitResource* ur, const Matrix4x4& pose);
@@ -157,19 +152,19 @@ public:
 	UnitId				m_id;
 
 	uint32_t			m_num_cameras;
-	Component			m_cameras[MAX_CAMERA_COMPONENTS];
+	Component			m_cameras[CE_MAX_CAMERA_COMPONENTS];
 
 	uint32_t			m_num_meshes;
-	Component			m_meshes[MAX_MESH_COMPONENTS];
+	Component			m_meshes[CE_MAX_MESH_COMPONENTS];
 
 	uint32_t			m_num_sprites;
-	Component			m_sprites[MAX_SPRITE_COMPONENTS];
+	Component			m_sprites[CE_MAX_SPRITE_COMPONENTS];
 
 	uint32_t			m_num_actors;
-	Component 			m_actors[MAX_ACTOR_COMPONENTS];
+	Component 			m_actors[CE_MAX_ACTOR_COMPONENTS];
 
 	uint32_t			m_num_materials;
-	Component			m_materials[MAX_MATERIAL_COMPONENTS];
+	Component			m_materials[CE_MAX_MATERIAL_COMPONENTS];
 
 	Component			m_controller;
 };