arrays && functions && pointers

Derek Parnell derek at
Sun Jun 18 20:03:50 PDT 2006

On Mon, 19 Jun 2006 12:55:01 +1000, Derek Parnell wrote:

> Here is a demo program that simulates them.

If you don't like the idea of a Map class, you can use a Map struct

Just change the "class Map" to "struct Map", replace the 'this' function
with ...
    // Create a map of a specific size.
    static Map opCall(int w, int h)
        Map lNew;
        lNew.mTiles.length = w*h;
        lNew.mWidth = w;
        lNew.mHeight = h;
        return lNew;

and replace the creation of vMap with ...

    // Create the map of tiles.
    auto vMap = Map(TILEW, TILEH);

Everything else remains the same.

(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
19/06/2006 12:59:28 PM

More information about the Digitalmars-d-learn mailing list