.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Space Empires: IV & V (http://forum.shrapnelgames.com/forumdisplay.php?f=20)
-   -   OT: Stupid c++ (Roguelike development) (http://forum.shrapnelgames.com/showthread.php?t=29767)

AngleWyrm August 15th, 2006 01:06 PM

Re: OT: Stupid c++
 
istream::seekg example

narf poit chez BOOM August 15th, 2006 06:14 PM

Re: OT: Stupid c++
 
Fyron: I read that page, but when I tried it, it didn't seem to work. Thanks, I'll check out that compiler.

AngleWyrm: Thanks, but as I said when I edited the message, I figured it out.

narf poit chez BOOM August 15th, 2006 08:45 PM

Re: OT: Stupid c++
 
If anyone wants to see where I am, the aptly named Simple Roguelike. Just drop it in a folder and run. Right now it's *very* simple, but as far as I know, everything works.

AngleWyrm August 15th, 2006 10:26 PM

Re: OT: Stupid c++
 
Nice! I especially like the light radius effect, and field of view.

Found a link for the source code for NetHack v3.42; could have some interesting ways to do stuff in it.

narf poit chez BOOM August 15th, 2006 10:36 PM

Re: OT: Stupid c++
 
Thanks. The currently linked version is my second upload; it has one type of trap. Previous savegames won't work, either.

PvK August 15th, 2006 11:36 PM

Re: OT: Stupid c++
 
Nice job!

narf poit chez BOOM August 16th, 2006 01:07 AM

Re: OT: Stupid c++
 
Thanks.

Somehow, my pointer item vector is getting messed up between its setup and the function to display it.

The thing is, those are the only two points which have anything to do with items at all.

How is this modifying a vector?!?!
Quote:

void text ( std::string tstring, int x, int y, short int Colour ) {
COORD Position; Position.X = x; Position.Y = y;
SetConsoleTextAttribute( hOut, Colour );
SetConsoleCursorPosition( hOut, Position );
std::cout << tstring;
};

Apparently, inputting too large of a block of characters (Between twenty and thirty) somehow affects the vector. Help, anyone?

narf poit chez BOOM August 16th, 2006 02:09 AM

Re: OT: Stupid c++
 
Can anybody see a problem with this:
Quote:

void setupItems () {
srand ( time(NULL) );
// NewWeapon.initialize (); NewPotion.initialize ();
// WeaponList.push_back ( NewWeapon ); PotionList.push_back ( NewPotion );
for ( t = 0; t < 40; ++t ) {
t2 = rand () % 2;
if ( t2 = 0 ) {
NewWeapon.initialize (); WeaponList.push_back ( NewWeapon );
WeaponList[WeaponList.size () - 1].initialize ();
ItemList.push_back ( &WeaponList [WeaponList.size () - 1] );
};
if ( t2 = 1 ) {
NewPotion.initialize (); PotionList.push_back ( NewPotion );
PotionList[PotionList.size () - 1].initialize ();
ItemList.push_back ( &PotionList [PotionList.size () - 1] );
};
};
for ( t = 0; t < ItemList.size (); ++t ) {
ItemList[t]->initialize ();
std::cout << t << " " << ItemList [t]->XPos << " " << ItemList [t]->YPos << " " << ItemList[t]->Colour << " ";
};
std::cin >> wait;
};

It doesn't seem to work right - It seems like all the slots still reference as the base Item class.

AngleWyrm August 16th, 2006 04:00 AM

Re: OT: Stupid c++
 
Bug: if(t2 = 0) // assign zero to t2, return true (successful assignment)
You probably meant: if(t2==0) // test for equality

Happens so often that some compilers even have a warning for it.

narf poit chez BOOM August 16th, 2006 04:18 AM

Re: OT: Stupid c++
 
Thanks. We're whacking it into shape on IRC.


All times are GMT -4. The time now is 08:39 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.