PDA

View Full Version : CODE Tags script bug



Mario F.
10-09-2006, 09:57 PM
Thanks for implementing again the code tag script. However there is some problem with it.

I cannot reply with the text in attachment.

Dave_Sinkula
10-09-2006, 10:02 PM
Hmm.
Nevermind. I see the brick definition on a previous post.

So... let's go back.

With the resize (which I don't suggest), your Brick class must have a default constructor. And it could be something like this:



class Brick : public Object
{
public:
// Brick(int x, int y, unsigned int w, unsigned int h, int new_hp);
Brick(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0, int new_hp = 0);
void SetHP(int num);
int GetHP();
protected:

private:
int hp;
};


This allows you to create a Brick instance without passing it any initializer. Just what the resize( ) needs. However, you will then have to set x, y, w and others inside the loops.

With the former reserve( ) option, you don't need to mess with the Bricks constructor. You will do the loops like this:



bricks.reserve(rows);
for(int y = 0; y < rows; y++)
{
bricks.push_back();
bricks[y].reserve(columns);
for(int x = 0; x < columns; x++)
{
bricks[y].push_back(y, x, whatever_w_is, whatever_h_is, whatever_new_hp_is);
bricks[y][x].SetWidth(brick_w);
bricks[y][x].SetHeight(brick_h);
bricks[y][x].SetHP(brick_hp);
bricks[y][x].SetX( brick_x + (brick_w * x) );
bricks[y][x].SetY( brick_y + (brick_h * y) );
}
}


I think that should work of the top of my head. However, It does confuses me slightly those reserves on second thought. If you have something like, say, a 50 by 50 grid (which would be huge on a breakout type of game), those reserve( ) will not give you any benefit. This is a function that is better used on fast growing arrays with respectable dimensions. I would probably lose the reserve( ) lines altogether.

Decrypt
10-09-2006, 10:04 PM
Works fine for me...if I change the code tags to lowercase.

Salem
10-10-2006, 05:12 AM
And it came to pass that the code tag checking script was restored for the masses.
Verily, there was much rejoicing and merriment.

Mario F.
10-10-2006, 05:36 AM
Absolutely! Good riddance code-tags-I-have-an-idea threads!
My first experience with it was however... unpleasant. But I got it right now.

Jaqui
10-10-2006, 06:08 AM
silly me, I always just type the tags I need in my replies.
[ and boy am I lazy with the shift key ..maybe that's why I never have problemswith my tags ;) ]

twomers
10-10-2006, 06:23 AM
And it came to pass that the code tag checking script was restored for the masses.
Verily, there was much rejoicing and merriment.
But not yet a quick tag button ... sigh

Mario F.
10-10-2006, 06:36 AM
> Rod y Gab

Excellent video twomers. I only wished the bloody camera stayed still. The director should be shot.

But it reminds me of some of the Gipsy Kings concerts with unknown invited guests. These "unknowns" where really people they were helping to come out of the woodwork in their own countries at least. Master(!!) guitar players some of them. I will never forget a concert in Madrid (or was it Barcelona?) where they had this blind guy playing with the guitar lying down on his lap (no, it was not Jeff Healey). He played faster than these two. It's... yeah!

Decrypt
10-10-2006, 12:59 PM
Verily, there was much rejoicing and merriment
yaaaaaaaaay.

webmaster
10-15-2006, 11:36 AM
Whoops. This should be fixed now.

twomers
10-15-2006, 12:42 PM
[C O D E][/C O D E] (ignore spaces)

Both of the above used to work before, now only the small one does.

webmaster
10-15-2006, 01:37 PM
Both of the above used to work before, now only the small one does.

Are you sure you're not just seeing a caching issue?

twomers
10-15-2006, 01:44 PM
I dunno. I downloaded Martin's color coder, and it automatically puts the code tags to caps. Meh, I'll just have to deal with it :p I put it on my sig cause I didn't want to make a new thread about something code-tag related and forgot about this one. Now that I know someone knows though. Woo! Smaller sig

webmaster
10-15-2006, 02:08 PM
{
all caps code tags...
}

twomers
10-15-2006, 02:18 PM
I noticed :p Used that code tagger, and didn't have to change it to lower case :) best webmaster ever!