| 329 | } |
| 330 | |
| 331 | void CTarget::LoadMulti(int offsetX, int offsetY, char offsetZ) |
| 332 | { |
| 333 | UnloadMulti(); |
| 334 | |
| 335 | CIndexMulti &index = g_Index.m_Multi[MultiGraphic - 1]; |
| 336 | int count = (int)index.Count; |
| 337 | if (index.UopBlock != nullptr) |
| 338 | { |
| 339 | std::vector<uint8_t> data = g_FileManager.m_MultiCollection.GetData(index.UopBlock); |
| 340 | if (data.empty()) |
| 341 | { |
| 342 | return; |
| 343 | } |
| 344 | |
| 345 | CDataReader reader(&data[0], data.size()); |
| 346 | reader.Move(8); //ID + Count |
| 347 | for (int i = 0; i < count; i++) |
| 348 | { |
| 349 | const uint16_t graphic = reader.ReadUInt16LE(); |
| 350 | const int16_t x = reader.ReadInt16LE(); |
| 351 | const int16_t y = reader.ReadInt16LE(); |
| 352 | const int8_t z = (int8_t)reader.ReadInt16LE(); |
| 353 | const uint16_t _flags = reader.ReadUInt16LE(); |
| 354 | (void)_flags; |
| 355 | const uint32_t clilocsCount = reader.ReadUInt32LE(); |
| 356 | if (clilocsCount != 0) |
| 357 | { |
| 358 | reader.Move(clilocsCount * 4); |
| 359 | } |
| 360 | |
| 361 | auto mo = new CMultiObject(graphic, x + offsetX, y + offsetY, z + (char)offsetZ, 2); |
| 362 | g_MapManager.AddRender(mo); |
| 363 | AddMultiObject(mo); |
| 364 | } |
| 365 | } |
| 366 | else if (index.Address != 0) |
| 367 | { |
| 368 | int itemOffset = sizeof(MULTI_BLOCK); |
| 369 | |
| 370 | if (g_Config.ClientVersion >= CV_7090) |
| 371 | { |
| 372 | itemOffset = sizeof(MULTI_BLOCK_NEW); |
| 373 | } |
| 374 | |
| 375 | for (int j = 0; j < count; j++) |
| 376 | { |
| 377 | MULTI_BLOCK *pmb = (MULTI_BLOCK *)(index.Address + (j * itemOffset)); |
| 378 | |
| 379 | CMultiObject *mo = new CMultiObject( |
| 380 | pmb->ID, offsetX + pmb->X, offsetY + pmb->Y, offsetZ + (char)pmb->Z, 2); |
| 381 | g_MapManager.AddRender(mo); |
| 382 | AddMultiObject(mo); |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | void CTarget::AddMultiObject(CMultiObject *obj) |
| 388 | { |
nothing calls this directly
no test coverage detected