Skip to content

Commit c83586e

Browse files
committed
Add invalid cells
1 parent aa217e9 commit c83586e

1 file changed

Lines changed: 63 additions & 3 deletions

File tree

src/variety/ripple.js

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
// マウス入力系
1313
MouseEvent: {
1414
inputModes: {
15-
edit: ["border", "number", "clear"],
15+
edit: ["border", "empty", "number", "clear"],
1616
play: ["number", "clear"]
1717
},
1818
autoedit_func: "areanum",
1919
autoplay_func: "qnum"
2020
},
2121
"MouseEvent@meander": {
2222
inputModes: {
23-
edit: ["border", "number", "clear"],
23+
edit: ["border", "empty", "number", "clear"],
2424
play: ["number", "dragnum+", "dragnum-", "clear"]
2525
},
2626
mouseinput: function() {
@@ -106,7 +106,18 @@
106106
// キーボード入力系
107107
KeyEvent: {
108108
enablemake: true,
109-
enableplay: true
109+
enableplay: true,
110+
111+
keyinput: function(ca) {
112+
if ((ca === "q" || ca === "w") && this.puzzle.editmode) {
113+
var cell = this.cursor.getc();
114+
if (!cell.isnull) {
115+
cell.setValid(cell.ques !== 7 ? 7 : 0);
116+
}
117+
} else {
118+
this.key_inputqnum(ca);
119+
}
120+
}
110121
},
111122

112123
//---------------------------------------------------------
@@ -117,6 +128,13 @@
117128
return this.room.clist.length;
118129
}
119130
},
131+
Border: {
132+
isQuesBorder: function() {
133+
return (
134+
this.ques || this.sidecell[0].isEmpty() || this.sidecell[1].isEmpty()
135+
);
136+
}
137+
},
120138
Board: {
121139
hasborder: 1
122140
},
@@ -139,6 +157,13 @@
139157
Graphic: {
140158
gridcolor_type: "DLIGHT",
141159

160+
getBGCellColor: function(cell) {
161+
if (!cell.isValid()) {
162+
return "black";
163+
}
164+
return this.getBGCellColor_error1(cell);
165+
},
166+
142167
paint: function() {
143168
this.drawBGCells();
144169
this.drawTargetSubNumber();
@@ -153,6 +178,14 @@
153178
this.drawChassis();
154179

155180
this.drawCursor();
181+
},
182+
183+
getBorderColor: function(border) {
184+
if (border.isQuesBorder()) {
185+
return border.error === 1 ? this.errcolor1 : "black";
186+
}
187+
188+
return this.getBorderColor_qans(border);
156189
}
157190
},
158191

@@ -162,10 +195,12 @@
162195
decodePzpr: function(type) {
163196
this.decodeBorder();
164197
this.decodeNumber16();
198+
this.decodeEmpty();
165199
},
166200
encodePzpr: function(type) {
167201
this.encodeBorder();
168202
this.encodeNumber16();
203+
this.encodeEmpty();
169204
},
170205

171206
decodeKanpen: function() {
@@ -212,6 +247,31 @@
212247
this.encodeCellAnum_XMLAnswer();
213248
},
214249

250+
decodeCellQnum: function() {
251+
this.decodeCell(function(cell, ca) {
252+
if (ca === "#") {
253+
cell.ques = 7;
254+
} else if (ca === "-") {
255+
cell.qnum = -2;
256+
} else if (ca !== ".") {
257+
cell.qnum = +ca;
258+
}
259+
});
260+
},
261+
encodeCellQnum: function() {
262+
this.encodeCell(function(cell) {
263+
if (cell.ques === 7) {
264+
return "# ";
265+
} else if (cell.qnum >= 0) {
266+
return cell.qnum + " ";
267+
} else if (cell.qnum === -2) {
268+
return "- ";
269+
} else {
270+
return ". ";
271+
}
272+
});
273+
},
274+
215275
UNDECIDED_NUM_XML: 0
216276
},
217277

0 commit comments

Comments
 (0)