Thats pretty cool. I usually never take the portability road which is probably a bad thing for my line of study. But I do focus on optimizing a lot. I don't have a lot of knowledge in asm (never looked into it) but I would love to check it out some time soon.
Hi Mythios. Finally I got some time to go thru your code, and as far as I can tell, I seem to understand it without problems - which makes me feel good since I started with C++ just a month ago.
Using a vector for this seems the right thing to do, because of the fact that the number of monsters is not a constant (I mean, in my Dungeon code) and the vector is by definition dinamically resizeable. My only question is: why prefer using a struct over a class to define the "monster" objetc?
@Duoas
I tried -ansi on the compiler options and tried a hello world program but the compiler throws this error.
||=== h, Debug ===|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\cwchar|161|error: `::swprintf' has not been declared|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\cwchar|168|error: `::vswprintf' has not been declared|
||=== Build finished: 2 errors, 0 warnings ===|
The error is pointing to cwchar header of the compiler. I tried to comment the lines the error is pointing to and everything works fine but it bothers me since this is a compiler header (supplied by MinGW).
I updated to the latest version of Mingw and now there are no problems. The latest version links all programs to shared libraries libgcc_s_dw2-1.dll and libstdc++-6.dll but still have an option to link to static library..
I think I had a similar problem a short while back -- it was because I installed a later version over an existing version and broke some libraries. I had to completely wipe and re-install the correct version of MinGW to clean it up.
If you are doing a full-screen display, it will work better if you do not "clear" it and instead just position the cursor at "home", then rewrite all positions (or just all positions that have changed).
bool gohome()
{
if (!cur_term)
{
int success;
setupterm( NULL, STDOUT_FILENO, &success );
if (success <= 0)
returnfalse;
}
return putp( tigetstr( "home" ) ) != ERR;
}
The POSIX code is a little simplistic. Typically applications that manipulate the cursor should output the enter_ca_mode string when initializing and the exit_ca_mode before terminating. (Above we manipulate the cursor with the home string.)