Closed Tapsa closed 11 years ago
I am also pretty sure there are problems in deleting "genie::LangFile()" made with new. AGE 2 crashes when it tries to delete more than one language file from memory.
This is how I handle language file deletion now:
if(Lang != NULL)
{
delete Lang;
Lang = NULL;
}
if(LangX != NULL)
{
delete LangX;
LangX = NULL;
}
if(LangXP != NULL)
{
delete LangXP;
LangXP = NULL;
}
Before opening anything, they are set to null. So I handle them identically to genie::DatFile().
Ok, I'll look into that. But I think it is a LangFile problem.
Can you check if this happens with the latest genieutils? The warning will be fixed at the comming commits.
It seems to work. I debugged it a bit with no errors showing up.
I am making a simple exporting function. Can you tell me why this gives me compiling errors? Seems like I need boost or something.
fstream ExtractUnit("age2eUnit.txt", ios_base::trunc | ios_base::binary | ios_base::out);
ExtractUnit << VERSION_EXTRACT;
ExtractUnit << GenieFile->Civs.size();
for(auto loop=0; loop < GenieFile->Civs.size(); loop++)
{
ExtractUnit << GenieFile->Civs[loop].Units[UnitIDs[0]];
}
ExtractUnit.flush();
ExtractUnit.close();
C:\Juttu\AGE\sources\AGE_Frame_cpp\Transporting.cpp:35:56: error: cannot bind 'std::basic_ostream
Also, do you know easy ways to make threads?
Your code can't work, because fstream can't know the Unit class. See operator overloading: http://www.cplusplus.com/doc/tutorial/classes2/ You could use boost threads, but I don't think this is necessary for AGE.
Okay.
Can I add << and >> operator overloading into genieutils?
You may not need to do that. I'm planning to rewrite the serialization interface, so that both binary and text file output share the same code (serializeObject). We may only need to change some code there.
Good. Does this mean exporting a unit could be done with just a few lines of code (in AGE 2)? Also, the text file needs names for variables. I think a priority should be just binary exporting (and ability to import to other game versions). Or don't do a binary exporting at all, instead use text exporting for all this.
Yes. We could just add an additional parameter, variable name, to the serialize methods and just ignore them on binary I/O. For text output I'd suggest to use yaml: http://en.wikipedia.org/wiki/Yaml . I'll rewrite the interface first to support such extensions.
For importing objects from other game versions: Have you tried to just copy the object and then change the gameversion:
Unit x(otherUnit); // or Unit *x = new Unit(otherUnit):
x.setGameversion(...
This could probably work, because the members that differ should be initialized by default.
Okay, go ahead.
I don't want any more libraries than we already have unless absolutely necessary, so I'll probably use standard C++ to export the text or wxWidgets things. (Iconv doubled the final executable size of AGE 2 btw) Or are you gonna make genieutils produce the text files? Then do it how you please.
I haven't tried to simply change the game version, I have to test it today. If that's really possible then a whole dat file could be converted with just one command. Easiest way to move things between dat files is to have two AGE 2 open, so users don't have to switcth dat files repeatedly. So a file (or shared memory?) is needed. And text files allow easy batch editing.
Or maybe I can just duplicate the interface so that it's easy to show 2 dat files simultaneously.
On the other hand, I would rather add an additional library, than reinvent the wheel again :). Let's see how a simple text file would look like.
Yeah, or you could redesign AGE to support editing multiple dat files without copying your code. But I guess that may be a lot of work. A first step may be separating frames. I mean creating a frame for each class and loading the frame with a reference to an object. So you could for example open multiple Graphic objects simultaneously.
Kind of funny how you mixed then/than. You sure don't want to add a library and reinvent the wheel.Anyway, I don't think it's way too much work to spilt AGE 2's frame into two parts.
Damn it ^^, already fixed :). Thanks, I really appreciate corrections.
I meant that if you would design the AGE Interface more like AoK modpack studio and update your code properly, you could more easily add features and maintain the project. But feel free to ignore my suggestions, I'm no expert in interface development and I don't like it either :).
I've got no idea how AoK modpack studio was made. I've gotten used to AGE 2's user interface developing. The real problems are those of which I don't have skills/knowledge yet.
\pcrio.c: In function 'void pcr_write_section_data(pcrfile, FILE_, pcr_error*, rsrc_section_size)': \pcrio.c:1045:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
This is with the latest pcrio on github.