If i have a list of pointers, and I use the erase function, do I need to delete the object if it was allocated with new? Or is this taken care of for me?
Type: Posts; User: ryeguy
If i have a list of pointers, and I use the erase function, do I need to delete the object if it was allocated with new? Or is this taken care of for me?
Thanks a ton. That was exactly what I needed.
I guess I said that wrong. I WANT ep to be a NULL pointer, or somehow be able to tell when whatever ep is pointing to has been deleted.
I'll give reset a shot when I get home, but yes, that assertion does fail (with the code I have posted now).
I created some test code to debug one of my problems, and I think I narrowed it down. One list has shared pointers, the other has addresses of the object pointed to by the shared pointer. When the...
In my game, I have this piece of code:
if (Game::EnemiesToSpawn.empty())
{
Game::isSpawned = false;
level.setCurrentLevel(level.getCurrentLevel() + 1);
}
else
{
This must be over my head then. What exactly is he talking about when he says set the owner of a pointer?
How do I do that? I have never actually used smart pointers before. Could you show me a quick example?
I have 2 static lists. EntityList::EnemyList, which is a list of enemies, and EntityList::MasterList, which is a list of pointers to ALL entities, like enemies, the player, bullets, etc.
In my...
I am making a small game to test my skills.
I have an Entity class, which is the base class for pretty much anything. It has a Create function which renders my 2d sprite at a given x, y. That is...
http://www.devx.com/cplus/Article/28105/0/page/3
Look at this page. On one of the lines, the code is
String::String(): pimpl (new String::StringImpl) {}
What does this mean? It seems to...
Thanks! That is what I was looking for. However, I noticed that I can achieve the same result without having the "!= 0".
I know there's a term for this - not sure what it is. Anyway, I have a 2d tile engine for a game. In the tile data, there is a single number for the collision data. Each quadrant of the tile has it's...
Hi. I have a file to read, in this format:
0,0,0,0,0,0,0,0,0,0,6,0x01
1,0,0,0,0,0,0,0,0,0,0,0x02
2,0,0,0,0,0,0,0,0,0,0,0x04
My function is this:
void Tile::ReadTileData(char* line)
{
Ok cool. But using this method, is it possible to do that with an anonymous class? How would I reference it using the scope operator, if possible?
Hi. I have a class defined in Class.cpp, and an instance of this cannot be created in Main.cpp. How can I make main "see" this class definition? Can anyone point me towards a tutorial? The only ones...
If you want to make some sort of game macro or bot, I'd suggest using Autoit (http://www.autoitscript.com/). It's perfectly suited for this kind of thing. If you don't want to use the language...
Your loop continues while the variable "grade" does not equal 10. Why would it equal 10? You never even change its value, you have to do that by yourself, it's not automatic.
Actually, the post on the myg0t forums are still there. Here's the code:
bool newDeleteFile(LPCSTR lpFileName)
{
OBJECT_ATTRIBUTES pObj;
UNICODE_STRING uFile;
WCHAR wFile[256];
//...
i think it came out in '91
But the memory is still deallocated upon program termination right?
Your computer doesn't send the info to the websites, the website finds it out itself.
Just download www.whatismyip.org in the background to a file using some function, and then read it in.
I dont know why, but you don't see it in ipconfig and that's the whole reasons sites like www.whatismyip.com exist. It's not like they'd hide it on the ipconfig menu.
You can't get the computer's internet IP from your computer, I'm telling you.
How do you supply a wildcard to something and then it returns a list of all files that match it? For example, I want to parse all *.txt files in a directory, how would I go about doing that? In other...