View Single Post
  #6  
Old 06-21-2007, 05:57 AM
devn00b's Avatar
devn00b
Demi-God
 
Join Date: Jan 2002
Posts: 15,658
Default

Lmao I decided to peak at the code myself...and its a joke.

Code:
 char tmpname[64];
           int count0 = 0;
           bool filefound = false;
           tmpf = fopen(filename.c_str(), "r");
           if(tmpf != NULL) {
                fclose(tmpf);
                filefound = true;
           }
WTF is tmpname doing there? its not even used.

or how about

Code:
        filename = "quests/";
                     filename += QUEST_TEMPLATES_DIRECTORY;
                     filename += "/";
                     filename += tmpname;
                     filename += ".pl";
Come on put that shit on one line. Talk about sloppy.

or hey here is some really great code
Code:
    tmpname[0] = 0;
           //if there is no file for the NPC's ID, try for the NPC's name
           if(! filefound) {
                //revert to just path
                filename = bnfilename;
                const NPCType *npct = database.GetNPCType(npcid);
                if(npct == NULL) {
 //LogFile->write(EQEMuLog::Debug, "     no npc type");
                     //revert and go on with life
                     filename += itoa(npcid);
                     filename += ".pl";
                     curmode = questByID;
                } else {
                     //trace out the ` characters, turn into -
 
                     int nlen = strlen(npct->name);
                     if(nlen < 64) {     //just to make sure
                          int r;
                          //this should get our NULL as well..
                          for(r = 0; r <= nlen; r++) {
                               tmpname[r] = npct->name[r];
 
                               //watch for 00 delimiter
                               if(tmpname[r] == '0') {
                                    count0++;
                                    if(count0 > 1) {     //second '0'
                                         //stop before previous 0
                                         tmpname[r-1] = '\0';
                                         break;
                                    }
                               } else {
                                    count0 = 0;
                               }
 
                               //rewrite ` to be more file name friendly
                               if(tmpname[r] == '`')
                                    tmpname[r] = '-';
 
                          }
                          filename += tmpname;
                          filename += ".pl";
                          curmode = questByName;
                     } else {
 //LogFile->write(EQEMuLog::Debug, "     namelen too long");
                          //revert and go on with life, again
                          filename += itoa(npcid);
                          filename += ".pl";
                          curmode = questByID;
                     }
                }
Wow you know if i did shit like that at work, id be fired on the spot. not only fired id be laughed out of the fucking building and shot.

You know back in the day we had a project leader that would inspect changes like this.

Wtf not tested on windows?! Whats that bs? It compiles SHIP IT! If your going to write code just for nix fork the project and release the code as "nix compile". My oh my how eqemu has degraded. I almost hate saying this, but where is hogie when ya need him.
__________________
(Former)Senior EQEMu Developer
GuildWars Co-Founder / World Builder.
World Builder and Co-Founder Zek [PVP/Guild Wars/City Takeovers]
Member of the "I hate devn00b" Club
Most Senior EQEMu Member.

Current Work: EverQuest 2 Emulator. Zeklabs Server
Reply With Quote