Jump to content
  • Advertisement

Acid-Chris

Member
  • Content count

    119
  • Joined

  • Last visited

Community Reputation

504 Good

About Acid-Chris

  • Rank
    Member
  1. Acid-Chris

    Funniest line of code ever ?

    I've seen things....: return STATUS_ERROR;  //This returns the status error Anyway, if i look at 5+ year old code of mine i still would laugh out loud many many times. ;)
  2. This is just bad, bad code design. You should seriously consider a rework of your game structure. It's pretty pointless to store anything in a "i dont know exactly how many items i need to store" matter.   Sure, the example code above will work, even if you'd need a variable which has the number of elements to read, also stored in your file. If you really want to continue with your approach, check out the previously mentioned JSON format, even XML will do.    If you continue in that hackish way, you'll be very frustraed at some point and you'll end up throwing your project away.
  3. Acid-Chris

    Component based system

    I found this one pretty well designed:   https://github.com/alecthomas/entityx   best regards
  4. Acid-Chris

    Windows.h has just dissappeared!?

    Hasnt all of this been moved into the Windows SDK? http://www.microsoft.com/en-us/download/details.aspx?id=8279   Search for it, either Windows 7 or Windows 8 SDK's available. download and install it, maybe it's something like that.   best regards
  5. Acid-Chris

    Optimizing entity rendering?

    Hi,   Little bit off-topic, sorry about that, but where did you get your "Component" system ideas from?  Is that from a specific framework?   best regards
  6. Acid-Chris

    Logic error in my code i think

    There is so much wrong in these 3 functions.   But one of the biggest issues, besides all the other ones the previous posters mentioned is in your load_map function:   map_file *tehMap; [some weird code here] return tehMap;     and thats it? you do nothing with this? no allocation, no assignment of your map data? There are so many more ways to read your map data, many more EASIER ways. You can read your 100x100 grid all at once, the just use a memcpy or whatever. Why parse it in such a strange way? You could simply read the whole map_file struct all at once if you had saved it properly.   Your comment is nice: "// i plan on using the function to assign the values from the file to the struct" but...you never do that!!   Please, do yourself a favour and THINK STEP BY STEP on what you do. To me, this looks like you copy and pasted fragments of map loading code you found on google into your program.   No offence mate, but please start with a smaller map!  Use a grid of 5x5 tiles for example where you easily can check all contents of the array in the DEBUGGER. If your loading code works, it doesnt matter if you're using a 5x5 or 1000x1000 map.   Good luck, - Christoph -  
  7. There's much much more wrong in that piece of code than just a plain pointer issue.   Besides the allocations you do every frame, there are also a lot more copy-constructor calls than you might expect. Get rid of that; it may be just a Vec2 class but clean code doesnt hurt anyone.  use const references, or just pass the position as 2 parameters.   Next point is ... why do you want to use a pointer anyway? Sprite classes usually store their position for collision detection or rendering or whatever. And you do realize that pointers take up memory as well, right?  Depending on the OS, the size is different. On Windows it's 4 byte if i remember correctly. So basically you win nothing using your method.   best regards
  8. Acid-Chris

    Source control - branching strategies

    If you can afford it, you should take a look at Clear Case.
  9. Acid-Chris

    Using Constants in Headers

    First of all, in your Constants.cpp file you need to write "const int MAX_INTS = 1000; " The extern keyword means "declare without defining". In other words, it is a way to explicitly declare a variable, or to force a declaration without a definition. The practice itself (putting the initialization into the cpp file) is a matter of personal taste. I personally like it because if i need to change the value for whatever reason, not every single file which includes the header file is compiled again. But i wouldnt use "extern" anymore....i like static const uint32 MAX_INTS; in a header file more. ;-)
  10. Acid-Chris

    Out of scope problem (I think) [C++]

    Hi, i'm not quite sure what you are trying to achieve. Is it just the text length of the user input? If so, why not simply asking for the string length? //change from hard coded 256 to get text length somehow GetDlgItemText(hwnd, IDC_TEXTBOX, (LPSTR)cChatMessage, 256); //256 here is just the maximum size of your char[] buffer int length = strlen(cChatMessage); I assume your GetWindowTextLength() does not work because you're running a dialog based application. best regards & good luck
  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!