9 Discussion / Question Topics

Remove Filter
Member Avatar for hacker9801

I was thinking about making an avatar system (like Gaia Online; I've tried befor but it's hard). Can anybody help me with one? I'm gonna make an open source site like Gaia... I can't do it by myself, though.

Member Avatar for jmvazq
0
608
Member Avatar for hacker9801

Hey. What's better, i++ or ++i? Well ++i returns the value after it's incremented, but which is faster? (not necessarily for int, user-defined types with operator++ overloaded too.)

Member Avatar for hacker9801
0
112
Member Avatar for hacker9801

If you use the new operator on a class, say [code=c++]class dummy { public: string f; }; int main(int argc, char *argv[]) { dummy *p = new dummy; return 0; }[/code] do you have to use the delete operator on [icode]p[/icode]? (since, apparently, it utilizes new.)

Member Avatar for hacker9801
0
88
Member Avatar for hacker9801

I know the & operator means address-of, but what's it do when in a function prototype? Example: [code=c++]void foo(std::string& str)[/code] or [code=c++]void foo(char& c)[/code] what's the & for in that?

Member Avatar for VernonDozier
0
104
Member Avatar for hacker9801

Hey. I want to make a packet structure, something like [code=c++]struct Packet { int cmd; /* command */ int len; /* length of body */ char body[30]; /* body (should be length of len though, might use std::string) */ };[/code] Now, if I recieve some data thru a socket (I'm …

Member Avatar for hacker9801
0
109
Member Avatar for hacker9801

Hey. Right now in my game (online) I'm using std::vectors to store player info. Should I continue to use them (I hate having to loop thru them each time to find a player) or should I use MySQL to hold player information (like map their on, nickname, id, position, etc.)?

Member Avatar for Rajith Cherian
0
117
Member Avatar for hacker9801

Hey all. I'm making an online game. It uses XML maps, and I was wondering... what's the best way to transfer an XML file over a socket? I want my server to send an XML map whenever it's requested, but I dunno how I'd get the xml from the other …

Member Avatar for Salem
0
158
Member Avatar for hacker9801

Hello. I'm using JS/DOM to create a map in a <div>, named map, like this: [code=javascript]var tile = document.createElement("IMG"); tile.src = "tiles/" + node.getAttribute("type"); tile.setAttribute("width", "32"); tile.setAttribute("height", "32"); tile.className = "brick"; map.appendChild(tile); [/code] It works, but the image breaks on a <br/> (screenshot: [url]http://i28.tinypic.com/6ynu3o.png[/url]) the image is a 32x32 tile …

Member Avatar for hacker9801
0
115
Member Avatar for hacker9801

I'm using MySQLdb. Alright, I'm doing [code=python]import MySQLdb as mysql db = mysql.connect("localhost", "root", "password", "database") cu = db.cursor() rows = cu.execute("INSERT INTO users (user, pass) VALUES ('test', 'test')") print "rows affected:", rows cu.close();db.close()[/code] Well, what happens is, it gets executed and prints "rows affected: 1" BUT when I check …

0
75