PDA

View Full Version : Cant fix this loose indentation -.-


RLGaming
17/09/2012, 05:04 PM
Code:
stock CountLockers()
{
new Lcount;
for(new x=1; x < MAX_LOCKERS_POINT;x++)
{
new path[100];
for(new lockerid = 1; lockerid < MAX_LOCKERS_POINT; lockerid++)
{
format(path,sizeof(path),"/Factions/Locker%d.ini", lockerid);
if(fexist(path))
{
LockersPointCreated[lockerid] = 1;
return 1;
}
else
{
LockersPointCreated[lockerid] = 0;
return 1;
}
}
}
return Lcount;
}

I cannot fix this loose indentation, so annoying -.-

Can anyone fix it please, the loose indentation is on this line:
return Lcount;

+rep to anyone who can fix it

Seven_of_Nine
17/09/2012, 05:08 PM
stock CountLockers() {
new Lcount;
for(new x=1; x < MAX_LOCKERS_POINT;x++) {
new path[100];
for(new lockerid = 1; lockerid < MAX_LOCKERS_POINT; lockerid++) {
format(path,sizeof(path),"/Factions/Locker%d.ini", lockerid);
if(fexist(path)) {
LockersPointCreated[lockerid] = 1;
return 1;
} else {
LockersPointCreated[lockerid] = 0;
return 1;
}
}
}
return Lcount;
}

this is how it should look like
also, if you are bad with indentation, use #pragma tabsize 0, even if it's not recommended

vIBIENNYx
17/09/2012, 05:11 PM
stock CountLockers()
{
new Lcount;
for(new x=1; x < MAX_LOCKERS_POINT;x++)
{
new path[100];
for(new lockerid = 1; lockerid < MAX_LOCKERS_POINT; lockerid++)
{
format(path,sizeof(path),"/Factions/Locker%d.ini", lockerid);

if(fexist(path))
{
LockersPointCreated[lockerid] = 1;
return 1;
}
else
{
LockersPointCreated[lockerid] = 0;
return 1;
}
}
}
return Lcount;
}

Seven_of_Nine
17/09/2012, 05:12 PM
stock CountLockers()
{
new Lcount;
for(new x=1; x < MAX_LOCKERS_POINT;x++)
{
new path[100];
for(new lockerid = 1; lockerid < MAX_LOCKERS_POINT; lockerid++)
{
format(path,sizeof(path),"/Factions/Locker%d.ini", lockerid);

if(fexist(path))
{
LockersPointCreated[lockerid] = 1;
return 1;
}
else
{
LockersPointCreated[lockerid] = 0;
return 1;
}
}
}
return Lcount;
}
or that, if you want to waste lines with {'s ;]

RLGaming
17/09/2012, 05:16 PM
stock CountLockers() {
new Lcount;
for(new x=1; x < MAX_LOCKERS_POINT;x++) {
new path[100];
for(new lockerid = 1; lockerid < MAX_LOCKERS_POINT; lockerid++) {
format(path,sizeof(path),"/Factions/Locker%d.ini", lockerid);
if(fexist(path)) {
LockersPointCreated[lockerid] = 1;
return 1;
} else {
LockersPointCreated[lockerid] = 0;
return 1;
}
}
}
return Lcount;
}

this is how it should look like
also, if you are bad with indentation, use #pragma tabsize 0, even if it's not recommended


Thanks, fixed it!

Repped!

Kaperstone
17/09/2012, 06:24 PM
this is how it should look like
also, if you are bad with indentation, use #pragma tabsize 0, even if it's not recommended
Do you know why its not recommended ?

Riddy
17/09/2012, 06:24 PM
Don't EVER do this! And Seven_of_Nine, telling people to do it is by definition recommending it!

Mind explaining why.

Kaperstone
17/09/2012, 06:32 PM
Mind explaining why.
Use it instead :
http://dracoblue.net/tidy/pawn/

Riddy
17/09/2012, 06:37 PM
Use it instead :
http://dracoblue.net/tidy/pawn/

I've never even use #pragma tabsize 0, just wondered why it isnt recommended.

AtItsMax
17/09/2012, 06:48 PM
I've never even use #pragma tabsize 0, just wondered why it isnt recommended.
Because #pragma tabsize 0 avoids every warning big one or minor one.

Glint
17/09/2012, 07:36 PM
Use it instead :
http://dracoblue.net/tidy/pawn/

That one is broken try to use this one http://codegenerators.pl/indent it works like a charm for me.

AndreT
17/09/2012, 07:45 PM
Because code removed, yo avoids every warning big one or minor one.
I don't actually think it does, it just gets rid of the 217-warnings.

And the reason writing unindented code is simpler than than anything else: preserve code readability and stick to good practices.

No-one is telling you to use proper indentation. Moreover, if you have no further interest in programming, don't ever intend to work in software area or post your code in the forums to help others, you can stay away from indenting your code. But you should consider the fact that reading your unindented code 3 months from now will be a lot more difficult than reading indented code, there's a simple reason for this: your head is not a garbage bin and you cannot possibly remember everything you wrote down months ago.

So take this suggestion and write nice code for your own sake.

AndreT
17/09/2012, 08:04 PM
It sounds unbelievably bad torn from its context, I know! :P