|
|
quixadhal
Wizard


Group: Members
Posts: 1,473
Joined: Oct 17, 2007
|
#122 id:14172 Posted Oct 20, 2008, 2:29 pm
|
Argh! N00b mistake. I forgot to convert tabs to spaces first. :)
Ok, so a brain-dead conversion yields the table below. The real result would be somewhere in-between, since not ALL tabs would become 8 spaces. Tabs are evil, after indent, anyone putting a tab literal in the code will be humiliated on slashdot or something.
Code (text): 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 | The codebase contains 44851 lines of code.
The overall average line length of the codebase is 29.5710909455753 characters,
and the overall longest line is 111 characters.
Length 111 1
Length 103 1
Length 99 1
Length 98 2
Length 97 3
Length 96 2
Length 95 6
Length 94 5
Length 93 8
Length 92 16
Length 91 27
Length 90 19
Length 89 45
Length 88 38
Length 87 52
Length 86 66
Length 85 64
Length 84 106
Length 83 202
Length 82 77
Length 81 180
Length 80 245
Length 79 320
Length 78 300 |
The dropoff point has moved from about 81 to about 92, which means it's really probably around 86. I'll run the code through with it set at 90 and at 94 and see what it looks like.
|
......................... 
|
|
quixadhal
Wizard


Group: Members
Posts: 1,473
Joined: Oct 17, 2007
|
#123 id:14183 Posted Oct 20, 2008, 4:53 pm
|
ROFLMAO!
From ye olden days, I've know indent to occasionally break things. The goal is, of course, to indent things and then hand-clean them to the point where running them through indent again doesn't change them. Maybe we'll get there, maybe not. But this is amusing... and it still compiles.
In magic.c, the function is spell_nexus(). This monstrosity:
Code (text): 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | if ( ( victim = get_char_world( ch, target_name ) ) == NULL
|| victim == ch
|| (to_room = victim->in_room) == NULL
|| !can_see_room(ch,to_room) || !can_see_room(ch,from_room)
|| IS_SET(to_room->room_flags, ROOM_SAFE)
|| IS_SET(from_room->room_flags,ROOM_SAFE)
|| IS_SET(to_room->room_flags, ROOM_PRIVATE)
|| IS_SET(to_room->room_flags, ROOM_SOLITARY)
|| IS_SET(to_room->room_flags, ROOM_NO_RECALL)
|| IS_SET(from_room->room_flags,ROOM_NO_RECALL)
|| victim->level >= level + 3
|| (!IS_NPC(victim) && victim->level >= LEVEL_HERO) /* NOT trust */
|| (IS_NPC(victim) && IS_SET(victim->imm_flags,IMM_SUMMON))
|| (IS_NPC(victim) && saves_spell( level, victim,DAM_NONE) )
|| (is_clan(victim) && !is_same_clan(ch,victim)))
{
send_to_char( "You failed.\n\r", ch );
return;
} |
got turned into this beastie!
Code (text): 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 | if ( ( victim = get_char_world( ch, target_name ) ) == NULL || victim == ch || ( to_room =
victim->in_room ) == NULL || !can_see_room( ch, to_room ) || !can_see_room( ch, from_room ) || IS_SET(
to_room->room_flags, ROOM_SAFE ) || IS_SET( from_room->room_flags, ROOM_SAFE ) || IS_SET(
to_room->room_flags, ROOM_PRIVATE ) || IS_SET( to_room->room_flags, ROOM_SOLITARY ) || IS_SET(
to_room->room_flags, ROOM_NO_RECALL ) || IS_SET( from_room->room_flags, ROOM_NO_RECALL ) ||
victim->level >= level + 3 || ( !IS_NPC( victim ) && victim->level >= LEVEL_HERO ) /* NOT
* trust
*/
|| ( IS_NPC( victim ) && IS_SET( victim->imm_flags, IMM_SUMMON ) )
|| ( IS_NPC( victim ) && saves_spell( level, victim, DAM_NONE ) )
|| ( is_clan( victim ) && !is_same_clan( ch, victim ) ) )
{
send_to_char( "You failed.\n\r", ch );
return;
} |
Yeah, when indent does something like that to your code, it might be a subtle hint that you should rethink how you're writing it.
|
......................... 
Last edited Oct 20, 2008, 4:56 pm by quixadhal
|
|
Vassi
Conjurer


Group: Members
Posts: 182
Joined: Sep 24, 2008
|
#124 id:14184 Posted Oct 20, 2008, 5:15 pm
|
Holy crap.
Good thing they used /*comments*/ otherwise it probably would have broken.
|
......................... Vassi no Diem et Tharin
< ramble/>
|
|
|
|
quixadhal
Wizard


Group: Members
Posts: 1,473
Joined: Oct 17, 2007
|
#126 id:14214 Posted Oct 22, 2008, 12:57 am
|
Two interesting facts about indent, which I learned from this codebase.
It doesn't handle comments inside of C code very well... so things like if(foo && bar /*silly*/ && ack) tend to break things.
It also doesn't really like comments in this style:
Code (text): 1
2
3
4
5
6
7
8
9
10 | if(foo)
{
blah();
}
else /* I fail */
{
ack();
} |
Sooooo, please don't do those in RaM code. :)
Anyways, the indented version of the source is now available in the latest revision (16!) of the RaM SVN repository. Since it's such a large amount of textual change, I'll also upload a .tar.bz2 archive snapshot.
You can see the settings used in the spiffy new .indent.pro file that's in the src/ subdirectory. Hopefully, it won't be too horrible for anyone. There are a couple of rough edges yet that I'll probably address, but all in all, I think it looks reasonable and should keep things tidy.
|
......................... 
|
|
|
|
Sandi
Wizard


Group: Members
Posts: 628
Joined: Jun 17, 2006
|
#128 id:14221 Posted Oct 22, 2008, 10:05 am
|
Thanks for all your effort, Quix.
|
......................... The Witch of Tir na nOg
www.tnnmud.com
tnnmud.com 6789
|
|
|
|
|
|
|
|
Avaeryn
Conjurer


Group: Members
Posts: 113
Joined: Nov 21, 2007
|
#132 id:14258 Posted Oct 22, 2008, 8:24 pm
|
Conner said:Avaeryn said:Quix is the man, isn't he? Plus, he gives me contact hyperactivity from just being around him. There is such a thing, isn't there? 
Is this something you'd want your husband to know about? 
You're such an instigator, Conner!
Besides, what's wrong with contact hyperactivity? Unless it means you end up breaking that special vase his Aunt Thelma gave you umpteen gazillion years ago accidentally-on-purpose!
quixadhal said:Excellent! I've got them all fooled! Muahahaha!
Seriously, you think I'm busy...
You haven't got anyone fooled, quix! I knew when you showed up at the first meeting with orange hairs on your clothing. Not to mention, the purring gave you away in seconds.
|
|
|
Conner
Wizard


Group: Members
Posts: 1,250
Joined: May 14, 2006
|
#133 id:14274 Posted Oct 23, 2008, 4:40 pm
|
Avaeryn said:Conner said:Avaeryn said:Quix is the man, isn't he? Plus, he gives me contact hyperactivity from just being around him. There is such a thing, isn't there? 
Is this something you'd want your husband to know about? 
 You're such an instigator, Conner!
Besides, what's wrong with contact hyperactivity? Unless it means you end up breaking that special vase his Aunt Thelma gave you umpteen gazillion years ago accidentally-on-purpose!
Instigator? Me?? Never!
Now, unable to resist an obvious opening for a little harmless humor, that'd be a horse (cat?) of another color...
As for what's wrong with contact hyperactivity, nothing really, except the contact aspect if hubby is the really jealous type.
|
|
|
|
|
|
|