int read_submit() { int i; char buf1[200]; FILE *fp; struct boardmem *x; mybrdnum = 0; if (!strcmp(getparm("confirm1"), "")) http_fatal("参数错误"); for (i = 0; i < parm_num; i++) { if (!strcasecmp(parm_val[i], "on")) { if (ismybrd(parm_name[i])) continue; if (mybrdnum >= GOOD_BRC_NUM) http_fatal("您试图预定超过%d个讨论区", GOOD_BRC_NUM); if (!(x = getboard(parm_name[i]))) { printf("警告: 无法预定'%s'讨论区<br>\n", nohtml(parm_name[i])); continue; } strsncpy(mybrd[mybrdnum], parm_name[i], sizeof (mybrd[0])); mybrdnum++; } } sethomefile(buf1, currentuser.userid, ".goodbrd"); fp = fopen(buf1, "w"); for (i = 0; i < mybrdnum; i++) fprintf(fp, "%s\n", mybrd[i]); fclose(fp); saveuservalue(currentuser.userid, "mybrdmode", getparm("mybrdmode")); printf ("<script>top.f2.location='bbsleft?t=%ld'</script>修改预定讨论区成功,您现在一共预定了%d个讨论区:<hr>\n", now_t, mybrdnum); printf("[<a href='javascript:history.go(-2)'>返回</a>]"); return 0; }
int main(int n, char *cmd[]) { int c, m, i; int dx, dy; telnet_init(); if (map_init() == 0) printf("map.dat error\n"); if (n >= 2) { char buf[40]; strsncpy(userid, cmd[1], sizeof (userid)); readuservalue(userid, "worker.laststage", buf, sizeof (buf)); lastMaxStage = atoi(buf); if (lastMaxStage >= map_total) lastMaxStage = map_total - 1; stage = lastMaxStage; } if (n >= 3) strsncpy(fromhost, cmd[2], sizeof (fromhost)); if (stage == 0) { clear(); printf("»¶Ó¹âÁÙ[1;32mÍÆÏä×Ó[mÓÎÏ·¡£\r\n"); printf ("¹æÔòºÜ¼òµ¥£¬Ö»Ðè°ÑËùÓеÄ'¡õ'¶¼ÍƵ½'¡¤'ÉÏÃæÈ¥(»á±ä³ÉÂÌÉ«)¾Í¹ý¹ØÁË¡£\r\n"); printf("µ«ÍæÆðÀ´ÄѶȿÉÊÇÏ൱´óµÄ£¬²»ÒªÇáÊÓม£\r\n"); pressanykey(); goto start; } win_showrec(); clear(); printf("ÇëÓ÷½Ïò¼üÑ¡¹Ø, »Ø³µ¼üÈ·ÈÏ: %d ", stage); move(0, 14); while (1) { c = inkey(); if ((c == KEY_LEFT || c == KEY_UP) && stage > 0) stage--; if ((c == KEY_RIGHT || c == KEY_DOWN) && stage < lastMaxStage) stage++; if (c == 10 || c == 13) break; if (c == 3 || c == 4 || c == 32) quit(); move(0, 14); printf("%d ", stage); move(0, 14); } start: if (stage < 0 || stage >= map_total) stage = 0; clear(); printf("ÍÆÏä×Ó: µÚ [1;32m%d[m ¹Ø:\033[m", stage); move(20, 0); refresh(); sleep(1); start2: for (n = 0; n < 20; n++) for (m = 0; m < 30; m++) map_now[n][m] = map_data[stage][n][m]; if (!find_y_x(&now_y, &now_x)) printf("stage error\n"); map_show(); bzero(&my_history, sizeof (my_history)); while (1) { c = inkey(); if (my_history.max >= 1999) { move(21, 0); printf("ÄãÓÃÁË2000²½»¹Ã»Óйý¹Ø! GAME OVER."); quit(); } dx = 0; dy = 0; if (c == 8 && my_history.max > 0) { my_history.max--; i = my_history.max; map_move(my_history.y1[i], my_history.x1[i], my_history.y0[i], my_history.x0[i]); find_y_x(&now_y, &now_x); move(now_y, now_x); continue; } if (c == ' ') quit(); if (c == '') map_show(); if (c == 9) goto start2; if (c == KEY_UP) dy = -1; if (c == KEY_DOWN) dy = 1; if (c == KEY_LEFT) dx = -1; if (c == KEY_RIGHT) dx = 1; if (dx == 0 && dy == 0) continue; if (map_now[now_y + dy][now_x + dx] & 4) if (map_now[now_y + dy * 2][now_x + dx * 2] < 2) { map_move(now_y + dy, now_x + dx, now_y + dy * 2, now_x + dx * 2); i = my_history.max; my_history.y0[i] = now_y + dy; my_history.x0[i] = now_x + dx; my_history.y1[i] = now_y + dy * 2; my_history.x1[i] = now_x + dx * 2; my_history.max++; } if (map_now[now_y + dy][now_x + dx] < 2) { map_move(now_y, now_x, now_y + dy, now_x + dx); i = my_history.max; my_history.y0[i] = now_y; my_history.x0[i] = now_x; my_history.y1[i] = now_y + dy; my_history.x1[i] = now_x + dx; my_history.max++; } if (check_if_win()) break; find_y_x(&now_y, &now_x); move(now_y, now_x); } move(19, 0); printf("×£ºØÄã, Äã³É¹¦ÁË£¡"); steps = my_history.max; win_checkrec(); stage++; if (stage > lastMaxStage) { lastMaxStage = stage; if (strcmp(userid, "null.")) { char buf[30]; sprintf(buf, "%d", lastMaxStage); saveuservalue(userid, "worker.laststage", buf); } } goto start; }