| 485 | // NetObject |
| 486 | |
| 487 | U32 DecalRoad::packUpdate(NetConnection * con, U32 mask, BitStream * stream) |
| 488 | { |
| 489 | // Pack Parent. |
| 490 | U32 retMask = Parent::packUpdate(con, mask, stream); |
| 491 | |
| 492 | if ( stream->writeFlag( mask & DecalRoadMask ) ) |
| 493 | { |
| 494 | // Write Texture Name. |
| 495 | PACK_ASSET(con, Material); |
| 496 | |
| 497 | stream->write( mBreakAngle ); |
| 498 | |
| 499 | stream->write( mSegmentsPerBatch ); |
| 500 | |
| 501 | stream->write( mTextureLength ); |
| 502 | |
| 503 | stream->write( mRenderPriority ); |
| 504 | } |
| 505 | |
| 506 | if ( stream->writeFlag( mask & NodeMask ) ) |
| 507 | { |
| 508 | //stream->writeInt( mNodes.size(), 16 ); |
| 509 | |
| 510 | //for ( U32 i = 0; i < mNodes.size(); i++ ) |
| 511 | //{ |
| 512 | // mathWrite( *stream, mNodes[i].point ); |
| 513 | // stream->write( mNodes[i].width ); |
| 514 | //} |
| 515 | |
| 516 | const U32 nodeByteSize = 16; // Based on sending all of a node's parameters |
| 517 | |
| 518 | // Test if we can fit all of our nodes within the current stream. |
| 519 | // We make sure we leave 100 bytes still free in the stream for whatever |
| 520 | // may follow us. |
| 521 | S32 allowedBytes = stream->getWriteByteSize() - 100; |
| 522 | if ( stream->writeFlag( (nodeByteSize * mNodes.size()) < allowedBytes ) ) |
| 523 | { |
| 524 | // All nodes should fit, so send them out now. |
| 525 | stream->writeInt( mNodes.size(), 16 ); |
| 526 | |
| 527 | for ( U32 i = 0; i < mNodes.size(); i++ ) |
| 528 | { |
| 529 | mathWrite( *stream, mNodes[i].point ); |
| 530 | stream->write( mNodes[i].width ); |
| 531 | } |
| 532 | } |
| 533 | else |
| 534 | { |
| 535 | // There isn't enough space left in the stream for all of the |
| 536 | // nodes. Batch them up into NetEvents. |
| 537 | U32 id = gServerNodeListManager->nextListId(); |
| 538 | U32 count = 0; |
| 539 | U32 index = 0; |
| 540 | while (count < mNodes.size()) |
| 541 | { |
| 542 | count += NodeListManager::smMaximumNodesPerEvent; |
| 543 | if (count > mNodes.size()) |
| 544 | { |
nothing calls this directly
no test coverage detected