.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)

narf poit chez BOOM September 19th, 2006 12:28 PM

Re: OT: Stupid c++
 
Anybody want to volunteer to look at the code?

Ed Kolis September 19th, 2006 04:30 PM

Re: OT: Stupid c++
 
Sure, though I'm not that great with C++, I might be able to spot something...

PvK September 19th, 2006 05:23 PM

Re: OT: Stupid c++ (Roguelike development)
 
Why would new re-assign what same pointers?

Fyron September 19th, 2006 05:49 PM

Re: OT: Stupid c++
 
And now it isn't even getting past re-sizing the character array.

Why are you using character arrays at all? There is no reason to ever use them over string. Any time you need to pass a char* to a function, just use the .c_str() member on your string (aka: crazy_function(mystring.c_str()).

C++ is stupid.

C++ is neither stupid nor smart. It all depends on how you use it.

Why would the 'new' operator re-assign the same pointers?

I don't understand the question. New doesn't assign any pointers; it creates an object in the dynamic memory space (heap), and returns a pointer to it.

narf poit chez BOOM September 19th, 2006 06:04 PM

Re: OT: Stupid c++
 
By character array, I mean an array of NPC's and PC's. And technically I should have said 'vector'.

C++ needs more comprehensive error checking.

Tomato, tomato.

Anyone who wants to see the source code, PM me, thanks.

Fyron September 19th, 2006 06:39 PM

Re: OT: Stupid c++
 
C++ compilers have more error checking than most other languages (esp. g++ with things like -pedantic flags). And anyways, you can always add more by throwing and catching exceptions.

narf poit chez BOOM September 19th, 2006 07:53 PM

Re: OT: Stupid c++
 
It doesn't tell me why the resize function wasn't working on the character vector! Obviously, it's not fully-featured! http://forum.shrapnelgames.com/images/smilies/laugh.gif

Fyron September 19th, 2006 08:22 PM

Re: OT: Stupid c++
 
Why are you using a resize function anyways? push_back() works well.

narf poit chez BOOM September 19th, 2006 08:25 PM

Re: OT: Stupid c++
 
Because, with resize you don't have to push_back something.

Fyron September 19th, 2006 08:36 PM

Re: OT: Stupid c++
 
Why would you increase the size of a vector without having something to add to it?


All times are GMT -4. The time now is 09:47 PM.

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