1. C++ / Говнокод #7356

    +147

    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
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    int offset_800=0;
    	if(SCREEN_WIDTH == 800) offset_800 = 20;
    
    	addItem(TNM_GAMELOFT_LOG_GREEN_ITEM, done, complete_log[lang][0], TNM_ItemCoords[TNM_GAMELOFT_LOG_GREEN_ITEM][0]*((float)1200/(float)SCREEN_WIDTH)-35-offset_800/*-offset_shtamp*3*/, TNM_ItemCoords[TNM_GAMELOFT_LOG_GREEN_ITEM][1]*((float)720/(float)SCREEN_HEIGHT)/*-offset_shtamp*3*/, -1, ITEM_INVISIBLE)
    		->attachTo2dItem(pItemListBG);
    	addItem(TNM_GAMELOFT_LOG_RED_ITEM, done, complete_log[lang][1], TNM_ItemCoords[TNM_GAMELOFT_LOG_RED_ITEM][0]*((float)1200/(float)SCREEN_WIDTH)-35-offset_800/*-offset_shtamp*3*/, TNM_ItemCoords[TNM_GAMELOFT_LOG_RED_ITEM][1]*((float)720/(float)SCREEN_HEIGHT)/*-offset_shtamp*3*/, -1, ITEM_INVISIBLE)
    		->attachTo2dItem(pItemListBG);
    	
    //#ifdef WIN32
    
    	addItem(TNM_CHEAT_WIN, main_all, 30, TNM_ItemCoords[TNM_CHEAT_WIN][0],TNM_ItemCoords[TNM_CHEAT_WIN][1], 31, ITEM_INVISIBLE);
    	addItem(TNM_CHEAT_LOSE, main_all, 30, TNM_ItemCoords[TNM_CHEAT_LOSE][0],TNM_ItemCoords[TNM_CHEAT_LOSE][1], 31, ITEM_INVISIBLE);
    //#endif
         int offY=0;
    	int offset=0,
    		offsetmailX=0;
    	
    	if(SCREEN_WIDTH ==800||SCREEN_WIDTH == 1024)
    		offset=2;
    	
    	if(SCREEN_WIDTH==1366||SCREEN_WIDTH == 1440){
    		offY=4;
    		offset=2;
    	}
    	if( SCREEN_WIDTH==1680)
    	{ 
    		offY=7;
    		offset=2;
    		offsetmailX=60;
    	}
    		if( SCREEN_WIDTH==1920)
    	{ 
    		offY=7;
    		offset=5;
    		offsetmailX=60;
    	}
    
    		int y_800=0;
    
    		if(SCREEN_WIDTH == 1440) offsetmailX = 20;
    		if(SCREEN_HEIGHT == 800) {
    			offset = 2;
    			offY = 1;
    			
    		}
    		if(SCREEN_WIDTH == 2560) offset=2;
    		if(SCREEN_WIDTH == 1024) offY+=1;
    		if(SCREEN_WIDTH == 800&&(Text::getInstance().getLanguage()== Text::LANG_SC||Text::getInstance().getLanguage()== Text::LANG_KR)) {
    			offY-=1;
    			y_800 = 3;
    		}
    
    		
    
    		if((SCREEN_WIDTH == 1680||SCREEN_HEIGHT == 1080)&&(Text::getInstance().getLanguage()== Text::LANG_SC||Text::getInstance().getLanguage()== Text::LANG_KR)){
    			//offset-=2;
    			offY-=2;
    		}
    		if((SCREEN_HEIGHT == 1200)&&(Text::getInstance().getLanguage()== Text::LANG_SC||Text::getInstance().getLanguage()== Text::LANG_KR))
    			offY-=2;
    
    	addText(TNM_MESSAGE_SENDER_ITEM, STR_SENDER, SPRITE_FONT_S2_EG, TNM_ItemCoords[TNM_MESSAGE_SENDER_ITEM][0], TNM_ItemCoords[TNM_MESSAGE_SENDER_ITEM][1]/*-offY*/, ITEM_INVISIBLE, LEFT)
    		->attachTo2dItem(pItemListBG);
    	
    	
    
    	addText(TNM_MESSAGE_SUBJECT_ITEM, STR_SUBJECT, SPRITE_FONT_S2_EG, TNM_ItemCoords[TNM_MESSAGE_SUBJECT_ITEM][0], TNM_ItemCoords[TNM_MESSAGE_SUBJECT_ITEM][1]-offset-offY*1.5f+y_800, ITEM_INVISIBLE, LEFT)
    		->attachTo2dItem(pItemListBG);
    	addText(TNM_MESSAGE_TIME_ITEM, STR_RECEIVED, SPRITE_FONT_S2_EG, TNM_ItemCoords[TNM_MESSAGE_TIME_ITEM][0], TNM_ItemCoords[TNM_MESSAGE_TIME_ITEM][1]-offY*1.07f,  ITEM_INVISIBLE, LEFT)
    		->attachTo2dItem(pItemListBG);
    	//addText(TNM_MAIL_TITLE_ITEM, "Sender: \nRecieved: \nSubject: ", fontS, TNM_ItemCoords[TNM_MAIL_TITLE_ITEM][0], TNM_ItemCoords[TNM_MAIL_TITLE_ITEM][1], ITEM_INVISIBLE, LEFT|TOP);
    	int space = lang == Text::LANG_IT ? 10 : 0;
    	if(lang == Text::LANG_KR)
    		space = 30;
    	int spaceY=0;
    
    	
    	if(SCREEN_WIDTH!=1680&&SCREEN_WIDTH!=1920)
    		switch( pGame->getCurrentLanguage() )
    	{
    	case Text::LANG_KR:
    		spaceY = 2;
    		break;
    	case Text::LANG_SC:
    		spaceY = 2;
    		break;
    	case Text::LANG_JP:
    		spaceY = 2;
    		break;
    	}
    
    	addText(TNM_MAIL_TITLE1_ITEM, m_mailTitle, SPRITE_FONT_S2_EG, TNM_ItemCoords[TNM_MAIL_TITLE1_ITEM][0] + space, TNM_ItemCoords[TNM_MAIL_TITLE1_ITEM][1], ITEM_INVISIBLE, LEFT|TOP)
    		->attachTo2dItem(pItemListBG);
    	addText(TNM_MAIL_TITLE2_ITEM, m_mailTitle, SPRITE_FONT_S2_EG, TNM_ItemCoords[TNM_MAIL_TITLE2_ITEM][0] + space, TNM_ItemCoords[TNM_MAIL_TITLE2_ITEM][1]-offY*1.07f, ITEM_INVISIBLE, LEFT|TOP)
    		->attachTo2dItem(pItemListBG);
    	addText(TNM_MAIL_TITLE3_ITEM, m_mailTitle, SPRITE_FONT_S2_EG, TNM_ItemCoords[TNM_MAIL_TITLE3_ITEM][0] + space, TNM_ItemCoords[TNM_MAIL_TITLE3_ITEM][1]-offset-offY*1.5f+spaceY, ITEM_INVISIBLE, LEFT|TOP)
    		->attachTo2dItem(pItemListBG);

    Еще один малый кусок. По аналогии с выложеным ранее.

    BlaZe, 27 Июля 2011

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

    +147

    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
    private static Random rnd = new Random();
    
      public static int getRand(int start, int end) {
        boolean check = false;
        int number = 0;
        if (start >= end) {
          final int temp = end;
          end = start;
          start = temp;
        }
        while (!check) {
          number = Math.abs(rnd.nextInt() % end);
          if ((number >= start) && (number < end)) {
            check = true;
          }
        }
        return number;
      }

    эпический метод, найден в исходниках игрушки

    Lure Of Chaos, 27 Июля 2011

    Комментарии (16)
  3. C++ / Говнокод #7354

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    static /vars/global/animals/cat;
    
    /pub//demo/foo(int /args/mouse)
     {
     int /vars/local/animals/dog;
     return /vars/local/animals/dog =
     /vars/global/animals/cat + /args/mouse;
     }

    как вам такой код?)

    Chekist, 27 Июля 2011

    Комментарии (40)
  4. SQL / Говнокод #7353

    −870

    1. 1
    UPDATE `options_table` SET `option_value_ru` = 'Оutlet' WHERE `option_value_ru` LIKE 'Outlet'

    Вот они какие, ничего не делающие запросы

    CRRaD, 27 Июля 2011

    Комментарии (10)
  5. Objective C / Говнокод #7352

    −320

    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
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    #define EmptyText @""
    #define TextZero @"0"
    #define TextOne @"1"
    #define TextTwo @"2"
    #define TextThree @"3"
    #define TextFour @"4"
    #define TextFive @"5"
    #define TextSix @"6"
    #define TextSeven @"7"
    #define TextEight @"8"
    #define TextNine @"9"
    
    #define DigitZero 0
    #define DigitOne 1
    #define DigitTwo 2
    #define DigitThree 3
    #define DigitFour 4
    #define DigitFive 5
    #define DigitSix 6
    #define DigitSeven 7
    #define DigitEight 8
    #define DigitNine 9
    
    -(IBAction)DigitButtonClicked:(id)sender {
        UIButton *button = (UIButton *)sender;
        if ([digitLabel.text isEqualToString:TextZero]) {
            if (button.tag == DigitOne) {
                digitLabel.text = TextOne;
            }
            if (button.tag == DigitTwo) {
                digitLabel.text = TextTwo;
            }
            if (button.tag == DigitThree) {
                digitLabel.text = TextThree;
            }
            if (button.tag == DigitFour) {
                digitLabel.text = TextFour;
            }
            if (button.tag == DigitFive) {
                digitLabel.text = TextFive;
            }
            if (button.tag == DigitSix) {
                digitLabel.text = TextSix;
            }
            if (button.tag == DigitSeven) {
                digitLabel.text = TextSeven;
            }
            if (button.tag == DigitEight) {
                digitLabel.text = TextEight;
            }
            if (button.tag == DigitNine) {
                digitLabel.text = TextNine;
            }
        } else {
            if (button.tag == DigitOne) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitOne];
            }
            if (button.tag == DigitTwo) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitTwo];
            }
            if (button.tag == DigitThree) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitThree];
            }
            if (button.tag == DigitFour) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitFour];
            }
            if (button.tag == DigitFive) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitFive];
            }
            if (button.tag == DigitSix) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitSix];
            }
            if (button.tag == DigitSeven) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitSeven];
            }
            if (button.tag == DigitEight) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitEight];
            }
            if (button.tag == DigitNine) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitNine];
            }
            if (button.tag == DigitZero) {
                digitLabel.text = [digitLabel.text stringByAppendingFormat:@"%d",DigitZero];
            }
        }
    }
    
    -(IBAction)DeleteButtonClicked {
        if (![digitLabel.text isEqualToString:TextZero]) {
            if (![digitLabel.text isEqualToString:EmptyText]) {
                digitLabel.text = [ digitLabel.text substringToIndex:[digitLabel.text length] - 1 ];
                if ([digitLabel.text length] == DigitZero) {
                    digitLabel.text = TextZero;
                }
            } else {
                digitLabel.text = TextZero;
            }
        }
    }

    кусок кода, который по нажатой кнопке определяет что за цифра и добавляет ее в конец строки (или удаляет)...
    контрол по типу калькулятора

    olgerd, 27 Июля 2011

    Комментарии (9)
  6. JavaScript / Говнокод #7349

    +149

    1. 1
    var save = if($('input#remmepls').attr('checked="checked"')){1}else{0};

    Думаю и так всё понятно

    TRANE73, 26 Июля 2011

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

    +147

    1. 1
    2. 2
    3. 3
    public class RecordCount {
        public static int reccounter = 0;
    }

    anatew, 26 Июля 2011

    Комментарии (20)
  8. 1C / Говнокод #7347

    −153

    1. 1
    ТСтрока=Товары.Получить(Товары.Индекс(ЭтаФорма.ЭлементыФормы.Товары.ТекущаяСтрока));

    luns, 26 Июля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($flag == false) {
    
    # на всякий случай
    if (false == true) exit;
    
    include «execute.php»;
    }

    На просторах инета... Какой ещё ВСЯКИЙ СЛУЧАЙ?

    qwert1x, 26 Июля 2011

    Комментарии (35)
  10. Pascal / Говнокод #7345

    +155

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    procedure TForm1.Image1Click(Sender: TObject);
    begin
     sPictureName := Label2.Caption;
     Form2.Show;
    end;
    
    procedure TForm1.Image2Click(Sender: TObject);
    begin
     sPictureName := Label3.Caption;
     Form2.Show;
    end;

    Знаю конечно что уныло, но по моему делать одну процедуру из-за этого слишком геморройно. С тем же массивом из 2-х элементов хотя бы. Говно ли?

    Govnocoder#0xFF, 26 Июля 2011

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