| 68 | } |
| 69 | |
| 70 | void CPatrolPathStorage::load(IReader& stream) |
| 71 | { |
| 72 | IReader* chunk; |
| 73 | |
| 74 | chunk = stream.open_chunk(0); |
| 75 | u32 size = chunk->r_u32(); |
| 76 | chunk->close(); |
| 77 | |
| 78 | m_registry.clear(); |
| 79 | |
| 80 | PATROL_REGISTRY::value_type pair; |
| 81 | |
| 82 | chunk = stream.open_chunk(1); |
| 83 | for (u32 i = 0; i < size; ++i) |
| 84 | { |
| 85 | IReader* chunk1; |
| 86 | chunk1 = chunk->open_chunk(i); |
| 87 | |
| 88 | IReader* chunk2; |
| 89 | chunk2 = chunk1->open_chunk(0); |
| 90 | load_data(pair.first, *chunk2); |
| 91 | chunk2->close(); |
| 92 | |
| 93 | chunk2 = chunk1->open_chunk(1); |
| 94 | load_data(pair.second, *chunk2); |
| 95 | chunk2->close(); |
| 96 | |
| 97 | chunk1->close(); |
| 98 | |
| 99 | VERIFY3(m_registry.find(pair.first) == m_registry.end(), "Duplicated patrol path found ", *pair.first); |
| 100 | |
| 101 | #ifdef DEBUG |
| 102 | pair.second->name(pair.first); |
| 103 | #endif |
| 104 | |
| 105 | m_registry.insert(pair); |
| 106 | } |
| 107 | |
| 108 | chunk->close(); |
| 109 | } |
| 110 | |
| 111 | void CPatrolPathStorage::save(IWriter& stream) |
| 112 | { |