/* * StatsMainReceive: We received main group of stats from server. * stats is a list of pointers to Statistic structures. */ void StatsMainReceive(list_type stats) { int height, y, count; list_type l; TOOLINFO ti; StatsMainDestroy(); // Destroy existent controls main_stats = stats; pinfo.vigor = MIN_VIGOR; // Initialize for changing color of bar graph ti.cbSize = sizeof(TOOLINFO); ti.uFlags = 0; ti.hwnd = cinfo->hMain; ti.hinst = hInst; ti.lpszText = 0; count = 0; // Create graph controls for integer stats height = STAT_ICON_HEIGHT + STATS_MAIN_SPACING; //y = ENCHANT_SIZE + 2 * ENCHANT_BORDER - 1 + EDGETREAT_HEIGHT; y = ENCHANT_BORDER + EDGETREAT_HEIGHT + ((USERAREA_HEIGHT - (STAT_ICON_HEIGHT * 3)) / 2); for (l = stats; l != NULL; l = l->next) { Statistic *s = (Statistic *) (l->data); s->y = y; s->cy = height; y += height; if (s->numeric.tag != STAT_INT) continue; if (s->num == STAT_XP) s->hControl = CreateWindow(GraphCtlGetClassName(), NULL, WS_CHILD | WS_VISIBLE | GCS_LIMITBAR | GCS_NUMBER | GCS_XP, 0, 0, 0, 0, cinfo->hMain, NULL, hInst, NULL); else s->hControl = CreateWindow(GraphCtlGetClassName(), NULL, WS_CHILD | WS_VISIBLE | GCS_LIMITBAR | GCS_NUMBER, 0, 0, 0, 0, cinfo->hMain, NULL, hInst, NULL); StatsMainSetColor(s); StatsMainChange(s); // Add tooltip for icon ti.uId = STAT_TOOLTIP_BASE + count; SendMessage(cinfo->hToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti); count++; } StatsMainRedraw(); StatsMainMove(); }
/* * InterfaceExit: Called when leaving game; delete interface. */ void InterfaceExit(void) { AliasExit(); ActionsExit(); SpellsExit(); InventoryBoxDestroy(); UserAreaDestroy(); StatsMainDestroy(); // must get rid of main stat windows before clearing all stats StatsDestroy(); EnchantmentsDestroy(); AbortGuildDialogs(); AbortGroupDialog(); InterfaceDrawExit(); // Restore window title to normal SetWindowText(cinfo->hMain, cinfo->szAppName); }