Sign in to follow this  

function passing error

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok there is something wrong with doing this
M = new Map(100, 100, tilelistvec,16,16,TileArray,szFiles,64);//intializing all member variables 
thats the .cpp implementation
Map(int width, int height, vector<Tile*> tilelistvec,
    int tileheight, int tilewidth,
    Tile *m_tilelist[64],string *szFiles[64],int f);   //intializing all member variables 
thats the .h decleration
void Map::DrawMap(SDL_Surface *screen,vector< vector<int> > MapOver,int tilelistsize) //draws a map to the specafied surface
{
    int x , y;//our cordaninths
    vector<Tile*> tilelist;
    InitImages(tilelist);
    int index;
    int a = GetHeight();
    int b = GetWidth();
    y=1;
    x=1;
    for (int i = 0; i < a; i++) {//y loop
      for(int j = 0; j < b; j ++) {//x loop
         index = MapOver[i][j];//get map over ////easyer imput storing it in seprate variable
         SDL_Rect dest;  //the rect
         dest.x = j;//this will eventually be changed to j*the tile length
         dest.y = i;//this will eventually be changed to i*tile_length
         SDL_BlitSurface(tilelist[index]->GetImage(),NULL, screen, &dest);//draw the tile
      };
    }; 
    SDL_Flip(screen);//dont flip till the end
    return;      
};


thats the .cpp definition for some reason it gives me this error main.cpp: In function `void draw()': main.cpp:22: error: no matching function for call to `Map::Map(int, int, std::vector<Tile*, std::allocator<Tile*> >&, int, int, Tile*[64], std::string[64], int)' Map.h:8: error: candidates are: Map::Map(const Map&) Map.h:15: error: Map::Map(int, int, std::vector<Tile*, std::allocator<Tile*> >, int, int, Tile**, std::string**, int) make.exe: *** [main.o] Error 1 thanks for your help Execution terminated [Edited by - Fruny on October 7, 2004 6:21:10 PM]

Share this post


Link to post
Share on other sites
In draw map you're asking for a vector<vector<int> > [2d array of ints] and you're trying to pass it a vector<vector<Tile *> > [2d array of Tile pointers] so the compiler barfs.

[edit: er, never mind. the actual error message is for Map::Map, either way you're trying to pass the 3rd parameter something that it's not expecting.]

Share this post


Link to post
Share on other sites

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this