-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathGameOther.cpp
More file actions
100 lines (89 loc) · 2.65 KB
/
Copy pathGameOther.cpp
File metadata and controls
100 lines (89 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "stdafx.h"
#include "data.h"
#include "chess.h"
#include "Resource.h"
#include "pregen.h"
void
TruncateGame(dispboard_t* pDis){ //截平
/*if (DIS.forwardMostMove > DIS.currentMove) {*/
if (pDis->pos->gply > pDis->pos->curStep) {
//if (DIS.gameInfo.resultDetails != NULL) {
// free(DIS.gameInfo.resultDetails);
// DIS.gameInfo.resultDetails = NULL;
// DIS.gameInfo.result = GameUnfinished;
//}
//DIS.pgn.resultDetails[0] = NULLCHAR;
//DIS.pgn.cmresult = GameUnfinished;
pDis->pgn->isFinish = GameUnfinished;
//DIS.forwardMostMove = DIS.currentMove;
pDis->pos->gply = pDis->pos->curStep;
//HistorySet(DIS.parseList, DIS.backwardMostMove, DIS.forwardMostMove,
// DIS.currentMove-1);
}
}
void //更换注解
ReplaceComment(int index,char *text){
int len;
while (*text == '\n'){
text++;
}
len = (int)strlen(text);
while (len > 0 && text[len - 1] == '\n'){
len--;
}
// if (DIS.commentList[index] != NULL){
// free(DIS.commentList[index]);
// }
// if (len == 0) {
// DIS.commentList[index] = NULL;
// return;
// }
// DIS.commentList[index] = (char *) malloc(len + 2);
//strncpy(DIS.commentList[index], text, len);
//DIS.commentList[index][len] = '\n';
//DIS.commentList[index][len + 1] = NULLCHAR;
}
void
CrushCRs(char *text){
char *p = text;
char *q = text;
char ch;
do {
ch = *p++;
if (ch == '\r') continue;
*q++ = ch;
} while (ch != '\0');
}
void //加入棋步的注解
AppendComment(int index,char *text){
// int oldlen, len;
// char *old;
//CrushCRs(text); //去掉回车键
//while (*text == '\n'){ //去掉前面的换行
// text++;
//}
//len = (int)strlen(text);
//while (len > 0 && text[len - 1] == '\n'){
// len--;
//}//去掉后面的换行
//if (len == 0){
// return; //没有内容哇
//}
//if (DIS.commentList[index] != NULL) {
// old = DIS.commentList[index];
// oldlen = (int)strlen(old);
// DIS.commentList[index] = (char *) malloc(oldlen + len + 2);
// //strcpy(commentList[index], old);
// StringCbCopy(DIS.commentList[index],(oldlen + len ), old);
// free(old);
// strncpy(&DIS.commentList[index][oldlen], text, len);
// DIS.commentList[index][oldlen + len] = '\n';
// DIS.commentList[index][oldlen + len + 1] = NULLCHAR;
//}
//else {
// DIS.commentList[index] = (char *) malloc(len + 2);
// strncpy(DIS.commentList[index], text, len);
// DIS.commentList[index][len] = '\n';
// DIS.commentList[index][len + 1] = NULLCHAR;
//}
}