Hello!
I am working on a basic game in SDL/OpenGL its a tilebased tower-defence game.
I was gonna make a function that loads a tilemap to a vector that have this format:
std::vector< std::vector<tile> >
But for some reason i get error: C3203 and C2955.
I have done a similar tilemap loader, but that vector just stored ints. And it worked really good.
Now i am gonna post two header files. its the tile.h header file and the functions namespace header file.
(i assume you can understand what theyre for)
This is probaly the first project i use namespaces for, please tell me if im using it wrong!
thanks in advance!
EDIT: The problem was a circular dependency, Check Peter87 reply for a good answer!
Here is tile.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#ifndef _TILE_H
#define _TILE_H
#include <SDL.h>
#include <SDL_opengl.h>
#include "functions.h"
#include "global.h"
class tile
{
public:
tile(float x, float y);
~tile(void);
void Update(global::Coord2D Mouse);
void Render();
private:
global::FloatRect box;
bool MouseOver;
int type;
};
#endif
|
here is the functions namespace. I get error at the row where i declare
void LoadMap( std::vector< std::vector<tile> > * map );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#ifndef _FUNCTIONS_H
#define _FUNCTIONS_H
#include <vector>
#include "global.h"
#include "tile.h"
namespace functions
{
namespace collisions
{
bool CheckRectCollision(global::FloatRect rect1, global::FloatRect rect2);
bool CheckIfMouseIsInside(global::Coord2D Mouse, global::FloatRect rect);
}
namespace map
{
void LoadMap( std::vector< std::vector<tile> > * map );
}
}
#endif
|