1. Лучший говнокод

    В номинации:
    За время:
  2. C++ / Говнокод #1718

    +58.1

    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
    switch (_Event) 
      {
      case LEVEL_EVENT_Stomp:
        if (_Param1 == 53)
        {
          Level_BeginThread(0, 500);
        }
        break;
      }
      switch (_Event) 
      {
      case LEVEL_EVENT_Stomp:
        if (_Param1 == 54)
        {
          Level_BeginThread(1, 500);
        }
        break;
      }
      switch (_Event) 
      {
      case LEVEL_EVENT_Stomp:
        if (_Param1 == 57)
        {
          Level_BeginThread(2, 500);
        }
        break;
      }
      switch (_Event) 
      {
      case LEVEL_EVENT_Stomp:
        if (_Param1 == 58)
        {
          Level_BeginThread(3, 500);
        }
        break;
      }
      switch (_Event) 
      {
      case LEVEL_EVENT_Stomp:
        if (_Param1 == 58)
        {
          Level_BeginThread(3, 500);
        }
        break;
      }
      switch (_Event) 
      {
      case LEVEL_EVENT_Stomp:
        if (_Param1 == 59)
        {
          Level_BeginThread(4, 500);
        }
        break;
      }

    Кусочек скрипта уровня одной игрушки. Вот что значит, если дизайнер не знает языка... Копипаст форева!!!АдинАдинАдин

    JohnnyIpcom, 28 Августа 2009

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

    +58

    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
    #include "stdafx.h"
    #define n 3
    
    void PrintMatrix(vector<vector<float> >imatrix)
    {
    	for (size_t i = 0; i < n; ++i)
    	{
    		cout << endl;
    		for (size_t j = 0; j < n; ++j)
    		{
    			cout.precision(3);
    			cout << " " << imatrix[i][j];
    		}
    	}
    }
    
    void ReverseMatrix(vector<vector<float> >imatrix, float determ)
    {
    	float t = 0;
    	for (size_t i = 0; i < n; i++)
    	{
    		for (size_t j = 0; j < n; j++)
    		{
    			t = imatrix[i][j] * (1 / determ);
    			imatrix[i][j] = t;
    		}
    	}
    	PrintMatrix(imatrix);
    }
    
    void TransposedMatrix(vector<vector<float> >imatrix, float determ)
    {
    	float t = 0;
    	for (size_t i = 0; i < n; i++)
    	{
    		for (size_t j = i; j < n; j++)
    		{
    			t = imatrix[i][j];
    			imatrix[i][j] = imatrix[j][i];
    			imatrix[j][i] = t;
    		}
    	}
    	ReverseMatrix(imatrix, determ);
    }
    
    void MinorMatrix(vector<vector<float> >imatrix, float determ)
    {
    	vector<vector<float> >imatrix2(n);
    	float t = 0.0;
    	for (size_t i = 0; i < n; ++i)
    	{
    		imatrix2[i].resize(n);
    		for (size_t j = 0; j < n; ++j)
    		{
    			if (i == 0)
    			{
    				switch (j){
    				case 0: imatrix2[i][j] = imatrix[i + 1][j + 1] * imatrix[i + 2][j + 2] - imatrix[i + 1][j + 2] * imatrix[i + 2][j + 1]; t = imatrix2[i][j];break;
    				case 1: imatrix2[i][j] = (imatrix[i + 1][j - 1] * imatrix[i + 2][j + 1] - imatrix[i + 2][j - 1] * imatrix[i + 1][j + 1]) * (-1); t = imatrix[i][j]; break;
    				case 2: imatrix2[i][j] = imatrix[i + 1][j - 2] * imatrix[i + 2][j - 1] - imatrix[i + 1][j - 1] * imatrix[i + 2][j - 2];t = imatrix2[i][j];break;
    				}
    			}
    			if (i == 1)
    			{
    				switch (j){
    				case 0: imatrix2[i][j] = (imatrix[i - 1][j + 1] * imatrix[i + 1][j + 2] - imatrix[i - 1][j + 2] * imatrix[i + 1][j + 1]) * (-1);t = imatrix2[i][j];break;
    				case 1:imatrix2[i][j] = imatrix[i - 1][j - 1] * imatrix[i + 1][j + 1] - imatrix[i - 1][j + 1] * imatrix[i + 1][j - 1];t = imatrix2[i][j];break;
    				case 2:imatrix2[i][j] = (imatrix[i - 1][j - 2] * imatrix[i + 1][j - 1] - imatrix[i - 1][j - 1] * imatrix[i + 1][j - 2]) * (-1);t = imatrix2[i][j];break;
    				}
    			}
    			if (i == 2)
    			{
    				switch (j){
    				case 0: imatrix2[i][j] = imatrix[i - 2][j + 1] * imatrix[i - 1][j + 2] - imatrix[i - 1][j + 1] * imatrix[i - 2][j + 2];t = imatrix2[i][j];break;
    				case 1:imatrix2[i][j] = (imatrix[i - 2][j - 1] * imatrix[i - 1][j + 1] - imatrix[i - 1][j - 1] * imatrix[i - 2][j + 1]) * (-1);t = imatrix2[i][j];break;
    				case 2: imatrix2[i][j] = imatrix[i - 2][j - 2] * imatrix[i - 1][j - 1] - imatrix[i - 2][j - 1] * imatrix[i - 1][j - 2];t = imatrix2[i][j];break;
    				}
    			}
    		}
    	}
    	imatrix.clear();
    	TransposedMatrix(imatrix2, determ);
    }
    
    void FindDeterminant(vector<vector<float> >imatrix)
    {
    	float determ = imatrix[0][0] * imatrix[1][1] * imatrix[2][2] + imatrix[2][0] * imatrix[0][1] * imatrix[1][2] + imatrix[1][0] * imatrix[2][1] * imatrix[0][2] - imatrix[2][0] * imatrix[1][1] * imatrix[0][2] - imatrix[0][0] * imatrix[2][1] * imatrix[1][2] - imatrix[1][0] * imatrix[0][1] * imatrix[2][2];
    	if (determ == 0)
    	{
    		cout << "Determinant = 0 ==> Reverse matrix doesn't exist";
    		system("pause");
    		exit(0);
    	}
    	MinorMatrix(imatrix, determ);
    }

    Вот таких студентов учить приходится. От оно как матрицы 3*3 инвертируют.
    Больше лучей ненависти тут:
    https://github.com/PLaGInc/Lab1/issues/3

    Vivid, 31 Марта 2015

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

    +58

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    unsigned long long int getSumUtil(unsigned long long int *st, unsigned long long int ss, unsigned long long int se, unsigned long long int qs, unsigned long long int qe, unsigned long long int index)
    
    //cout<<"here";
    
    //prunsigned long long intf("here");
    
    //printf("%llu\n%llu\n%c",i,j,type);

    По следам prunsigned intf из http://govnokod.ru/17791.
    http://www.codechef.com/viewplaintext/3039072
    Ctrl+H - наш ответ typedef!

    1024--, 16 Марта 2015

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

    +58

    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
    #include <fstream>
    #include <string.h>
    #include <stdlib.h>
    #include <iostream>
    typedef unsigned int uint;
    std::string sMsg;
    
    int GetShift()
    {
    	int iResult = 0;
    	for(uint i = 0; i < sMsg.size(); i++)
    	{
    		if(!isalpha(sMsg[i])) continue;
    		
    		if(isupper(sMsg[i]))
    		{
    			iResult = int(sMsg[i]) - int('A');
    			break;
    		}
    		else if(islower(sMsg[i]))
    		{
    			iResult = int(sMsg[i]) - int('a');
    			break;
    		}
    	}
    	return iResult;
    }
    
    int Pos(const char* _Str, char _Ch)
    {
    	int i = 0;
    	while(*_Str)
    	{
    		if(*_Str == _Ch)
    		{
    			return i;
    		}
    		_Str++;
    		i++;
    	}
    	return -1;
    }
    
    int main()
    {
    	std::ifstream fin("input.txt");
    	std::ofstream fout("output.txt");
    	
    	std::getline(fin, sMsg);
    	
    	int iShift = GetShift();
    	if(iShift == 0)
    	{
    		fout << sMsg;
    	}
    	else
    	{
    		char* szOriginal = (char*)malloc(100);
    		strcpy(szOriginal, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    		char* szShift = (char*)malloc(100);
    		strcpy(szShift, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
    		szShift += iShift;
    		
    		char* szOriginalL = (char*)malloc(100);
    		strcpy(szOriginalL, "abcdefghijklmnopqrstuvwxyz");
    		char* szShiftL = (char*)malloc(100);
    		strcpy(szShiftL, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
    		szShiftL += iShift;
    		
    		for(int i = 0; i < sMsg.size(); i++)
    		{
    			if(!isalpha(sMsg[i]))	
    				fout << sMsg[i];
    			else
    			{
    				if(isupper(sMsg[i]))
    				{
    					int iPos = Pos(szShift, sMsg[i]);
    					fout << *(szOriginal + iPos);
    				}
    				else if(islower(sMsg[i]))
    				{
    					
    					int iPos = Pos(szShiftL, sMsg[i]);
    					fout << *(szOriginalL + iPos);
    				}
    			}
    		}
    		
    		free(szOriginal);
    		free(szShift);
    		free(szOriginalL);
    		free(szShiftL);
    	}
    	
    	fin.close();
    	fout.close();
    	return 0;
    }

    В рамках подготовки к прошедшей областной олимпиаде по информатике среди школьников Минской области решал задачи. Данный говнокод решение задачи про шифр цезаря (данная задача была на областной олимпиаде в 2013 - 2014 учебном году).
    Задача: расшифровать строку, которая зашифрована шифром Цезаря, так, чтобы полученная расшифровка была минимальна лексикографически.
    Зашифрованная строка находится в файле input.txt, результат надо было вывести output.txt

    Janycz, 16 Января 2015

    Комментарии (81)
  6. C++ / Говнокод #17350

    +58

    1. 1
    int (o)(0);

    http://ideone.com/9JL6K4

    bormand, 22 Декабря 2014

    Комментарии (11)
  7. C++ / Говнокод #17305

    +58

    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
    if(is_ai_on && !white_move)
    			{
    				int tries;
    			start:
    					srand (time(NULL));
    				select_figure:
    					int figure = rand() % (game_field.figures.size() - 1) + 0;
    					if(game_field.figures[figure]->IsWhiteFigure()) goto select_figure;
    					int pos_x;
    					int pos_y;
    					tries = 0;
    				try_move:
    				try
    				{
    					switch(game_field.figures[figure]->GetType())
    					{
    						case PawnType:
    						{
    							pos_x = rand() % (game_field.figures[figure]->GetPositionX() + 2) + (game_field.figures[figure]->GetPositionX() - 2);
    							if(pos_x < 0) pos_x = 0;
    							if(pos_x >= game_field.size) pos_x = game_field.size - 1;
    							pos_y = game_field.figures[figure]->GetPositionY() + 1;
    							if(pos_x == game_field.figures[figure]->GetPositionX() &&
    							   pos_y == game_field.figures[figure]->GetPositionY())
    							   {
    									if(tries < 6)
    									{
    										tries++;
    										goto try_move;
    									}
    									else
    									{
    										goto select_figure;
    									}
    							   }
    						}break;
    						default:
    						{
    							pos_x = rand() % (game_field.figures[figure]->GetPositionX() + 5) + (game_field.figures[figure]->GetPositionX() - 5);
    							pos_y = rand() % (game_field.figures[figure]->GetPositionY() + 5) + (game_field.figures[figure]->GetPositionY() - 5);
    							if(pos_x < 0) pos_x = 0;
    							if(pos_x >= game_field.size) pos_x = game_field.size - 1;
    							if(pos_y < 0) pos_y = 0;
    							if(pos_y >= game_field.size) pos_y= game_field.size - 1;
    							if(pos_x == game_field.figures[figure]->GetPositionX() &&
    							   pos_y == game_field.figures[figure]->GetPositionY())
    							   {
    									if(tries < 6)
    									{
    										tries++;
    										goto try_move;
    									}
    									else
    									{
    										goto select_figure;
    									}
    							   }
    						}break;
    					}
    					game_field.DoMove(figure, pos_x, pos_y, this->white_move);
    				}
    				catch(...)
    				{
    					if(tries < 6)
    					{
    						tries++;
    						goto try_move;
    					}
    					else
    					{
    						goto select_figure;
    					}
    				}
    				this->white_move = true;
    			}

    Скайнет - версия 0.0000000000000000000000000000000001

    GreatMASTERcpp, 12 Декабря 2014

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

    +58

    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
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    struct t_point {
        int i,j;
    };
    #define stack_len 50000000
    long int head, tail;
    t_point *steck;
    
    // long int take_border( short int*arr, int h1, int w1, int deep ){
    long int take_border( short int*arr, int h1, int w1 ){
        long int k=0;
        //int i,j,m,n,ii,jj;
        int i,j,m,ii,n,jj;
        steck = (t_point*) malloc(tail*sizeof(t_point));
        if(! steck ){
            //ui->teDebug->setText("out of Memory");
            return 0;
        }
        {
           QFile file("buffer.dat");
           file.open(QIODevice::ReadOnly);
           unsigned int size = sizeof(t_point)* tail;
           QDataStream in(&file);   // we will serialize the data into the file
           in.readRawData((char*) steck, size );
        }
    // <...>
    }

    Это чувство когда сишник взялся писать на Qt.

    overloop, 02 Декабря 2014

    Комментарии (21)
  9. C++ / Говнокод #16832

    +58

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if(!vect.empty())
    {
       cv::sort(vect, vect, CV_SORT_ASCENDING );
    }
    
    while(vect.size()>100)
    {
       cv::sort(vect, vect, CV_SORT_DESCENDING );
       vect.pop_back();
       cv::sort(vect, vect, CV_SORT_ASCENDING );
       vect.pop_back();
    }

    hedrok, 09 Октября 2014

    Комментарии (8)
  10. C++ / Говнокод #16818

    +58

    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
    #include "internationalization.h"
    namespace internationalization
    {
     
    QString numToString(int num, CASE padezh)
    {
        switch ( padezh )
        {
        case NOMINATIVE:
            switch ( num )
            {
            case 0:     return "ноль";
            case 1:     return "один";
            case 2:     return "два";
            case 3:     return "три";
            case 4:     return "четыре";
            case 5:     return "пять";
            case 6:     return "шесть";
            case 7:     return "семь";
            case 8:     return "восемь";
            case 9:     return "девять";
            case 10:     return "десять";
            case 11:     return "одиннадцать";
            case 12:     return "двенадцать";
            case 13:     return "тринадцать";
            case 14:     return "четырнадцать";
            case 15:     return "пятнадцать";
            case 16:     return "шестнадцать";
            case 17:     return "семьнадцать";
            case 18:     return "восемьнадцать";
            case 19:     return "девятнадцать";
            case 20:     return "двадцать";
            case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29:    return numToString( num / 10 * 10 ) + " " + numToString( num % 10 );
            case 30:     return "традцать";
            case 31: case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39:    return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 40:    return "сорок";
            case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49:    return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 50:    return "пятьдесят";
            case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 60:    return "шестьдесят";
            case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 70:    return "семьдесят";
            case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 80:    return "восемьдесят";
            case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 90:    return "девяносто";
            case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99:      return numToString( num / 10 * 10 )  + " " +  numToString( num % 10 );
            case 100:   return "сто";
            case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109:   return numToString( (num / 100 % 10 ) * 100 )  + " " +  numToString( num % 10 );
            case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: case 120: case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: case 130: case 131: case 132: case 133: case 134: case 135: case 136: case 137: case 138: case 139: case 140: case 141: case 142: case 143: case 144: case 145: case 146: case 147: case 148: case 149: case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: case 170: case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: case 180: case 181: case 182: case 183: case 184: case 185: case 186: case 187: case 188: case 189: case 190: case 191: case 192: case 193: case 194: case 195: case 196: case 197: case 198: case 199:      return numToString( (num / 100 % 10 ) * 100 ) + " " +  numToString( (num / 10 % 10 ) * 10 )  + " " +  numToString( num % 10 );

    Такой код мне встретился в моем старом проекте... Мне кажется, или из меня вышел бы неплохой программист в Китае или Индии?
    И там не конец, весь файл сего перла здесь: http://pastebin.com/tpAd95fd

    Dart_Sergius, 07 Октября 2014

    Комментарии (33)
  11. C++ / Говнокод #16603

    +58

    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
    void Model::setPosition(GLfloat x, GLfloat y, GLfloat z) {
            if (m_position == NULL) {
                m_position = (float *) malloc(3 * sizeof(float));
            }
    
            if (m_position != NULL) {
                m_position[0] = x;
                m_position[1] = y;
                m_position[2] = z;
            }
        }
    
        void Model::setRotate(GLfloat x, GLfloat y, GLfloat z) {
            if (m_rotate == NULL) {
                m_rotate = (float *) malloc(3 * sizeof(float));
            }
    
            if (m_rotate != NULL) {
                m_rotate[0] = x;
                m_rotate[1] = y;
                m_rotate[2] = z;
            }
        }

    http://code.google.com/p/forget3d/
    Во первых, умиляет умение людей взяв современный супернавороченый удобный автомат, вместо того чтоб нажать на курок и выстрелить в противника, взять этот автомат наперевес как дубинку, и идти им пиздить противника по голове. Я о сишке, слегка прикрытой крестами.
    И во вторых, этот код при недостатке памяти просто нифига не делает, что чревато непонятками - вроде и повертел модель, вроде и подвинул, а оно никак не вертится и не двигается.

    Pythoner, 27 Августа 2014

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