| 253 | } |
| 254 | |
| 255 | void SimDataBlockEvent::process(NetConnection *cptr) |
| 256 | { |
| 257 | if(mProcess) |
| 258 | { |
| 259 | //call the console function to set the number of blocks to be sent |
| 260 | Con::executef("onDataBlockObjectReceived", mIndex, mTotal); |
| 261 | |
| 262 | String &errorBuffer = NetConnection::getErrorBuffer(); |
| 263 | |
| 264 | // Register the datablock object if this is a new DB |
| 265 | // and not for a modified datablock event. |
| 266 | |
| 267 | if( !mObj->isProperlyAdded() ) |
| 268 | { |
| 269 | // This is a fresh datablock object. |
| 270 | // Perform preload on datablock and register |
| 271 | // the object. |
| 272 | |
| 273 | GameConnection* conn = dynamic_cast< GameConnection* >( cptr ); |
| 274 | if( conn ) |
| 275 | conn->preloadDataBlock( mObj ); |
| 276 | |
| 277 | if( mObj->registerObject(id) ) |
| 278 | { |
| 279 | cptr->addObject( mObj ); |
| 280 | mObj = NULL; |
| 281 | } |
| 282 | } |
| 283 | else |
| 284 | { |
| 285 | // This is an update to an existing datablock. Preload |
| 286 | // to finish this. |
| 287 | |
| 288 | mObj->preload( false, errorBuffer ); |
| 289 | mObj = NULL; |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | |
| 295 | //---------------------------------------------------------------------------- |
no test coverage detected