Jump to content
  • Advertisement
Sign in to follow this  

function passing error

This topic is 5094 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;
    int index;
    int a = GetHeight();
    int b = GetWidth();
    for (int i = 0; i < a; i++) {//y loop
      for(int j = 0; j < b; j ++) {//x loop
         index = MapOver[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

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!