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
128 {
130 roles = nullptr;
131 }
static ObjectGuid const Empty
Definition ObjectGuid.h:120
LfgRolesMap * roles
Definition LFG.h:126
std::array< ObjectGuid, 5 > guids
Definition LFG.h:125

References ObjectGuid::Empty, guids, and roles.

◆ Lfg5Guids() [2/4]

lfg::Lfg5Guids::Lfg5Guids ( ObjectGuid  g)
inline
134 {
136 guids[0] = g;
137 roles = nullptr;
138 }

References ObjectGuid::Empty, guids, and roles.

◆ Lfg5Guids() [3/4]

lfg::Lfg5Guids::Lfg5Guids ( Lfg5Guids const &  x)
inline
141 {
142 guids = x.guids;
143 roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
144 }
std::map< ObjectGuid, uint8 > LfgRolesMap
Definition LFG.h:119

References guids, and roles.

◆ Lfg5Guids() [4/4]

lfg::Lfg5Guids::Lfg5Guids ( Lfg5Guids const &  x,
bool   
)
inline
147 {
148 guids = x.guids;
149 roles = nullptr;
150 }

References guids, and roles.

◆ ~Lfg5Guids()

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

References roles.

Member Function Documentation

◆ addRoles()

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

References roles.

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

◆ clear()

void lfg::Lfg5Guids::clear ( )
inline
154{ 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
277 {
278 if (guids[3])
279 {
280 guids[4] = guids[3];
281 }
282
283 if (guids[2])
284 {
285 guids[3] = guids[2];
286 }
287
288 if (guids[1])
289 {
290 guids[2] = guids[1];
291 }
292
293 guids[1] = guids[0];
294 guids[0] = g;
295 }

References guids.

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

◆ front()

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

References guids.

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

◆ hasGuid()

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

References guids.

◆ insert()

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

References guids.

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

◆ operator<()

bool lfg::Lfg5Guids::operator< ( const Lfg5Guids x) const
inline
436 {
437 if (guids[0] <= x.guids[0])
438 {
439 if (guids[0] != x.guids[0])
440 {
441 return true;
442 }
443
444 if (guids[1] <= x.guids[1])
445 {
446 if (guids[1] != x.guids[1])
447 {
448 return true;
449 }
450
451 if (guids[2] <= x.guids[2])
452 {
453 if (guids[2] != x.guids[2])
454 {
455 return true;
456 }
457
458 if (guids[3] <= x.guids[3])
459 {
460 if (guids[3] != x.guids[3])
461 {
462 return true;
463 }
464
465 if (guids[4] <= x.guids[4])
466 {
467 return !(guids[4] == x.guids[4]);
468 }
469 }
470 }
471 }
472 }
473
474 return false;
475 }

References guids.

◆ operator=()

void lfg::Lfg5Guids::operator= ( const Lfg5Guids x)
inline
483 {
484 guids = x.guids;
485 delete roles;
486 roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
487 }

References guids, and roles.

◆ operator==()

bool lfg::Lfg5Guids::operator== ( const Lfg5Guids x) const
inline
478 {
479 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];
480 }

References guids.

◆ remove()

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

References guids.

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

◆ size()

uint8 lfg::Lfg5Guids::size ( ) const
inline
159 {
160 if (guids[2])
161 {
162 if (guids[4])
163 {
164 return 5;
165 }
166 else if (guids[3])
167 {
168 return 4;
169 }
170
171 return 3;
172 }
173 else if (guids[1])
174 {
175 return 2;
176 }
177 else if (guids[0])
178 {
179 return 1;
180 }
181
182 return 0;
183 }

References guids.

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

◆ toString()

std::string lfg::Lfg5Guids::toString ( ) const
inline
490 {
491 std::ostringstream o;
492 o << guids[0].ToString() << "," << guids[1].ToString() << "," << guids[2].ToString() << "," << guids[3].ToString() << "," << guids[4].ToString() << ":" << (roles ? 1 : 0);
493 return o.str();
494 }

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: