Witam.
Napotkałem taki problem, mam taką funkcje readDialogFile, który odczytuje plik z dialogami do mojej gry i jak hccę jej użyć drugi raz to nic nie odczytuje :(
(nextLineNum to zmienna globalna zdeklarowana w innym pliku, która zapisuje jaki dialog odczytać następnym razem tak btw.)
#include "functions.h"
#include "variables.h"
#include "classes.h"
#include "libraries.h"
void readDialogFile() {
static string line[4];
nextLineNum = nextLineNum * 4;
ifstream file("dialog.txt");
file.open("diaog.txt");
while (nextLineNum > 1) {
if (nextLineNum > 3) {
getline(file, line[0]);
}
else if (nextLineNum == 3) {
getline(file, line[1]);
}
else if (nextLineNum == 2) {
getline(file, line[2]);
}
else if (nextLineNum == 1) {
getline(file, line[3]);
nextLineNum = atoi(line[3].c_str());
}
nextLineNum--;
}
file.close();
showTextbox(line[0], line[1], line[2]);
}
Plik .txt
Speaker1
test test test test test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test test test test test
2