Jump to content
  • Advertisement

Oxyacetylene

Member
  • Content Count

    1161
  • Joined

  • Last visited

Community Reputation

426 Neutral

About Oxyacetylene

  • Rank
    Contributor
  1. Oxyacetylene

    casting std::string

    The code you've posted isn't converting the string to an integer it's converting the address of the first character of the internal character array, to an integer. Firstly, boost::lexical_cast or std::stringstream is what you need for what you're trying to do. Secondly, you should look into learning the C++-style casts, (google for static_cast, reinterpret_cast, const_cast), and use them instead of C style casts. Using C++ style casts will force you to think about why you are trying to cast one type to another, and will also help to catch logical errors like this at compile time.
  2. Oxyacetylene

    Exceptions & namespaces

    Off the top of my head, proper variable scoping in for loops, and partial template specialisation are two big things missing from VC6 (although there are many others). You would be more likely to run into trouble if you use certain libraries that make heavy use of templates. Some features of the boost libraries, for example, are unsupported under VC6, but supported on VC .NET 2003 and 2005. Later versions of the boost::spirit parser library for example, will not compile at all under Visual Studio compilers older than Visual Studio 2003. Some boost libraries have nicer features available when you use standard conforming compilers, compared to compilers like Visual Studio 6 or 2002. (see boost::function for an example) I've got Visual Studio 2002 professional, and I'm still using VC2005 Express at the moment, because the compiler is just so much better than Visual Studio 2002, that I don't mind using the express edition until I can find some spare cash to get the professional edition.
  3. Oxyacetylene

    class vector pointers help!

    I think your compile error is due to the fact that you've not specified the namespace that vector is in. It should be std::vector, unless you've got using namespace std somewhere. The compiler is looking for a template called "vector" in the global namespace, and failing to find one. Read up on namespaces a bit. However, aside from this there are other issues in your code, and I'm a bit confused as to what you're trying to do here. For a start, in the example you've given, the value of ColPix will be undefined, and won't be pointing to a vector at the point where you call push_bacl. The behaviour will be undefined when you call *Colpix.push_back( &BoxType). ColPix won't be pointing to a vector unless you make it point to a vector. From looking at your code it looks like you've got the difference between a pointer to a vector, and a vector that holds pointers, mixed up. From looking at your code, I think you intended ColPix to be defined like this vector<SDL_Rect*> ColPix; // Note that ColPix is a vector of pointers, not a pointer to a vector Another thing to note, is that the BoxType parameter to the CTile constructor is being passed by value. This means that you're copying everything in the vector you pass in, every time you construct a CTile object. You should pass the vector in by constant reference, otherwise you're copying the entire vector and destroying the temporary copy every time you construct a CTile object. CTile( int x, int y, const vector<SDL_Rect>& BoxType ) Another thing to note. You probably shouldn't be taking pointers to items in a vector like that. If you add more items than the vector has capacity for, at some point in the future, then vector will get resized and all your pointers will become invalid. Looking at what you're trying to do. Personally I'd have BoxType be a class of its own, which stores a vector (or some other container) internally, rather than being a vector itself, and have CTile store a pointer or reference to a BoxType object, rather than passing around pointers to the vector. That way you can hide the implementation details from CTile, and (I assume) whatever class owns the BoxType vector. This will make your code a lot easier to change in future. If however, all you want to do is make a vector pointer inside a class point to a vector outside the class. You need to change your code to this... class CTile { private: std::vector<SDL_Rect>* Colpix; public: CTile( int x, int y, std::vector<SDL_Rect>& BoxType ); }; CTile::CTile( int x, int y, vector<SDL_Rect>& BoxType ) : Colpix(&BoxType) { // This code is wrong // you don't need to add the contents of // BoxType to Colpix. Colpix is a pointer to the object BoxType // // What this code is doing is adding the contents of BoxType to BoxType // even worse, it will probably result in an infinite loop // because BoxType.size() will increase every time you go through // the loop /* for( int i = 0; i < BoxType.size(); i++ ) { *Colpix.push_back( &BoxType ); } */ } [Edited by - Oxyacetylene on October 15, 2006 2:18:45 PM]
  4. Oxyacetylene

    Edited

    Quote:Original post by capn_midnight Raghaghaghghg SERIOUS BUSINESS Why should they act like adults if they're not adults? Surely if they're young enough that the state is allowed to decide whether or not they can drink alcohol, then surely they must be children and not adults? Surely if their parents get informed when they break the law, then they must still be children? Surely if they're too young to be able to decide to drink, then they're quite clearly too young to be able to face legal consequences for it. I don't see how you can have it both ways. Also, sorry, but drinking at the age of 18 is not alcoholism, regardless of whether it's legal or not. Thank christ I live in the UK, is all I can say. For all our faults, at least we treat 18 year olds like adults. Informing parents... what is this? High school? For the record, the drinking age is 18 here, and I didn't drink underage (although mainly because I was pressured into it by my peers, and peer-pressure will usually make me do the opposite of what I'm being pressured into out of spite, because I don't like people trying to badger me into things)
  5. Oxyacetylene

    Bush legally authorized Libby leak

    Quote:Original post by Antisheep As much right, yes. But I find that negative / unproductive / unsupportive criticism doesn't help--only divides. Sooo that's why I say extremist left-wingers should move to Cuba. Fidel makes some new Bush-hating friends, the U.S. gets a tad bit more peaceful -- everyone's happy in the end. ^_^ Come to America, the land of the free to be a Bush supporter. That's some real freedom right there. Quote:Original post by Mithrandir Quote:Original post by Dmytry I always thought those comrades in Cuba were commies(and quite conservative commies in fact) and not liberals... I always thought it funny how conservatives like to paint Castro as a Liberal Hero; Liberal stems from LIBERTY, something Castro and his brand of Fascism (handily called "Communism", even though it's not anywhere close) are the antithesis of. I guess trying to make your opposition look like it agrees with evil is a valid argument tactic. *shrug* I've always found it amusing how people on the far-left or far-right of the political spectrum use the same tactic, of saying that anyone that disagrees with them is on the far end of the opposite side of the spectrum. Because no right-wing or centrist people dislike Bush at all, and if you disagree with Bush, you must be on the extreme far-left... Just like you must be a nazi if you disagree with people on the far-left.
  6. Oxyacetylene

    PHOTOSHOP US!!!!!!

  7. If these people had their way (and I wouldn't be surprised if they did get their way one day), you'd have to pay everytime you wanted to listen to a track. If they really want to stop people from downloading mp3s, then stuff like this really doesn't help. Quite frankly, this just makes me glad that the music I like generally isn't on major labels. In the case o the few bands that I do like on major labels, I just refuse to buy their music on principle.
  8. Oxyacetylene

    HALO 2 PC

    Another thing I'll say, is that as long as you can find a game that isn't full of 12 year olds, I find Halo 2 multiplayer to be a lot more fun than any PC FPS games. Playing PC FPS games online: "RARGHHH I'm in a clan, so that gives me the right to dictate completely arbitrary rules for the game, aside from the ones already enforced by the game engine!! From now on, you will not use weapon X, weapon X is a n00b weapon. Also, you will not use x entrance to the base on y map, because that's the n00b entrance. Also because I'm in a clan, I've decided that it's now considered cheating, if you are heading to the enemy base, see a member of the enemy team heading towards your base, follow them back and kill them, because it is unfair when you kill enemy team members, you have to let them win OK. If you disagree with me, I'll go on about how high my clan [SERIOUS_BUSINESS] is in lonely virgin league 2000, as if this is some kind of real world achievement, and also gives me the right to dictate the rules of the game. Also, n00b is actually a valid insult, because telling someone that they're new to playing this game is such a serious insult. Oh no, I haven't used the words n00b or faggot for the last 5 seconds... must rectify. n00b n00b n00b n00b n00b faggot faggot faggot faggot faggot." People take PC games far too seriously in my opinion. For a start, it's not a god damned sport. Sorry if I'm ranting a bit, it just annoys me that I can't go online and just play a game any more, without idiots ruining it.
  9. Oxyacetylene

    HALO 2 PC

    Quote:Original post by skjinedmjeet To me, the idea of an FPS on a console system is a little bit ridiculous, as the controls are counter-intuitive, compare to the mouse/keyboard combination. I think part of the success of Halo lay in the fact that console gamers hadn't been exposed to an FPS like Halo before. That doesn't mean that the whole FPS experience is particularily suited for a console-controller. I, for one, don't enjoy playing Halo on an XBox, simply because of the difficulty aiming precisely. Of course, after playing it for a while, I realized that it didn't matter, thanks to the rather generous auto-aim. I've been playing PC FPS games since the days of the original Doom, and I love Halo on the Xbox. The controls are fine once you get used to them, even without the auto-aim (such as in multiplayer). Personally I don't understand all the hate for Halo. I was close minded to Halo/playing FPS games with a joypad, until a few years ago, when I was working as a games tester. My colleagues brought their Xboxes in at lunch time, and we all had a 16 player networked CTF game. (I think it was 16 player anyway, whatever the maximum number of players is). Great fun. Once you get used to it, playing an FPS with a controller can be very satisfying. I've never found anything to beat Halo capture the flag, except maybe Team Fortress Classic for Half-life (although I'd say it's just as good, or different, rather than better). I've not played more recent PC FPS games (other than Doom3), but I think it's just as good as any PC shooter that came out at around that time.
  10. Oxyacetylene

    Denmark cartoon controversy

    Ah OK, it was a misunderstanding then. It just seemed to me from your posts that you were tarring all Europeans with the same brush, due to laws that exist in Europe. Just because a country in Europe outlaws religious clothing in school, doesn't mean that even the majority of Europeans agree with it. Just because there are racists in Europe, it doesn't mean that the majority of Europeans are racist. To say otherwise is no different than to judge all muslims based on Al Queda, or to judge all British people, based on the BNP.
  11. Oxyacetylene

    Denmark cartoon controversy

    Quote:Original post by skulldrudgery White Europeans have a low birth rate. They are worried about non-white Europeans with different ideas gaining political clout. Oh really, am I? I must have missed that particular mail-out on the white European mailing list! Note to self: You are European and white, therefore you have to start getting worried about non-white Europeans with different ideas gaining political clout. Second note to self: Sweeping statements are awesome, as long as you aren't making them about muslims! HURR Quote:Original post by skulldrudgery No. I don't want to integrate. I want to worship Allah(swt) and practice my religion without people stepping on my nuts all the time. Racism/bigotry doesn't "seem disgusting" it is inherently disgusting. Integration has nothing to do with whether you can worship Allah or not. It's perfectly possible to keep your culture, and still be an integrated member of society. What is bad is groups of immigrants that form ghettos, only ever having contact with people from their home country, and never learning to speak the native language of the country they live in. If people don't mix with each other/can't communicate, this is a bad thing, and leads to misunderstanding. I should mention that I disagree with the French banning of religious clothing in schools, as it goes against everything integration stands for.
  12. Oxyacetylene

    How much does piracy actually affect the industry?

    Quote:Original post by Extrarius Oxyacetylene: Maybe that would be a good idea for a website - a central place for music demos. You could probably make a lot of money by putting together a music-demo-hosting site something like a cross between amazon (with the nice review system and possibly a store) and fileplanet (with a nicely categorized file-hosting system). Just ask every artist for a small hosting fee for their demos, and (if you can make your site somewhat popular) they get excellent exposure and there is a central place people can go to find 'obscure' music. Actually, considering the quality of that idea, I'd be surprised if nobody else had tried it yet. I guess it would take a lot of time and resources to get it going, though. There are already sites like that, but a lot of bands don't use them unfortunately. http://www.soundclick.com/ is an example. I despise myspace, but myspace is increasingly becoming a good place to find music as well. Even relatively big-name artists are using it to publicise their music. I know it's impossible, because it'd be impossible to make an uncrackable system, but for me, the ideal would be some kind of electronic music library. You'd pay a flat subscription fee per month, and be able to download as much music as you want. The music you downloaded wouldn't be transferrable to another medium, and would be on loan, so it would be deleted after a set amount of time (a couple of days, or a week). Obviously you could never do this though, because people would crack it and just download free music. If it were possible to make it uncrackable, then that would be the ideal for me though, because I'd be able to listen to as many bands as I wanted, and download as many of their songs as possible, to get a good feel for their music. Otherwise you have the possibility of missing out on a good artist, because the samples were from a later album that wasn't to your taste, when another one of their albums would have been.
  13. I highly recommend the book "Progamming interviews exposed". You might not get asked any of the questions in there (I certainly didn't), but studying from that book, and working on the questions is really good practice for the kind of thinking you'll have to do in an interview, and you want to be sharp on the day. If you're going for a position where C++ will be used, and you have time, I also highly recommend that you read the book Effective C++. This will help a lot if you're given a "criticise this C++ code" style question. Other than that, I was asked questions about optimisation, class-design, and debugging. I'd rather not state the actual questions, because I feel that might be a breach of trust between my employer and myself, and I take my current job a lot more seriously than my last one, as it's closer to my current career path. Quote:Original post by Steadtler Q: What is a pure virtual method in C++? Q: Ok, but CAN you define it in the mother class? Me: ... why would you do that? A reason to define an implementation for a pure-virtual function, is if you want a default implementation for a virtual function, but you want the extra safety of having to explicity call that default implementation. If you just made it a regular virtual function with a default implementation, then there's the risk that it could be called automatically in a derived class that doesn't override the function, which may not be what you want. Again, I can't recommend the book Effective C++ enough, as it covers things like this. A programmer I worked with at another company, went so far as to say that he'd base his decision to hire or not to hire, on whether not the applicant had read Effective C++ or not.
  14. Oxyacetylene

    How much does piracy actually affect the industry?

    Quote:Original post by capn_midnight The "try before you buy" theory is seriously flawed. For games, demos exist. For music, radio stations exist. You can often visit an artist's website and download samples from there. "Try before you buy" is just a dirty rationalization used by dirty, pirate hippies. I agree with regards to games, but with regards to music, for more obscure genres like industrial-noise, or the more obscure end of black-metal, it really is hard to find new artists in the genre, if they're not on one of the main labels for the genre. It is a lot better than it used to be, because the labels are seeing now that mp3 is a good way to spread their music, and providing free mp3 samples on their websites. It's a hell of a lot easier to just use one filesharing program to find these new artists, than repeatedly going through the process of google band name, find band website, download mp3. The latter is a huge pain in the arse, and can take hours. It kind of annoys me when people respond in these threads with something like "HURR WHY DONT YOU JUST GO TO A MUSIC SHOP AND LISTEN TO THE CD THERE", because they completely ignore the fact that CD shops don't really cater for the more obscure stuff. Don't get me wrong, I understand your motivations for doing this, I just think that people here can think far too much in black and white on this issue (albeit for understandable reasons).
  15. Oxyacetylene

    xbox 360 loss per unit

    Quote:Original post by Lode Do you think it'll be possible to attach a keyboard, mouse, flatscreen and network card to an XBOX 360, install Linux on it, and use it to surf the internet, check my email, play Runescape, and code in C++? More realistically, does the XBOX 360 and other consoles actually support DVI? In my small dorm room I'd like to use my flatscreen as screen for it, and not some TV I have to place in there. From what I've heard, it sounds like you want a PS3 more than an Xbox 360. There were rumours flying about that the PS3 was going to come pre-installed with linux.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!