| 231 | } |
| 232 | |
| 233 | void SimDataBlockEvent::process(NetConnection *cptr) |
| 234 | { |
| 235 | if(mProcess) |
| 236 | { |
| 237 | //call the console function to set the number of blocks to be sent |
| 238 | Con::executef("onDataBlockObjectReceived", mIndex, mTotal); |
| 239 | |
| 240 | String &errorBuffer = NetConnection::getErrorBuffer(); |
| 241 | |
| 242 | // Register the datablock object if this is a new DB |
| 243 | // and not for a modified datablock event. |
| 244 | |
| 245 | if( !mObj->isProperlyAdded() ) |
| 246 | { |
| 247 | // This is a fresh datablock object. |
| 248 | // Perform preload on datablock and register |
| 249 | // the object. |
| 250 | |
| 251 | GameConnection* conn = dynamic_cast< GameConnection* >( cptr ); |
| 252 | if( conn ) |
| 253 | conn->preloadDataBlock( mObj ); |
| 254 | |
| 255 | if( mObj->registerObject(id) ) |
| 256 | { |
| 257 | cptr->addObject( mObj ); |
| 258 | mObj = NULL; |
| 259 | } |
| 260 | } |
| 261 | else |
| 262 | { |
| 263 | // This is an update to an existing datablock. Preload |
| 264 | // to finish this. |
| 265 | |
| 266 | mObj->preload( false, errorBuffer ); |
| 267 | mObj = NULL; |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | |
| 273 | //---------------------------------------------------------------------------- |
no test coverage detected