|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T l
Length: 1738 (0x6ca) Types: TextFile Names: »levelsw.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/Sun/Mines/levelsw.c«
/* * level display/control subwindow handling * * Copyright (c) 1987 Tom Anderson; 20831 Frank Waters Road; * Stanwood, WA 98282. All rights reserved. */ static char copyright[] = "Copyright 1987 Tom Anderson"; #include <stdio.h> #include <suntool/tool_hs.h> #include <suntool/panel.h> #include <strings.h> #include "mines.h" #define MAX_SEND_LENGTH 60 struct toolsw * LevelSW; Panel LevelPanel; Panel_item ChangeLevelItem; /*ARGSUSED*/ levelProc(item, event) Panel_item item; struct inputevent *event; { char c[MAX_SEND_LENGTH+1]; static int oldLevel = DEFAULT_MINE_QTY; int newLevel; /* get the new level request text */ strcpy(c, (char *) panel_get_value(ChangeLevelItem)); /* set the new level text to nil */ panel_set_value(ChangeLevelItem, ""); if (sscanf(c, "%d", &newLevel) == 1 && newLevel >= 0 && newLevel < SIDE_SIZE * SIDE_SIZE - 20) oldLevel = newLevel; InitBoard(oldLevel); DrawBoard(); Message(MineWarningMessage()); sprintf(c, "[%d]", oldLevel); panel_set(ChangeLevelItem, PANEL_LABEL_STRING, c, 0); } /* * set up the level control subwindow * (if we are playing against the machine, leave them out) */ void InitLevelSW() { char c[128]; if ((LevelSW = panel_create(MinesTool, 0)) == NULL) { fprintf(stderr, "Can't create level control subwindow\n"); exit(1); } sprintf(c, "[%d]", DEFAULT_MINE_QTY); LevelPanel = LevelSW->ts_data; ChangeLevelItem = panel_create_item(LevelPanel, PANEL_TEXT, PANEL_LABEL_STRING, c, PANEL_NOTIFY_STRING, "\n\r", PANEL_NOTIFY_LEVEL, PANEL_SPECIFIED, PANEL_NOTIFY_PROC, levelProc, PANEL_VALUE_STORED_LENGTH, MAX_SEND_LENGTH, 0); panel_fit_height(LevelPanel); }