| 549 | } |
| 550 | |
| 551 | void lgoal::SendStateToPlayer(int index, int pnum) { |
| 552 | if (!(Game_mode & GM_MULTI)) |
| 553 | return; |
| 554 | |
| 555 | if (m_modified == 0) |
| 556 | return; |
| 557 | |
| 558 | ASSERT(Netgame.local_role == LR_SERVER); |
| 559 | ASSERT(pnum >= 0 && pnum < MAX_NET_PLAYERS); |
| 560 | |
| 561 | if (!(NetPlayers[pnum].flags & NPF_CONNECTED && NetPlayers[pnum].sequence == NETSEQ_PLAYING)) |
| 562 | return; |
| 563 | |
| 564 | mprintf(0, "Sending modified LevelGoal %d to player %d\n", index, pnum); |
| 565 | |
| 566 | // now update the buddy handle list of the clients |
| 567 | int count = 0; |
| 568 | int size_offset; |
| 569 | uint8_t data[MAX_GAME_DATA_SIZE]; |
| 570 | |
| 571 | size_offset = START_DATA(MP_WORLD_STATES, data, &count); |
| 572 | |
| 573 | MultiAddByte(WS_LEVELGOAL, data, &count); |
| 574 | MultiAddUshort(index, data, &count); |
| 575 | |
| 576 | MultiAddInt(m_priority, data, &count); |
| 577 | |
| 578 | char name[256]; |
| 579 | GetName(name, 256); |
| 580 | int len = strlen(name) + 1; |
| 581 | MultiAddByte(len, data, &count); |
| 582 | memcpy(&data[count], name, len); |
| 583 | count += len; |
| 584 | |
| 585 | MultiAddInt(m_flags, data, &count); |
| 586 | |
| 587 | MultiAddByte(WS_END, data, &count); |
| 588 | END_DATA(count, data, size_offset); |
| 589 | |
| 590 | // Send it out |
| 591 | nw_SendReliable(NetPlayers[pnum].reliable_socket, data, count, false); |
| 592 | } |
| 593 | |
| 594 | void lgoal::ResetModified(void) { m_modified = 0; } |
| 595 |
no test coverage detected