1. Куча / Говнокод #7942

    +132

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    if instance_number(global.obj_childwindow) exit
    global.oid=id
    no_etazh=etazh
    no_x=x/16
    no_y=y/16
    no_name=name
    no_room=myroom
    global.param_window=chw_create(view_xview[0]+view_wview[0]/2-168,view_yview[0]+view_hview[0]/2-150,336,364,"Параметры объекта: Игрок")
    with global.param_window
    {
    step="editor_controller.selected=global.oid"
    draw="draw_set_font(font);draw_text_color(x+224,y+94,'Этаж:',0,0,0,0,1);draw_text_color(txtx.x+10,txtx.y-18,'Позиция',0,0,0,0,1);draw_text_color(txtx.x-14,txtx.y+2,'X',0,0,0,0,1);draw_text_color(txty.x-14,txty.y+2,'Y',0,0,0,0,1)"
    
    ok_btn=btn_create(16,308,80,24,"ОК","chw_destroy(parent_id);global.active=1",1)
    close_btn=btn_create(242,308,80,24,"Отмена","global.param_window.text_room=string(global.oid.no_room);global.param_window.text_name.text=global.oid.no_name;global.param_window.txtx.text=string(global.oid.no_x);global.param_window.txty.text=string(global.oid.no_y);global.param_window.floors.current_selected=global.oid.no_etazh;chw_destroy(parent_id);global.active=1",1)
    
    text_name=txt_create(80,14,112,"Название")
    with text_name {step="global.oid.name=text;with editor_controller.text_name txt_set_text(other.text)";txt_set_text(global.oid.name)}
    text_room=txt_create(80,46,112,"Комната")
    with text_room {step="if string_digits(text)!=text txt_set_text(string_digits(text));if real(text)<0 || real(text)>999 txt_set_text(string(max(min(real(text),999),0)));global.oid.myroom=real(text);with editor_controller.text_room txt_set_text(other.text)";txt_set_text(string(global.oid.myroom))}
    
    floors=list_create(176,96,144,128)
    with floors {list_copy(editor_controller.list,0,editor_controller.list.itemnmb);current_selected=editor_controller.list.current_selected;step="editor_controller.list.current_selected=current_selected;global.oid.etazh=editor_controller.list.current_selected"}
    txtx=txt_create(208,248,74)
    with txtx {txt_set_text(string(global.oid.x/16));step="if (text!=string_digits(text) || real(string_digits(text))<0 || real(string_digits(text))>(room_width-208)/16) txt_set_text(string(limit(real(string_digits(text)),0,(room_width-208)/16-1)));global.oid.x=real(text)*16"}
    txty=txt_create(208,280,74)
    with txty {txt_set_text(string(global.oid.y/16));step="if (text!=string_digits(text) || real(string_digits(text))<0 || real(string_digits(text))>(room_height-16)/16) txt_set_text(string(limit(real(string_digits(text)),0,(room_height-16)/16-1)));global.oid.y=real(text)*16"}
    }
    global.active=0

    Сам не могу поверить, что я такое мог написать.
    Это код моего редактора карт, написанный 2 года назад на Game Maker.

    gammaker, 22 Сентября 2011

    Комментарии (16)
  2. PHP / Говнокод #7941

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    /// Здесь настройки подключения к БД
    $bd_host = "openserver";
    
    $bd_user     = "root"; // - логин
    $bd_password = ""; // - пароль
    $bd_base     = "test"; // - имя базы
    
    
    mysql_connect($bd_host, $bd_user, $bd_password) or die(mysql_error());
    mysql_select_db($bd_base);
    
    
    // параметры
    $conf = mysql_query("SELECT * FROM Settings where s='1' limit 1");	
    
    $cr=mysql_fetch_assoc($conf);
    
    
    $SITENAME  = $cr['sitename'];
    $SITENAME  = str_replace('+',"<br>",$SITENAME);
    
    $SITED     = $cr['domen'];
    $SITEDESC  = $cr['description'];
    $SITEKEYW  = $cr['keywords'];
    $SEC	   = $cr['seconds'];
    
    // другие конфигурации 
    $sys_testmode = "false"	//- режим тестирования (сайты не показываются) true-вкл | false-выкл

    Гордый файл config.php

    Мартин, 22 Сентября 2011

    Комментарии (9)
  3. Куча / Говнокод #7940

    +143

    1. 1
    Хватит!

    alexoy, 22 Сентября 2011

    Комментарии (2)
  4. C++ / Говнокод #7939

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    #if !defined(_CONSOLE) && !defined(BOOTSTRAP_AGENT)
     g_scheduler.Init(&g_Schedule);
    #endif
    #if (defined(UNDER_CE) || defined(MC_AGENT)) && !defined(BOOTSTRAP_AGENT) /*&& !defined(_CONSOLE) */&& !defined(MC_APM_AGENT)
     m_collector.InitializeFromPDB(/*GetPdbFile()*/);
    #endif
    #if (defined(UNDER_CE) || defined(MC_AGENT)) && !defined(BOOTSTRAP_AGENT) && !defined(_CONSOLE) && !defined(MC_APM_AGENT)
     m_Alert.InitializeFromPDB();
    #endif
    #if !defined( _CONSOLE ) && !defined(BOOTSTRAP_AGENT)
     g_ScheduleEngine.Add( this ); // install scheduler
    #endif
    #if !defined(BOOTSTRAP_AGENT) && !defined(MC_APM_AGENT) && !defined(PRINTER_AGENT)
     g_manager.LoadFromPDB();
    #endif
    
    #if (defined(UNDER_CE) && !defined(BOOTSTRAP_AGENT)) || (defined(MC_AGENT) && !defined(_CONSOLE))
     WriteMCConnectionStatus(MCA_CONN_STATUS_INITIALIZING);
    #endif
     ASSERT(pData != NULL);
     DWORD dwRetries = 0;
    
     bool bFirstDevPkgInstalled = false; // for HHI agent only
     while (pData->nTask != PDT_QUIT)
     {
    #ifdef HHI_AGENT
    ..............

    без комментариев

    Alek86, 22 Сентября 2011

    Комментарии (12)
  5. C++ / Говнокод #7938

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    int excpt[]={03, 03, 03, 00};
    //...
    typedef int tex[sizeof(excpt)/sizeof(excpt[0])];
    typedef tex& texr;
    //... 
    throw texr(excpt);

    Уж сразу массив кидали, как исключение. Зря мелочились...

    Говногость, 22 Сентября 2011

    Комментарии (17)
  6. Java / Говнокод #7937

    +72

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if(TextUtils.isEmpty(text)
        || TextUtils.isEmpty(text)
        || TextUtils.isEmpty(text)) {
       return null;
      }

    Не уверенность в себе.

    musuk, 22 Сентября 2011

    Комментарии (9)
  7. PHP / Говнокод #7936

    +36

    1. 1
    2. 2
    3. 3
    $kd = strrpos("$fotofilenames[$i]", ".");
        $kf = substr("$fotofilenames[$i]", $kd+1, strlen("$fotofilenames[$i]")-$kd);
        $kf = strtolower($kf);

    вот так и живем.

    Специальная олимпиада по программированию для программистов PHP, VB и 1c (c)

    brainstorm, 22 Сентября 2011

    Комментарии (12)
  8. Куча / Говнокод #7935

    +124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function Trig_d_Conditions takes nothing returns boolean
        if ( not ( true == true ) ) then
            return false
        endif
        return true
    endfunction

    Код написан на JASS. Данный язык был придуман компанией Blizzard и использован в игре WarCraft 3 (WC3).
    То что вы видите было сгенерировано стандартным редактором WC3.

    alexprey, 22 Сентября 2011

    Комментарии (16)
  9. Java / Говнокод #7934

    +75

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    Entity entity1 = null;
            Entity entity2 = null;
            //..............        
            Entity entityN = null;
            
            try{
                entity1 = provider.getEntity("key1").getValue();
                entity2 = provider.getEntity("key2").getValue();
                //..................
                entityN = provider.getEntity("key3").getValue();
            }catch (NullPointerException e){
                log.error("error", e);
            }
            
            //later
            smth.call(entity1.getSMTH())

    Главное - сообщить в лог!
    Почти такое же г-но ушло на продакшн систему по причине "не успел поревьюить".

    klissan, 22 Сентября 2011

    Комментарии (7)
  10. SQL / Говнокод #7933

    −862

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    SELECT POL_PREMIUM
       INTO i_csp
       FROM policy
       WHERE 
        policy_key = i_polkey AND 
        pol_status_cde = 1;
       
     SELECT POL_CLIENT_CDE
         INTO i_clientno
         FROM policy
       WHERE policy_key = i_polkey
       AND pol_status_cde = 1;
       
       SELECT POL_PLAN_CDE
         INTO i_plan
         FROM policy
       WHERE policy_key = i_polkey
       AND pol_status_cde = 1;
    
    SELECT 110
          INTO i_SecAllrks
          FROM DUAL;

    Запятые и знаки инициализации переменных придумали для трусов =) Имхо. Не вкурила зачем так делать.

    Dragon, 22 Сентября 2011

    Комментарии (12)