Changeset 3195 in orxonox.OLD for orxonox/trunk/importer/array.cc
- Timestamp:
- Dec 17, 2004, 12:03:30 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/importer/array.cc
r3188 r3195 21 21 Array::Array () 22 22 { 23 initializeArray ();23 this->initializeArray (); 24 24 } 25 25 … … 32 32 if (verbose >= 2) 33 33 printf("deleting array\n"); 34 Entry* walker = firstEntry;34 Entry* walker = this->firstEntry; 35 35 Entry* previous; 36 36 while (walker) … … 41 41 } 42 42 if (finalized) 43 delete [] array;43 delete []this->array; 44 44 } 45 45 … … 52 52 if (verbose >= 2) 53 53 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 entry54 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 59 59 return; 60 60 } … … 69 69 printf ("Finalizing array. Length: %i\n", entryCount); 70 70 // 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++) 75 75 { 76 array[i] = walker->value;76 this->array[i] = walker->value; 77 77 walker = walker->next; 78 78 } 79 finalized = true;79 this->finalized = true; 80 80 81 81 return; … … 88 88 void Array::addEntry (GLfloat entry) 89 89 { 90 if (! finalized)90 if (!this->finalized) 91 91 { 92 92 if (verbose >= 3) 93 93 printf ("adding new Entry to Array: %f\n", entry); 94 94 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; 100 100 } 101 101 else … … 109 109 void Array::addEntry (GLfloat entry0, GLfloat entry1, GLfloat entry2) 110 110 { 111 addEntry (entry0);112 addEntry (entry1);113 addEntry (entry2);111 this->addEntry (entry0); 112 this->addEntry (entry1); 113 this->addEntry (entry2); 114 114 } 115 115 … … 120 120 GLfloat* Array::getArray () 121 121 { 122 return array;122 return this->array; 123 123 } 124 124 … … 128 128 int Array::getCount() 129 129 { 130 return entryCount;130 return this->entryCount; 131 131 } 132 132 … … 136 136 void Array::debug () 137 137 { 138 printf ("entryCount=%i, address=%p\n", entryCount,array);138 printf ("entryCount=%i, address=%p\n", this->entryCount, this->array); 139 139 }
Note: See TracChangeset
for help on using the changeset viewer.