*Fixed *
Well, I got my save code working... But loading... not yet... When it should place the characters in there former positions, it doesnt place them... Anywhere? I know it it loads the file proprely, and I'm fairly sure it parses correctly. But, I dont think the coord variables are getting the correct information... Heres load code:
(Borland BCC55 compiler, Windows XP)
(TE, TD, Trigger, Effect, NOE, NOD, NOT, NOTE are all globals. TriggerE, TriggerP, TeleportE, TeleportD are all pre-defined constants.)Code:void Load() { string MAP; string PATH; char Saveme[2]; int x00; COORD wha; string s; string s2; string ko; stringstream ss; int i, a; BOOL sswitch = false; PATH="C:\\"; PATH+=Ext[0]; PATH+=".bsf"; ifstream file_in2(PATH.c_str(), ios::nocreate); s=""; for(;;) { file_in2.get(Saveme[1]); if(Saveme[1] == 'a') break; if(Saveme[1] == ';') sswitch = true; if(Saveme[1] == ';' || Saveme[1] == 'n' ||Saveme[1] == 'e' ||Saveme[1] == '\n') cout << ""; else { if(sswitch == false) s+=Saveme[1]; else s2+=Saveme[1]; } } a = 0; ko = ""; for(i=0; a < s.length(); i++) { ss.clear(); ko[0] = s[a]; ko[1] = s[++a]; ss << ko; ss >> TE[i].X; ss.clear(); ko[0] = s[++a]; ko[1] = s[++a]; ss << ko; ss >> TE[i].Y; NOE = a + 1; NOD = a + 1; ss.clear(); ko[0] = s[++a]; ko[1] = s[++a]; ss << ko; ss >> TD[i].X; ss.clear(); ko[0] = s[++a]; ko[1] = s[++a]; ss << ko; ss >> TD[i].Y; a++; } a = 0; ko = ""; for(i=0; a < s.length(); i++) { ss.clear(); ko[0] = s[a]; ko[1] = s[++a]; ss << ko; ss >> Trigger[i].X; ss.clear(); ko[0] = s[++a]; ko[1] = s[++a]; ss << ko; ss >> Trigger[i].Y; NOT = a + 1; NOTE = a + 1; ss.clear(); ko[0] = s[++a]; ko[1] = s[++a]; ss << ko; ss >> Effect[i].X; ss.clear(); ko[0] = s[++a]; ko[1] = s[++a]; ss << ko; ss >> Effect[i].Y; a++; } for(a=0; a <= NOE; a++) { wha.X = TE[a].X; wha.Y = TE[a].Y; SetConsoleCursorPosition(hOt, wha); cout << TeleportE; } for(a=0; a <= NOD; a++) { wha.X = TD[a].X; wha.Y = TD[a].Y; SetConsoleCursorPosition(hOt, wha); cout << TeleportD; } for(a=0; a <= NOT; a++) { wha.X = Trigger[a].X; wha.Y = Trigger[a].Y; SetConsoleCursorPosition(hOt, wha); cout << TriggerE; } for(a=0; a <= NOTE; a++) { wha.X = Effect[a].X; wha.Y = Effect[a].Y; SetConsoleCursorPosition(hOt, wha); cout << TriggerP; } file_in2.close(); }
To the extent of my knowledge, this should work. The file has coord pairs like:4516n4615e
Heres the file that should be loading:
(1.BSF)
When the files opened, the information before the ; should be sent to TE and TD. The n & e split lines. IE TE[0].Xshould be 45, and TE[0].Yshould be 16. Then TD[0].X should be 48, and TD[0].Y should be 16... There are no integers for Trigger / Effect placed currently.Code:4516n4816e 4716n4916e ; a
It doesnt work however, I know the code does alot it.. doesnt particularly need to do, but in essence it should work... I dont see any reason it doesnt? Take two chars, put them in a string and send them to the a global coord. I've re-designed this code fifty times, but nothing seems to work. The closest I got was it place the characters directly mirrored to where they should be. (Say it was at 0, 0 it would go to the very edge of the command prompts screen... (Dont ask how I managed that ... ) I know there are lots of variables defined there that arent used... I cut out the code that wasnt related to loading / parsing the bsf file.
Thanks for your time! >.>