Skip to content

Commit

Permalink
fix: исправлен экспорт спавна в ЧН СДК.
Browse files Browse the repository at this point in the history
  • Loading branch information
abramcumner committed Sep 2, 2018
1 parent b467be5 commit 52721d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
28 changes: 16 additions & 12 deletions sources/xray_re/xr_entity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1454,14 +1454,16 @@ void cse_alife_human_abstract::state_read(xr_packet& packet, uint16_t size)
packet.r_u32();
}
}
packet.r_seq(packet.r_u32(), m_equipment_preferences);
if (m_equipment_preferences.size() != 5)
msg("wrong size equipment_preferences %" PRIuSIZET ", expected %d %s (%s)", m_equipment_preferences.size(), 5, name_replace().c_str(),
name().c_str());
packet.r_seq(packet.r_u32(), m_main_weapon_preferences);
if (m_main_weapon_preferences.size() != 4)
msg("wrong size main_weapon_preferences %" PRIuSIZET ", expected %d %s (%s)", m_main_weapon_preferences.size(), 4, name_replace().c_str(),
name().c_str());
if (!packet.is_ini()) {
packet.r_seq(packet.r_u32(), m_equipment_preferences);
if (m_equipment_preferences.size() != 5)
msg("wrong size equipment_preferences %" PRIuSIZET ", expected %d %s (%s)", m_equipment_preferences.size(), 5, name_replace().c_str(),
name().c_str());
packet.r_seq(packet.r_u32(), m_main_weapon_preferences);
if (m_main_weapon_preferences.size() != 4)
msg("wrong size main_weapon_preferences %" PRIuSIZET ", expected %d %s (%s)", m_main_weapon_preferences.size(), 4, name_replace().c_str(),
name().c_str());
}
}
if (m_version >= CSE_VERSION_0x6e && m_version < 0x70)
packet.r_u16(m_smart_terrain_id);
Expand All @@ -1478,10 +1480,12 @@ void cse_alife_human_abstract::state_write(xr_packet& packet)
}
if (m_version < CSE_VERSION_0x76)
packet.w_u32(0); // m_tpKnownCustomers
packet.w_size_u32(m_equipment_preferences.size());
packet.w_seq(m_equipment_preferences);
packet.w_size_u32(m_main_weapon_preferences.size());
packet.w_seq(m_main_weapon_preferences);
if (!packet.is_ini()) {
packet.w_size_u32(m_equipment_preferences.size());
packet.w_seq(m_equipment_preferences);
packet.w_size_u32(m_main_weapon_preferences.size());
packet.w_seq(m_main_weapon_preferences);
}
if (m_version >= CSE_VERSION_0x6e && m_version < 0x70)
packet.w_u16(m_smart_terrain_id);
}
Expand Down
3 changes: 3 additions & 0 deletions sources/xray_re/xr_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class xr_packet {
void init(const uint8_t* data, size_t size);
virtual const uint8_t* buf() const;

virtual bool is_ini() const { return false; }

private:
uint8_t m_buf[BUFFER_SIZE];
size_t m_w_pos;
Expand Down Expand Up @@ -152,6 +154,7 @@ class xr_ini_packet : public xr_packet {

virtual const uint8_t* buf() const;

bool is_ini() const override { return true; }
private:
xr_ini_writer* w;
uint32_t m_counter;
Expand Down

0 comments on commit 52721d2

Please sign in to comment.