Trying to parse GetAccountNum() into a string! GRR

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
Post Reply
User avatar
Jediman
UOX3 Apprentice
Posts: 177
Joined: Fri Jul 16, 2004 1:38 am
Location: New England
Has thanked: 0
Been thanked: 0
Contact:

Trying to parse GetAccountNum() into a string! GRR

Post by Jediman »

Perhaps Giwo or someone could shed some light onto this..

While writing the code for the player pages output, I'm proposing that the directory format be:

(html_path_definied_in_ini)\players\(account_#)\
Under that would be the player page belonging to that account e.g Jediman.

The problem is GetAccountNum() is a UI16...where as I need it to be a string to append to my path parsing parameters (say THAT three times fast XD).

I can't seem to find a way to copy that UI16 or parse it over to a string format, and was hoping someone could shed light onto the matter.

Right now I'm using (html_path_definied_in_ini)\players\(account_name)\ and it's really a security hole!
Realms of Valor
- -=- http://www.realmsofvalor.com -=-
-=-Powered By UOX3-=-

Have you read the installation documentation?
http://www.uox3.org/documentation.shtml

'I have a moongate in my backpack' sounds like a bad Brittanian pickup line!
User avatar
Jediman
UOX3 Apprentice
Posts: 177
Joined: Fri Jul 16, 2004 1:38 am
Location: New England
Has thanked: 0
Been thanked: 0
Contact:

Post by Jediman »

AHA
Solved it!

UI16 playerActID;
playerActID += tChar->GetAccountNum();

UString pAccountId = UString::number(playerActID);


:-D *does the happy dance*
Realms of Valor
- -=- http://www.realmsofvalor.com -=-
-=-Powered By UOX3-=-

Have you read the installation documentation?
http://www.uox3.org/documentation.shtml

'I have a moongate in my backpack' sounds like a bad Brittanian pickup line!
Maarc
Developer
Posts: 576
Joined: Sat Mar 27, 2004 6:22 am
Location: Fleet, UK
Has thanked: 0
Been thanked: 0
Contact:

Post by Maarc »

Code: Select all

				UI16 playerActID;
				playerActID += tChar->GetAccountNum();

				UString pAccountId = UString::number(playerActID);
You can simplify

Code: Select all

				UString pAccountId = UString::number( tChar->GetAccountNum() );
Unless, of course, you want to reuse. But if you don't want to reuse, don't use += operator. Something like:

Code: Select all

				UI16 playerActID = 0;
...
...
...
				playerActID = tChar->GetAccountNum();
or

Code: Select all

				UI16 playerActID = tChar->GetAccountNum();
VC debug builds do nice things like initialising your vars to 0 and such. In release, you've no such safeguards :) Tracking such bugs can be annoying.
User avatar
Jediman
UOX3 Apprentice
Posts: 177
Joined: Fri Jul 16, 2004 1:38 am
Location: New England
Has thanked: 0
Been thanked: 0
Contact:

Post by Jediman »

Maarc, great point!

Thats something I think I've forgotten to do over the years thanks to dirty coding with C# :)

Once I get the framework layed out i'll be going through with a fine toothed comb to optimise the code and fix things to ensure it works with the release and not just debug :-D
Realms of Valor
- -=- http://www.realmsofvalor.com -=-
-=-Powered By UOX3-=-

Have you read the installation documentation?
http://www.uox3.org/documentation.shtml

'I have a moongate in my backpack' sounds like a bad Brittanian pickup line!
Post Reply