Browse Source

Turn dt into an unsigned, mute warnings about it being unused

Streetwalrus Einstein 10 years ago
parent
commit
66f8340c38
8 changed files with 22 additions and 11 deletions
  1. 1 1
      include/Camera.h
  2. 2 2
      include/Entity.h
  3. 2 2
      include/Map.h
  4. 2 0
      include/misc.h
  5. 3 1
      src/Camera.cpp
  6. 3 1
      src/Entity.cpp
  7. 6 2
      src/Map.cpp
  8. 3 2
      src/main.cpp

+ 1 - 1
include/Camera.h

@@ -24,7 +24,7 @@ namespace WalrusRPG
 			~Camera();
 			// This doesn't need any render as it's the utility which helps rendering. Unless you want to show debnug things.
 			// void render(float dt) const;
-			void update(float dt);
+			void update(unsigned dt);
 	};
 }
 

+ 2 - 2
include/Entity.h

@@ -21,8 +21,8 @@ namespace WalrusRPG
 		public:
 			Entity();
 			~Entity();
-			void render(Camera &camera, float dt) const;
-			void update(float dt);
+			void render(Camera &camera, unsigned dt) const;
+			void update(unsigned dt);
 	};
 }
 

+ 2 - 2
include/Map.h

@@ -19,8 +19,8 @@ namespace WalrusRPG
 		public:
 			Map(int width, int height, unsigned *layer0, unsigned *layer1);
 			~Map();
-			void render(Camera &camera, float dt) const;
-			void update(float dt);
+			void render(Camera &camera, unsigned dt) const;
+			void update(unsigned dt);
 			bool entity_collide(Entity &entity) const;
 	};
 }

+ 2 - 0
include/misc.h

@@ -1,6 +1,8 @@
 #ifndef INCLUDE_MISC_H
 #define INCLUDE_MISC_H
 
+#define UNUSED(expr) (void)(expr)
+
 #define min(a, b) (((a) < (b)) ? (a) : (b))
 #define max(a, b) (((a) > (b)) ? (a) : (b))
 

+ 3 - 1
src/Camera.cpp

@@ -1,6 +1,7 @@
 #include <os.h>
 #include "Camera.h"
 #include "Entity.h"
+#include "misc.h"
 
 #define CAMERA WalrusRPG::Camera
 
@@ -15,8 +16,9 @@ CAMERA::~Camera()
 	// TODO if you allocate dynamically members
 }
 
-void CAMERA::update(float dt)
+void CAMERA::update(unsigned dt)
 {
+	UNUSED(dt);
 	// TODO update map's data according to elasped time
 	/*
 		// Need to think aagain on how to go to a target point and/or we need to align the corner OR the center to this point.

+ 3 - 1
src/Entity.cpp

@@ -1,4 +1,5 @@
 #include "Entity.h"
+#include "misc.h"
 
 #define ENTITY WalrusRPG::Entity
 
@@ -12,8 +13,9 @@ ENTITY::~Entity()
 	// TODO if you allocate dynamically members
 }
 
-void ENTITY::update(float dt)
+void ENTITY::update(unsigned dt)
 {
+	UNUSED(dt);
 	// TODO update map's data according to elasped time
 	/*
 		// Need to think aagain on how to go to a target point and/or we need to align the corner OR the center to this point.

+ 6 - 2
src/Map.cpp

@@ -2,6 +2,7 @@
 #include "Camera.h"
 #include "graphics.h"
 #include "sprites.h"
+#include "misc.h"
 
 #define MAP WalrusRPG::Map
 
@@ -18,13 +19,15 @@ MAP::~Map()
 	// TODO if you allocate dynamically members
 }
 
-void MAP::update(float dt)
+void MAP::update(unsigned dt)
 {
+	UNUSED(dt);
 	// TODO update map's data according to elasped time
 }
 
-void MAP::render(WalrusRPG::Camera &camera, float dt) const
+void MAP::render(WalrusRPG::Camera &camera, unsigned dt) const
 {
+	UNUSED(dt);
 	unsigned offset_x = camera.x % 24 * -1;
 	unsigned offset_y = camera.y % 24 * -1;
 
@@ -45,6 +48,7 @@ void MAP::render(WalrusRPG::Camera &camera, float dt) const
 
 bool MAP::entity_collide(Entity &entity) const
 {
+	UNUSED(entity);
 	return false;
 }
 

+ 3 - 2
src/main.cpp

@@ -3,6 +3,7 @@
 #include "graphics.h"
 #include "Map.h"
 #include "Camera.h"
+#include "misc.h"
 
 using namespace WalrusRPG;
 
@@ -37,8 +38,8 @@ void map_loop(unsigned x, unsigned y, Map &map)
 
 int main(int argc, char *argv[])
 {
-	(void) argc;
-	(void) argv;
+	UNUSED(argc);
+	UNUSED(argv);
 
 	buffer_allocate();
 	timer_init(0);