Bool LogEntry::CanAccessHall(h_slot hallslot) const { assert(this); assert(hallslot >= 0); assert(hallslot < cfg.maxhalls); if (!HallData[hallslot].IsOwned()) { return (TRUE); } if (IsMainSysop()) { return (TRUE); } if (!HallData[hallslot].IsBoolGroup()) { return (IsInGroup(HallData[hallslot].GetGroupNumber())); } else { L2FGT = this; BoolExpr Buffer; return (EvaluateBooleanExpression(HallData[hallslot].GetGroupExpression(Buffer), GroupTester)); } }
Bool LogEntry::HasRoomPrivileges(r_slot roomslot) const { assert(this); assert(roomslot >= 0); assert(roomslot < cfg.maxrooms); return (!RoomTab[roomslot].IsPrivilegedGroup() || IsInGroup(RoomTab[roomslot].GetPGroupNumber())); }
////////// // Adds object to group with specified index (If object is already in // group, nothing is changed.) void ON_3dmObjectAttributes::AddToGroup( int group_index // zero based group index ) { if ( group_index >= 0 ) { if ( !IsInGroup(group_index) ) m_group.Append(group_index); } }
///////////////////////////////////////////////// /// [Serverside] Fog of War: Unit can be seen by other unit through invisibility effects /// /// @note Relations API Tier 3 /// /// This function is not intented to have client-side counterpart by original design. /// A helper function to determine if unit is always visible to another unit. ///////////////////////////////////////////////// bool Unit::IsFogOfWarVisibleStealth(Unit const* other) const { // Gamemasters can see through invisibility if (other->GetTypeId() == TYPEID_PLAYER && static_cast<Player const*>(other)->isGameMaster()) return true; switch (sWorld.getConfig(CONFIG_UINT32_FOGOFWAR_STEALTH)) { default: return IsInGroup(other); case 1: return CanCooperate(other); } }
static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int _hLang) { char setting[512]; mir_snprintf(setting, "Position_%s", name); extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000)); mir_snprintf(setting, "Slot_%s", name); int slot = db_get_w(NULL, MODULE_NAME, setting, 1); if (slot == (WORD)-1) slot = -1; extra->setSlot(slot); extra->m_hLangpack = _hLang; registeredExtraIcons.insert(extra); extraIconsByHandle.insert(extra); LIST<ExtraIconGroup> groups(1); LoadGroups(groups); ExtraIconGroup *group = IsInGroup(groups, extra); if (group != NULL) RebuildListsBasedOnGroups(groups); else { for (int i = 0; i < groups.getCount(); i++) delete groups[i]; extraIconsBySlot.insert(extra); } if (slot >= 0 || group != NULL) { if (clistRebuildAlreadyCalled) extra->rebuildIcons(); slot = 0; for (int i = 0; i < extraIconsBySlot.getCount(); i++) { ExtraIcon *ex = extraIconsBySlot[i]; if (ex->getSlot() < 0) continue; int oldSlot = ex->getSlot(); ex->setSlot(slot++); if (clistApplyAlreadyCalled && (ex == group || ex == extra || oldSlot != slot)) extra->applyIcons(); } } }
void LogEntry2::ResumeSyncSend(void) { if (!SyncSendPaused) { return; } SyncSendPaused = FALSE; if (SyncNumber == CERROR) { return; } // We just unpaused and we're assigned a record number... tell everybody // else all about ourselves. for (g_slot G = 0; G < (g_slot) GetNumberOfBits(); G++) { SetInGroup(G, IsInGroup(G)); } }
INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam) { if (wParam == 0) return 0; EXTRAICON_INFO *ei = (EXTRAICON_INFO *) wParam; if (ei->cbSize < (int) sizeof(EXTRAICON_INFO)) return 0; if (ei->type != EXTRAICON_TYPE_CALLBACK && ei->type != EXTRAICON_TYPE_ICOLIB) return 0; if (IsEmpty(ei->name) || IsEmpty(ei->description)) return 0; if (ei->type == EXTRAICON_TYPE_CALLBACK && (ei->ApplyIcon == NULL || ei->RebuildIcons == NULL)) return 0; const char *desc = Translate(ei->description); BaseExtraIcon *extra = GetExtraIconByName(ei->name); if (extra != NULL) { if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_ICOLIB) return 0; // Found one, now merge it if (_stricmp(extra->getDescription(), desc)) { string newDesc = extra->getDescription(); newDesc += " / "; newDesc += desc; extra->setDescription(newDesc.c_str()); } if (!IsEmpty(ei->descIcon)) extra->setDescIcon(ei->descIcon); if (ei->OnClick != NULL) extra->setOnClick(ei->OnClick, ei->onClickParam); if (extra->getSlot() > 0) { if (clistRebuildAlreadyCalled) extra->rebuildIcons(); if (clistApplyAlreadyCalled) extraIconsByHandle[extra->getID() - 1]->applyIcons(); } return extra->getID(); } size_t id = registeredExtraIcons.size() + 1; switch (ei->type) { case EXTRAICON_TYPE_CALLBACK: extra = new CallbackExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->RebuildIcons, ei->ApplyIcon, ei->OnClick, ei->onClickParam); break; case EXTRAICON_TYPE_ICOLIB: extra = new IcolibExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->OnClick, ei->onClickParam); break; default: return 0; } char setting[512]; mir_snprintf(setting, MAX_REGS(setting), "Position_%s", ei->name); extra->setPosition(DBGetContactSettingWord(NULL, MODULE_NAME, setting, 1000)); mir_snprintf(setting, MAX_REGS(setting), "Slot_%s", ei->name); int slot = DBGetContactSettingWord(NULL, MODULE_NAME, setting, 1); if (slot == (WORD) -1) slot = -1; extra->setSlot(slot); registeredExtraIcons.push_back(extra); extraIconsByHandle.push_back(extra); vector<ExtraIconGroup *> groups; LoadGroups(groups); ExtraIconGroup *group = IsInGroup(groups, extra); if (group != NULL) { RebuildListsBasedOnGroups(groups); } else { for (unsigned int i = 0; i < groups.size(); ++i) delete groups[i]; extraIconsBySlot.push_back(extra); std::sort(extraIconsBySlot.begin(), extraIconsBySlot.end(), compareFunc()); } if (slot >= 0 || group != NULL) { if (clistRebuildAlreadyCalled) extra->rebuildIcons(); slot = 0; for (unsigned int i = 0; i < extraIconsBySlot.size(); ++i) { ExtraIcon *ex = extraIconsBySlot[i]; if (ex->getSlot() < 0) continue; int oldSlot = ex->getSlot(); ex->setSlot(slot++); if (clistApplyAlreadyCalled && (ex == group || ex == extra || oldSlot != slot)) extra->applyIcons(); } } return id; }
INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam) { if (wParam == 0) return 0; EXTRAICON_INFO *ei = (EXTRAICON_INFO *)wParam; if (ei->cbSize < (int)sizeof(EXTRAICON_INFO)) return 0; if (ei->type != EXTRAICON_TYPE_CALLBACK && ei->type != EXTRAICON_TYPE_ICOLIB) return 0; if (IsEmpty(ei->name) || IsEmpty(ei->description)) return 0; if (ei->type == EXTRAICON_TYPE_CALLBACK && (ei->ApplyIcon == NULL || ei->RebuildIcons == NULL)) return 0; ptrT tszDesc(mir_a2t(ei->description)); TCHAR *desc = TranslateTH(lParam, tszDesc); BaseExtraIcon *extra = GetExtraIconByName(ei->name); if (extra != NULL) { if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_ICOLIB) return 0; // Found one, now merge it if (_tcsicmp(extra->getDescription(), desc)) { CMString newDesc = extra->getDescription(); newDesc += _T(" / "); newDesc += desc; extra->setDescription(newDesc.c_str()); } if (!IsEmpty(ei->descIcon)) extra->setDescIcon(ei->descIcon); if (ei->OnClick != NULL) extra->setOnClick(ei->OnClick, ei->onClickParam); if (extra->getSlot() > 0) { if (clistRebuildAlreadyCalled) extra->rebuildIcons(); if (clistApplyAlreadyCalled) extraIconsByHandle[extra->getID() - 1]->applyIcons(); } return extra->getID(); } int id = registeredExtraIcons.getCount() + 1; switch (ei->type) { case EXTRAICON_TYPE_CALLBACK: extra = new CallbackExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->RebuildIcons, ei->ApplyIcon, ei->OnClick, ei->onClickParam); break; case EXTRAICON_TYPE_ICOLIB: extra = new IcolibExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->OnClick, ei->onClickParam); break; default: return 0; } char setting[512]; mir_snprintf(setting, SIZEOF(setting), "Position_%s", ei->name); extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000)); mir_snprintf(setting, SIZEOF(setting), "Slot_%s", ei->name); int slot = db_get_w(NULL, MODULE_NAME, setting, 1); if (slot == (WORD)-1) slot = -1; extra->setSlot(slot); extra->hLangpack = (int)lParam; registeredExtraIcons.insert(extra); extraIconsByHandle.insert(extra); LIST<ExtraIconGroup> groups(1); LoadGroups(groups); ExtraIconGroup *group = IsInGroup(groups, extra); if (group != NULL) RebuildListsBasedOnGroups(groups); else { for (int i = 0; i < groups.getCount(); i++) delete groups[i]; extraIconsBySlot.insert(extra); } if (slot >= 0 || group != NULL) { if (clistRebuildAlreadyCalled) extra->rebuildIcons(); slot = 0; for (int i = 0; i < extraIconsBySlot.getCount(); i++) { ExtraIcon *ex = extraIconsBySlot[i]; if (ex->getSlot() < 0) continue; int oldSlot = ex->getSlot(); ex->setSlot(slot++); if (clistApplyAlreadyCalled && (ex == group || ex == extra || oldSlot != slot)) extra->applyIcons(); } } return id; }