variable affiliation not recognised

Frederik Schwarzer schwarzerf at gmail.com
Mon Feb 9 22:33:00 UTC 2009


Hi,

I have a few cases, where variables are not properly recognised, e.g. they are 
not colored and they are not renamed if I rename the variable somewhere else.

Please have a look at the KShisen code at
http://websvn.kde.org/trunk/KDE/kdegames/kshisen/
(Note: I used the code as it is in r923973)

In src/board.cpp ~line 156 there is the following code:
bool Board::loadTileset(const QString &path)
{
    if (m_tiles.loadTileset(path)) { // here it is _not_ recognised
        if (m_tiles.loadGraphics()) {
            Prefs::setTileSet(path); // here it is recognised
            Prefs::self()->writeConfig();
            resizeBoard();
        }
        return true;
    }
    //Try default
    if (m_tiles.loadDefault()) {
        if (m_tiles.loadGraphics()) {
            Prefs::setTileSet(m_tiles.path());
            Prefs::self()->writeConfig();
            resizeBoard();
        }
    }
    return false;
}


The same applies for the next function at ~line 177:
bool Board::loadBackground(const QString &pszFileName)
{
    if (m_background.load(pszFileName, width(), height())) { // _not_ 
recognised
        if (m_background.loadGraphics()) {
            Prefs::setBackground(pszFileName); // recognised
            Prefs::self()->writeConfig();
            resizeBoard();
            return true;
        }
    }
    //Try default
    if (m_background.loadDefault()) {
        if (m_background.loadGraphics()) {
            Prefs::setBackground(m_background.path());
            Prefs::self()->writeConfig();
            resizeBoard();
        }
    }
    return false;
}


In src/board.h ~line 64 there is the following code:
struct Position {
    Position() : x(0), y(0) { }
    Position(int _x, int _y) : x(_x), y(_y) { }
    int x; ///< x position
    int y; ///< y position
};

Here when I renamed int x; to int m_x;, one of the y occurrences in the 
initialisation list lost its affiliation to int y; and thus was not renamed 
when I renamed int y; to int m_y;.

Regards




More information about the KDevelop-devel mailing list