/* * GroupPrint: Display the members of the group with the given name. */ void GroupPrint(char *group_name) { UserGroup g; int i, index; COLORREF color; BYTE style; ID id; char buf[MAX_CHARNAME + 10]; index = FindGroupByName(group_name); switch (index) { case GROUP_NOMATCH: GameMessage(GetString(hInst, IDS_BADGROUPNAME)); break; case GROUP_AMBIGUOUS: GameMessage(GetString(hInst, IDS_DUPLICATEGROUPNAME)); break; default: group_name = groups[index]; GroupLoad(group_name, &g); GameMessagePrintf(GetString(hInst, IDS_GROUPMEMBERS), MAX_GROUPNAME, group_name); color = RGB(0, 0, 0); style = STYLE_NORMAL; EditBoxStartAdd(); for (i=0; i < g.num_users; i++) { if (i != 0) DisplayMessage(", ", color, style); id = FindPlayerByNameExact(g.names[i]); // Show player in red if logged on if (id == 0 || id == INVALID_ID) DisplayMessage(g.names[i], color, style); else { sprintf(buf, "~r%s~n", g.names[i]); DisplayMessage(buf, color, style); } } EditBoxEndAdd(); break; } }
/* * GuildListDrawItem: Message handler for item list boxes. Return TRUE iff * message is handled. */ BOOL GuildListDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpdis) { char name[MAXUSERNAME]; HBRUSH hbrush; RECT rcItem; switch (lpdis->itemAction) { case ODA_SELECT: case ODA_DRAWENTIRE: /* If box is empty, do nothing */ if (lpdis->itemID == -1) return TRUE; ListBox_GetText(lpdis->hwndItem, lpdis->itemID, name); // Draw logged on people in a different color if (FindPlayerByNameExact(name)) SetTextColor(lpdis->hDC, logged_on_color); else if (lpdis->itemState & ODS_SELECTED) SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); else SetTextColor(lpdis->hDC, GetSysColor(COLOR_WINDOWTEXT)); if (lpdis->itemState & ODS_SELECTED) hbrush = GetSysColorBrush(COLOR_HIGHLIGHT); else hbrush = GetSysColorBrush(COLOR_WINDOW); rcItem = lpdis->rcItem; FillRect(lpdis->hDC, &rcItem, hbrush); SetBkMode(lpdis->hDC, TRANSPARENT); rcItem.left += 2*GetSystemMetrics(SM_CXBORDER); DrawText(lpdis->hDC, name, strlen(name), &rcItem, DT_VCENTER | DT_LEFT); break; case ODA_FOCUS: DrawFocusRect(lpdis->hDC, &lpdis->rcItem); break; } return TRUE; }