#include "block.h"


block::block( struct resbuf *_rb ) : ADS_ENT_OBJ( _rb )
{
   struct resbuf *temp_rb = rb;
   while( temp_rb != NULL )
    {
      if (temp_rb->restype < 0) // possible -1 of -2

        {
          entname[0] = temp_rb->resval.rlname[0];
          entname[1] = temp_rb->resval.rlname[1];
        }
      else if (temp_rb->restype == 2)
        {
          _name = temp_rb->resval.rstring;
        }
      else if (temp_rb->restype  == 5 )
        {
          _handle = temp_rb->resval.rstring;
        }
      else if (temp_rb->restype  == 10 )
        {
          center = vec3(temp_rb->resval.rpoint[0],
                        temp_rb->resval.rpoint[1],
                        temp_rb->resval.rpoint[2]);
          break;
        }
      temp_rb = temp_rb->rbnext;
    }
}

#if 0

ADS_STRING block::name()
{
  ADS_STRING block_name;

  struct resbuf *temp_rb = rb;
  while (temp_rb != NULL)
    {
      if (temp_rb->restype == 2)
        {
          block_name = temp_rb->resval.rstring;
          break;
        }
    }
  return block_name;
}


block::block(const block & b) : ADS_ENT_OBJ(b.rb)
{
  entname[0] = b.entname[0];
  entname[1] = b.entname[1];
}


cblock::cblock(const cblock &cb) : block(NULL)
{
  rb = ads_entget(cb.entname);
  entname[0] = cb.entname[0];
  entname[1] = cb.entname[1];
  center = cb.center;
}

#endif



syntax highlighted by Code2HTML, v. 0.9.1