Changeset 590 for code/branches/FICN/src/network
- Timestamp:
- Dec 17, 2007, 8:23:26 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/network/GameStateManager.cc
r573 r590 82 82 //the size of the gamestate 83 83 int totalsize=0; 84 int memsize=1000; 84 85 //the size of one specific synchronisable 85 86 int tempsize=0; … … 93 94 // reserve a little memory and increase it later on 94 95 COUT(2) << "mallocing" << std::endl; 95 retval->data = (unsigned char*)malloc( 1);96 retval->data = (unsigned char*)malloc(memsize); 96 97 COUT(2) << "malloced" << std::endl; 97 98 … … 106 107 totalsize+=tempsize+3*sizeof(int); 107 108 // allocate additional space 108 retval->data = (unsigned char *)realloc((void *)retval->data, totalsize); 109 if(totalsize+tempsize>memsize){ 110 retval->data = (unsigned char *)realloc((void *)retval->data, totalsize+1000); 111 memsize+=1000; 112 } 109 113 110 114 // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length)
Note: See TracChangeset
for help on using the changeset viewer.