Indentation

Content and general development discussion, including maps, quests, and server code from the development team.
Post Reply
imorgado
Peon
Peon
Posts: 62
Joined: Sat Jan 22, 2005 9:50 pm
Location: Rio de Janeiro - Brazil
Contact:

Indentation

Post by imorgado » Fri Feb 25, 2005 9:13 am

For all, I found that this is a good group of options for TMW indentation.

indent -npsl -bad -bap -fc1 -sc -br -ce -cdw -cli4 -cbi0 -npcs -di16 -nbc -brs -lp -ip4 -ppi3 -l79 -lc79 -nbbo -hnl -ts4 -nut CODENAME.cpp

Please do it before CVS upload. And review your code after this.

(comments to my options and enhancements are WELCOME)
User avatar
Bjørn
TMW Adviser
TMW Adviser
Posts: 1430
Joined: Thu Dec 09, 2004 7:50 pm
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn » Mon Feb 28, 2005 9:12 pm

We have indentation guidelines in docs/HACKING.txt. Basically we have agreed on using no tabs, but 4 spaces to indent. I don't like some of the aligning and spacing settings of your indent call above, and in my opinion we really don't need this tool.
imorgado
Peon
Peon
Posts: 62
Joined: Sat Jan 22, 2005 9:50 pm
Location: Rio de Janeiro - Brazil
Contact:

Post by imorgado » Tue Mar 01, 2005 4:10 am

If there is something above that disagree with TMW develop team, please tell me. That configuration was done to resamble with TMW coding style.

I didn't like to use spaces instead tabs. And 4 spaces per indentation. But I will use it anyway.
User avatar
Bjørn
TMW Adviser
TMW Adviser
Posts: 1430
Joined: Thu Dec 09, 2004 7:50 pm
Location: North Rhine-Westphalia, Germany
Contact:

Post by Bjørn » Tue Mar 01, 2005 2:45 pm

Code: Select all

extern unsigned char screen_mode;
int             fps = 0, frame = 0, current_npc = 0;
bool            displayPathToMouse = false;
  
OkDialog       *deathNotice = NULL; 
  
#define MAX_TIME 10000
  
class           DeatchNoticeListener:public gcn::ActionListener {
public:
The aligning done above is not how we write our code, I think it creates strange amounts of whitespace (so no -di16). Also, we indent "public:" by 4 spaces, similar to "case 4:" in switch statements. Lastly, as I pointed out, we use 4 spaces for indent and not 2, like your statement above seems to do (needs -i4).

We are flexible in our placement of the "{" after the if statement, while your command above seems to force them to be on the same line.

I don't like the "-ppi3".

I haven't looked through everything yet, and I think it still needs some changes, but here's a slightly improved paramter list that matches better the current TMW code:

indent -npsl -bad -bap -fc1 -sc -bl -nce -ncdw -cli4 -cbi0 -bli0 -npcs -nbc -brs -lp -ip4 -l79 -lc79 -nbbo -hnl -i4 -ts8 -nut file.cpp

Still, this tool doesn't use common sense, so I still don't agree to use it.
Post Reply