m_surfaceList is defined as std::list<CSurfaceList>
This routine is supposed to search the surface list for a particular index number, if it's found, it's returned. If not, it's created, pushed on and returned.
CSurfaceList is defined as:
Code:
struct CSurfaceList
{
Uint32 index;
CSurface surface;
}
PHP Code:
SDL_Surface *CPalette::GetImg(Uint16 iTileNum) const
{
std::list<CSurfaceList>::iterator findIterator;
-> for (findIterator = m_surfaceList.begin(); findIterator != m_surfaceList.end(); findIterator++)
{
if (findIterator->index == iTileNum) // Did we find it
{
return findIterator->surface.GetSurface(); // It's found, return it
}
}
CSurfaceList returnSurface;
SDL_Rect rSrc = { // The dimensions and offsets of the tile we need in the main palette
(iTileNum % m_imgInfo.iEntriesPerLine) * m_imgInfo.iWidth,
(iTileNum % (m_imgInfo.iTotalEntries / m_imgInfo.iEntriesPerLine)) * m_imgInfo.iHeight,
m_imgInfo.iWidth,
m_imgInfo.iHeight
};
returnSurface.surface.SetSurface(m_pPalette, &rSrc); // Set the surface
-> m_surfaceList.push_back(returnSurface); // Put it on the end of the list
return returnSurface.surface.GetSurface();
};
And the errors...
CPalette.cpp(223) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::list<struct CSurfaceList,class std::allocator<struct CSurfaceList>
>::const_iterator' (or there is no acceptable conversion)
CPalette.cpp(223) : error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class std::list<struct CSurfaceList,class std::allocator<struct CSurfaceList>
>::iterator' (or there is no acceptable conversion)
CPalette.cpp(240) : error C2662: 'push_back' : cannot convert 'this' pointer from 'const class std::list<struct CSurfaceList,class std::allocator<struct CSurfaceList> >' to 'class std::
list<struct CSurfaceList,class std::allocator<struct CSurfaceList> > &'
Conversion loses qualifiers
-> indicates the line on which the error occoured.
Any help would be appreciated.