Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3195 in orxonox.OLD for orxonox/trunk/importer/array.cc


Ignore:
Timestamp:
Dec 17, 2004, 12:03:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk/importer: this→pointers implemented in classes object, material, array, pathlist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/importer/array.cc

    r3188 r3195  
    2121Array::Array ()
    2222{
    23   initializeArray ();
     23  this->initializeArray ();
    2424}
    2525
     
    3232  if (verbose >= 2)
    3333    printf("deleting array\n");
    34   Entry* walker = firstEntry;
     34  Entry* walker = this->firstEntry;
    3535  Entry* previous;
    3636  while (walker)
     
    4141    }
    4242  if (finalized)
    43     delete []array;
     43    delete []this->array;
    4444}
    4545
     
    5252  if (verbose >= 2)
    5353    printf ("crating new Array\n");
    54   firstEntry = new Entry;
    55   firstEntry->next =NULL;
    56   currentEntry=firstEntry;
    57   finalized = false;
    58   entryCount = 0; //0 means one entry
     54  this->firstEntry = new Entry;
     55  this->firstEntry->next =NULL;
     56  this->currentEntry=firstEntry;
     57  this->finalized = false;
     58  this->entryCount = 0; //0 means one entry
    5959  return;
    6060}
     
    6969    printf ("Finalizing array. Length: %i\n", entryCount); 
    7070  //  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
    71   if ((array = new GLfloat [entryCount]) == NULL)
    72     printf ("could not allocate %i data Blocks\n", entryCount);
    73   Entry* walker = firstEntry;
    74   for (int i=0; i<entryCount; i++)
     71  if ((this->array = new GLfloat [this->entryCount]) == NULL)
     72    printf ("could not allocate %i data Blocks\n", this->entryCount);
     73  Entry* walker = this->firstEntry;
     74  for (int i=0; i<this->entryCount; i++)
    7575    {
    76       array[i] = walker->value;
     76      this->array[i] = walker->value;
    7777      walker = walker->next;
    7878    }
    79   finalized = true;
     79  this->finalized = true;
    8080
    8181  return;
     
    8888void Array::addEntry (GLfloat entry)
    8989{
    90   if (!finalized)
     90  if (!this->finalized)
    9191    {
    9292      if (verbose >= 3)
    9393        printf ("adding new Entry to Array: %f\n", entry);
    9494     
    95       currentEntry->value = entry;
    96       currentEntry->next = new Entry;
    97       currentEntry = currentEntry->next;
    98       currentEntry->next = NULL;
    99       ++entryCount;
     95      this->currentEntry->value = entry;
     96      this->currentEntry->next = new Entry;
     97      this->currentEntry = currentEntry->next;
     98      this->currentEntry->next = NULL;
     99      ++this->entryCount;
    100100    }
    101101  else
     
    109109void Array::addEntry (GLfloat entry0, GLfloat entry1, GLfloat entry2)
    110110{
    111   addEntry (entry0);
    112   addEntry (entry1);
    113   addEntry (entry2);
     111  this->addEntry (entry0);
     112  this->addEntry (entry1);
     113  this->addEntry (entry2);
    114114}
    115115 
     
    120120GLfloat* Array::getArray ()
    121121{
    122   return array;
     122  return this->array;
    123123}
    124124
     
    128128int Array::getCount()
    129129{
    130   return entryCount;
     130  return this->entryCount;
    131131}
    132132
     
    136136void Array::debug ()
    137137{
    138   printf ("entryCount=%i, address=%p\n", entryCount, array);
     138  printf ("entryCount=%i, address=%p\n", this->entryCount, this->array);
    139139}
Note: See TracChangeset for help on using the changeset viewer.