Skip to content

Commit 806a728

Browse files
committed
input.txt skips comment lines, updated readme and changelog
1 parent d27172a commit 806a728

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

GoL.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -243,23 +243,26 @@ void GoL::handleInputMode(int x, int y){
243243
void GoL::readFromFile(){
244244
std::ifstream myFile("input.txt");
245245
std::string s;
246-
std::getline(myFile, s);
247246
int p1, p2, c1, c2, c3;
248247
Color clr(0x00, 0x00, 0x00);
248+
readline: //MY EYES!!
249+
std::getline(myFile, s);
249250
if(s == "rule: vanilla"){
250251
while(myFile >> p1){
251252
myFile >> p2;
252253
_generation.generation.insert({{p1, p2}, clr});
253254
}
254255
}
255-
if(s == "rule: multi"){
256+
else if(s == "rule: multi"){
256257
while(myFile >> p1){
257258
myFile >> p2 >> c1 >> c2 >> c3;
258259
clr.rgb[0] = c1; clr.rgb[1] = c2; clr.rgb[2] = c3;
259260
_generation.generation.insert({{p1, p2}, clr});
260261
_multi = 1;
261262
}
262263
}
264+
else
265+
goto readline;
263266
myFile.close();
264267
}
265268

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Usage of this software is also discussed in the in-game help (press h in game).
1313
- You can use the mouse wheel to zoom-in (scroll up) and zoom-out (scroll down).
1414
- Press "x" to delete all living squares.
1515
- Pressing "space" at any time will append the current state to saves.txt in vanilla format. For more information about vanilla format, see "Default Input Specifications".
16+
- A name for the save will be required for the game to continue.
17+
- The user may enter a string to the command prompt window to name the save.
18+
- Pressing "enter" without providing a string will leave the save unnamed.
1619
- This implementation comes with 3 modes:
1720
- In the default mode, input mode, you can add or delete squares (also called living squares) with left click.
1821
No new generation will be created. You can access this mode with pressing "i".
@@ -43,7 +46,7 @@ The second line contains all `(x, y)` pairs. No line breaks are present. No part
4346
In the second line a cell is described by 5 parameters. 2 for position and 3 for color.
4447
Second line syntax is very similar to vanilla syntax. Instead of `(x, y)` pairs there are `(x, y, red, green, blue)` quintuplets.
4548

46-
Putting '#' at the beginning of a line will make a comment line. However, `input.txt` currently doesn't support this (version 2.3.4).
49+
Putting '#' at the beginning of a line will make a comment line.
4750

4851
There are converters in the converter folder with which you can convert popular input formats to usable vanilla format.
4952
Vanilla is the format described above with which you can supply the `input.txt` file.

changelog.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,8 @@ Version 2.3.4 (Released 26th April 2022):
7474

7575
---> Plans for next release:
7676
-> Add support for naming in game saves.
77-
-> Currently input.txt only supports non comment inputs. Change it to include comment inputs.
77+
-> Currently input.txt only supports non comment inputs. Change it to include comment inputs.
78+
79+
Version 2.3.5 (Released 27th April 2022):
80+
-> Added naming feature to game saves.
81+
-> input.txt now skips all lines before "rule".

0 commit comments

Comments
 (0)