AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
lfg::Lfg5Guids Class Reference

#include "LFG.h"

Public Member Functions

 Lfg5Guids ()
 
 Lfg5Guids (ObjectGuid g)
 
 Lfg5Guids (Lfg5Guids const &x)
 
 Lfg5Guids (Lfg5Guids const &x, bool)
 
 ~Lfg5Guids ()
 
void addRoles (LfgRolesMap const &r)
 
void clear ()
 
bool empty () const
 
ObjectGuid front () const
 
uint8 size () const
 
void insert (const ObjectGuid &g)
 
void force_insert_front (const ObjectGuid &g)
 
void remove (const ObjectGuid &g)
 
bool hasGuid (const ObjectGuid &g) const
 
bool operator< (const Lfg5Guids &x) const
 
bool operator== (const Lfg5Guids &x) const
 
void operator= (const Lfg5Guids &x)
 
std::string toString () const
 

Public Attributes

std::array< ObjectGuid, 5 > guids = { }
 
LfgRolesMaproles
 

Detailed Description

Constructor & Destructor Documentation

◆ Lfg5Guids() [1/4]

lfg::Lfg5Guids::Lfg5Guids ( )
inline
120 {
122 roles = nullptr;
123 }
static ObjectGuid const Empty
Definition ObjectGuid.h:120
LfgRolesMap * roles
Definition LFG.h:118
std::array< ObjectGuid, 5 > guids
Definition LFG.h:117

References ObjectGuid::Empty, guids, and roles.

◆ Lfg5Guids() [2/4]

lfg::Lfg5Guids::Lfg5Guids ( ObjectGuid  g)
inline
126 {
128 guids[0] = g;
129 roles = nullptr;
130 }

References ObjectGuid::Empty, guids, and roles.

◆ Lfg5Guids() [3/4]

lfg::Lfg5Guids::Lfg5Guids ( Lfg5Guids const &  x)
inline
133 {
134 guids = x.guids;
135 roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
136 }
std::map< ObjectGuid, uint8 > LfgRolesMap
Definition LFG.h:111

References guids, and roles.

◆ Lfg5Guids() [4/4]

lfg::Lfg5Guids::Lfg5Guids ( Lfg5Guids const &  x,
bool   
)
inline
139 {
140 guids = x.guids;
141 roles = nullptr;
142 }

References guids, and roles.

◆ ~Lfg5Guids()

lfg::Lfg5Guids::~Lfg5Guids ( )
inline
144{ delete roles; }

References roles.

Member Function Documentation

◆ addRoles()

void lfg::Lfg5Guids::addRoles ( LfgRolesMap const &  r)
inline
145{ roles = new LfgRolesMap(r); }

References roles.

Referenced by lfg::LFGQueue::CheckCompatibility().

◆ clear()

void lfg::Lfg5Guids::clear ( )
inline
146{ guids.fill(ObjectGuid::Empty); }

References ObjectGuid::Empty, and guids.

◆ empty()

bool lfg::Lfg5Guids::empty ( ) const
inline

◆ force_insert_front()

void lfg::Lfg5Guids::force_insert_front ( const ObjectGuid g)
inline
269 {
270 if (guids[3])
271 {
272 guids[4] = guids[3];
273 }
274
275 if (guids[2])
276 {
277 guids[3] = guids[2];
278 }
279
280 if (guids[1])
281 {
282 guids[2] = guids[1];
283 }
284
285 guids[1] = guids[0];
286 guids[0] = g;
287 }

References guids.

Referenced by lfg::LFGQueue::CheckCompatibility().

◆ front()

ObjectGuid lfg::Lfg5Guids::front ( ) const
inline
148{ return guids[0]; }

References guids.

Referenced by lfg::LFGQueue::CheckCompatibility().

◆ hasGuid()

bool lfg::Lfg5Guids::hasGuid ( const ObjectGuid g) const
inline
423 {
424 return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g);
425 }

References guids.

◆ insert()

void lfg::Lfg5Guids::insert ( const ObjectGuid g)
inline
178 {
179 // avoid loops for performance
180 if (!guids[0])
181 {
182 guids[0] = g;
183 return;
184 }
185
186 if (g <= guids[0])
187 {
188 if (guids[3])
189 {
190 guids[4] = guids[3];
191 }
192
193 if (guids[2])
194 {
195 guids[3] = guids[2];
196 }
197
198 if (guids[1])
199 {
200 guids[2] = guids[1];
201 }
202
203 guids[1] = guids[0];
204 guids[0] = g;
205
206 return;
207 }
208
209 if (!guids[1])
210 {
211 guids[1] = g;
212 return;
213 }
214
215 if (g <= guids[1])
216 {
217 if (guids[3])
218 {
219 guids[4] = guids[3];
220 }
221
222 if (guids[2])
223 {
224 guids[3] = guids[2];
225 }
226
227 guids[2] = guids[1];
228 guids[1] = g;
229
230 return;
231 }
232
233 if (!guids[2])
234 {
235 guids[2] = g;
236 return;
237 }
238
239 if (g <= guids[2])
240 {
241 if (guids[3])
242 {
243 guids[4] = guids[3];
244 }
245
246 guids[3] = guids[2];
247 guids[2] = g;
248
249 return;
250 }
251
252 if (!guids[3])
253 {
254 guids[3] = g;
255 return;
256 }
257
258 if (g <= guids[3])
259 {
260 guids[4] = guids[3];
261 guids[3] = g;
262 return;
263 }
264
265 guids[4] = g;
266 }

References guids.

Referenced by lfg::LFGQueue::CheckCompatibility().

◆ operator<()

bool lfg::Lfg5Guids::operator< ( const Lfg5Guids x) const
inline
428 {
429 if (guids[0] <= x.guids[0])
430 {
431 if (guids[0] != x.guids[0])
432 {
433 return true;
434 }
435
436 if (guids[1] <= x.guids[1])
437 {
438 if (guids[1] != x.guids[1])
439 {
440 return true;
441 }
442
443 if (guids[2] <= x.guids[2])
444 {
445 if (guids[2] != x.guids[2])
446 {
447 return true;
448 }
449
450 if (guids[3] <= x.guids[3])
451 {
452 if (guids[3] != x.guids[3])
453 {
454 return true;
455 }
456
457 if (guids[4] <= x.guids[4])
458 {
459 return !(guids[4] == x.guids[4]);
460 }
461 }
462 }
463 }
464 }
465
466 return false;
467 }

References guids.

◆ operator=()

void lfg::Lfg5Guids::operator= ( const Lfg5Guids x)
inline
475 {
476 guids = x.guids;
477 delete roles;
478 roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
479 }

References guids, and roles.

◆ operator==()

bool lfg::Lfg5Guids::operator== ( const Lfg5Guids x) const
inline
470 {
471 return guids[0] == x.guids[0] && guids[1] == x.guids[1] && guids[2] == x.guids[2] && guids[3] == x.guids[3] && guids[4] == x.guids[4];
472 }

References guids.

◆ remove()

void lfg::Lfg5Guids::remove ( const ObjectGuid g)
inline
290 {
291 // avoid loops for performance
292 if (guids[0] == g)
293 {
294 if (guids[1])
295 {
296 guids[0] = guids[1];
297 }
298 else
299 {
300 guids[0].Clear();
301 return;
302 }
303
304 if (guids[2])
305 {
306 guids[1] = guids[2];
307 }
308 else
309 {
310 guids[1].Clear();
311 return;
312 }
313
314 if (guids[3])
315 {
316 guids[2] = guids[3];
317 }
318 else
319 {
320 guids[2].Clear();
321 return;
322 }
323
324 if (guids[4])
325 {
326 guids[3] = guids[4];
327 }
328 else
329 {
330 guids[3].Clear();
331 return;
332 }
333
334 guids[4].Clear();
335 return;
336 }
337
338 if (guids[1] == g)
339 {
340 if (guids[2])
341 {
342 guids[1] = guids[2];
343 }
344 else
345 {
346 guids[1].Clear();
347 return;
348 }
349
350 if (guids[3])
351 {
352 guids[2] = guids[3];
353 }
354 else
355 {
356 guids[2].Clear();
357 return;
358 }
359
360 if (guids[4])
361 {
362 guids[3] = guids[4];
363 }
364 else
365 {
366 guids[3].Clear();
367 return;
368 }
369
370 guids[4].Clear();
371 return;
372 }
373
374 if (guids[2] == g)
375 {
376 if (guids[3])
377 {
378 guids[2] = guids[3];
379 }
380 else
381 {
382 guids[2].Clear();
383 return;
384 }
385
386 if (guids[4])
387 {
388 guids[3] = guids[4];
389 }
390 else
391 {
392 guids[3].Clear();
393 return;
394 }
395
396 guids[4].Clear();
397 return;
398 }
399
400 if (guids[3] == g)
401 {
402 if (guids[4])
403 {
404 guids[3] = guids[4];
405 }
406 else
407 {
408 guids[3].Clear();
409 return;
410 }
411
412 guids[4].Clear();
413 return;
414 }
415
416 if (guids[4] == g)
417 {
418 guids[4].Clear();
419 }
420 }

References guids.

Referenced by lfg::LFGMgr::RemoveProposal().

◆ size()

uint8 lfg::Lfg5Guids::size ( ) const
inline
151 {
152 if (guids[2])
153 {
154 if (guids[4])
155 {
156 return 5;
157 }
158 else if (guids[3])
159 {
160 return 4;
161 }
162
163 return 3;
164 }
165 else if (guids[1])
166 {
167 return 2;
168 }
169 else if (guids[0])
170 {
171 return 1;
172 }
173
174 return 0;
175 }

References guids.

Referenced by lfg::LFGQueue::CheckCompatibility(), and lfg::LFGQueue::UpdateBestCompatibleInQueue().

◆ toString()

std::string lfg::Lfg5Guids::toString ( ) const
inline
482 {
483 std::ostringstream o;
484 o << guids[0].ToString() << "," << guids[1].ToString() << "," << guids[2].ToString() << "," << guids[3].ToString() << "," << guids[4].ToString() << ":" << (roles ? 1 : 0);
485 return o.str();
486 }

References guids, and roles.

Referenced by lfg::LFGQueue::AddToCompatibles(), lfg::LFGQueue::CheckCompatibility(), and lfg::LFGQueue::UpdateBestCompatibleInQueue().

Member Data Documentation

◆ guids

◆ roles


The documentation for this class was generated from the following file: