Ignore:
Timestamp:
Jul 4, 2010, 2:07:55 AM (12 years ago)
Author:
sam
Message:

The layer name is no longer ignored.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/layer.cpp

    r38 r47  
    22#include "layer.h"
    33
    4 Layer::Layer(int w, int h, FILE *fp)
     4Layer::Layer(char const *name, int w, int h, FILE *fp)
    55{
    66    width = w;
    77    height = h;
    88    data = new unsigned int[w * h];
     9
     10    if (sscanf(name, "Ground %d", &z) == 1)
     11        ;
     12    else if (sscanf(name, "Ground Decal %d", &z) == 1)
     13        ;
     14    else if (sscanf(name, "Object %d", &z) == 1)
     15        ;
     16    else if (sscanf(name, "Wall %d", &z) == 1)
     17        z++;
     18    else if (sscanf(name, "Wall Decal %d", &z) == 1)
     19        z++;
     20    else
     21        z = -1;
    922
    1023    fread(data, sizeof(unsigned int), width * height, fp);
     
    2235}
    2336
     37int Layer::GetZ()
     38{
     39    return z;
     40}
     41
    2442unsigned int Layer::GetTile(int x, int y)
    2543{
Note: See TracChangeset for help on using the changeset viewer.