void MainWindow::closeEvent(QCloseEvent *event) { closeAll(); saveStatus(); event->accept(); }
void HaliteDialog::OnClose() { saveStatus(); if(::IsWindow(m_hWnd)) { ::DestroyWindow(m_hWnd); } }
Local void addChords(struct LOC_processLine *LINK) { struct LOC_addChords V; Char w[256]; short j = 1; short mus_line; paragraph_index0 chord_line; boolean arpeggio; Char STR1[256]; short FORLIM; V.LINK = LINK; saveStatus(LINK->voice); getChordTies(LINK->voice, V.pitches, V.labels); *LINK->chords = '\0'; chord_line = chordLineNo(LINK->voice); if (chord_line == 0) LINK->no_chords = true; if (LINK->no_chords) return; GetNextWord(w, P[chord_line-1], blank, dummy); sprintf(STR1, "%c", barsym); if (!strcmp(w, STR1) || *w == '\0') LINK->no_chords = true; sprintf(STR1, "%c", tilde); if (!strcmp(w, STR1) || LINK->no_chords) return; mus_line = line_no; line_no = orig_line_no[chord_line-1]; arpeggio = (w[0] == '?'); if (arpeggio) { strcpy(LINK->chords, " ?"); predelete(w, 1); } *V.nt = '\0'; while (j <= strlen(w)) { if (w[j-1] == '{' || strcmp(V.nt, "{") && w[j-1] >= 'a' && w[j-1] <= 'g') outChord(&V); else if (w[j-1] == chord_flat) w[j-1] = 'f'; else if (w[j-1] == chord_left) w[j-1] = 'e'; sprintf(V.nt + strlen(V.nt), "%c", w[j-1]); j++; } if (*V.nt != '\0') outChord(&V); if (arpeggio) strcat(LINK->chords, " ?"); strcat(LINK->note, LINK->chords); FORLIM = strlen(V.labels); for (j = 0; j <= FORLIM - 1; j++) { if (V.labels[j] != ' ') error("Tie on chord note started but not finished", print); } line_no = mus_line; }
void GameScene::doCheck() { bool isGameOver = true; //结束边界 4*4的card数值>0 且 相邻card没有相同数值 //4*4的card数值>0 不能在创建Number //判断每一个的上下左右和自己是否相同 for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { if (cardArr[x][y]->getNumber() == 0 || (x<3 && cardArr[x][y]->getNumber() == cardArr[x+1][y]->getNumber()) || (x>0 && cardArr[x][y]->getNumber() == cardArr[x-1][y]->getNumber()) || (y<3 && cardArr[x][y]->getNumber() == cardArr[x][y+1]->getNumber()) || (y>0 && cardArr[x][y]->getNumber() == cardArr[x][y-1]->getNumber()) ) { isGameOver = false; } } } if (isWin()) { successLayer = LayerColor::create(Color4B(0, 0, 0, 180)); Size winSize = Director::getInstance()->getWinSize(); Point centerPos = Point(winSize.width / 2, winSize.height / 2); auto gameOverTitle = Label::createWithSystemFont("YOU WIN","Consolas",80); gameOverTitle->setPosition(centerPos); successLayer->addChild(gameOverTitle); getParent()->addChild(successLayer,1); scheduleOnce(SEL_SCHEDULE(&GameScene::removeSuccessLayer), 2); return; } //isGameOver = true; if (isGameOver) { log("game over"); UserDefault::getInstance()->setBoolForKey("history", false); HighScore::getInstance()->setScore(score); GameOverLayer *gameoverLayer = GameOverLayer::create(Color4B(0, 0, 0, 180)); getParent()->addChild(gameoverLayer,1); Director::getInstance()->pause(); } else { if (shouldCreateCardNumber()) { createCardNumber(); saveStatus(); } } }
static bool initStatusDat(const std::string& datadir) { int nFileMode = File::modeReadOnly | File::modeBinary; bool update = false; File statusDat(datadir, STATUS_DAT); if (!statusDat.Exists()) { LOG << statusDat.full_pathname() << " NOT FOUND!"; LOG << "Recreating " << statusDat.full_pathname() ; memset(&status, 0, sizeof(statusrec)); strcpy(status.date1, "00/00/00"); strcpy(status.date2, status.date1); strcpy(status.date3, status.date1); strcpy(status.log1, "000000.log"); strcpy(status.log2, "000000.log"); strcpy(status.gfiledate, "00/00/00"); status.callernum = 65535; status.wwiv_version = wwiv_num_version; update = true; } else { checkFileSize(statusDat, sizeof(statusrec)); LOG << "Reading " << statusDat.full_pathname() << "..."; if (!statusDat.Open(nFileMode)) { LOG << statusDat.full_pathname() << " NOT FOUND."; return false; } statusDat.Read(&status, sizeof(statusrec)); statusDat.Close(); // version check if (status.wwiv_version > wwiv_num_version) { LOG << "Incorrect version of fix (this is for " << wwiv_num_version << ", you need " << status.wwiv_version << ")"; } time_t val = time(nullptr); char *curDate = dateFromTimeT(val); if (strcmp(status.date1, curDate)) { strcpy(status.date1, curDate); update = true; LOG << "Date error in STATUS.DAT (status.date1) corrected"; } val -= 86400L; curDate = dateFromTimeT(val); if (strcmp(status.date2, curDate)) { strcpy(status.date2, curDate); update = true; LOG << "Date error in STATUS.DAT (status.date2) corrected"; } char logFile[512]; snprintf(logFile, sizeof(logFile), "%s.log", dateFromTimeTForLog(val)); if (strcmp(status.log1, logFile)) { strcpy(status.log1, logFile); update = true; LOG << "Log filename error in STATUS.DAT (status.log1) corrected"; } val -= 86400L; curDate = dateFromTimeT(val); if (strcmp(status.date3, curDate)) { strcpy(status.date3, curDate); update = true; LOG << "Date error in STATUS.DAT (status.date3) corrected"; } snprintf(logFile, sizeof(logFile), "%s.log", dateFromTimeTForLog(val)); if (strcmp(status.log2, logFile)) { strcpy(status.log2, logFile); update = true; LOG << "Log filename error in STATUS.DAT (status.log2) corrected"; } } if (update) { saveStatus(datadir); } return true; }