-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
-*/\r
-\r
-#include "qfiles.h"\r
-#include "scriplib.h"\r
-//#include <windows.h>\r
-\r
-materialtype_t defaultmaterialtypes[] =\r
-{\r
- {"gravel", MATERIAL_GRAVEL},\r
- {"metal", MATERIAL_METAL},\r
- {"stone", MATERIAL_STONE},\r
- {"wood", MATERIAL_WOOD},\r
- {NULL, 0}\r
-};\r
-\r
-materialtype_t *materialtypes;\r
-\r
-void QFile_ReadMaterialTypes(char* filename)\r
-{\r
- int i;\r
- FILE *f;\r
-\r
- f = fopen (filename, "rb");\r
- if (!f)\r
- {\r
- materialtypes = defaultmaterialtypes;\r
- return;\r
- }\r
- fclose (f);\r
-\r
- free(materialtypes);\r
- materialtypes = (materialtype_t*)malloc(256 * sizeof(materialtype_t));\r
-\r
- LoadScriptFile(filename);\r
- i = 0;\r
- \r
- while (i < 255)\r
- {\r
- GetScriptToken (true);\r
- if (endofscript)\r
- {\r
- break;\r
- }\r
- if (strcmp(token, "material") != 0)\r
- {\r
- while (ScriptTokenAvailable())\r
- {\r
- GetScriptToken(false);\r
- }\r
- }\r
- else\r
- {\r
- GetScriptToken(false);\r
- materialtypes[i].name = (char*)malloc(strlen(token) + 1);\r
- strcpy(materialtypes[i].name, token);\r
- GetScriptToken (false);\r
- materialtypes[i].value = atoi(token);\r
- }\r
- i++;\r
- }\r
- materialtypes[i].name = NULL;\r
- materialtypes[i].value = 0;\r
-}\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "qfiles.h"
+#include "scriplib.h"
+//#include <windows.h>
+
+materialtype_t defaultmaterialtypes[] =
+{
+ {"gravel", MATERIAL_GRAVEL},
+ {"metal", MATERIAL_METAL},
+ {"stone", MATERIAL_STONE},
+ {"wood", MATERIAL_WOOD},
+ {NULL, 0}
+};
+
+materialtype_t *materialtypes;
+
+void QFile_ReadMaterialTypes(char* filename)
+{
+ int i;
+ FILE *f;
+
+ f = fopen (filename, "rb");
+ if (!f)
+ {
+ materialtypes = defaultmaterialtypes;
+ return;
+ }
+ fclose (f);
+
+ free(materialtypes);
+ materialtypes = (materialtype_t*)malloc(256 * sizeof(materialtype_t));
+
+ LoadScriptFile(filename);
+ i = 0;
+
+ while (i < 255)
+ {
+ GetScriptToken (true);
+ if (endofscript)
+ {
+ break;
+ }
+ if (strcmp(token, "material") != 0)
+ {
+ while (ScriptTokenAvailable())
+ {
+ GetScriptToken(false);
+ }
+ }
+ else
+ {
+ GetScriptToken(false);
+ materialtypes[i].name = (char*)malloc(strlen(token) + 1);
+ strcpy(materialtypes[i].name, token);
+ GetScriptToken (false);
+ materialtypes[i].value = atoi(token);
+ }
+ i++;
+ }
+ materialtypes[i].name = NULL;
+ materialtypes[i].value = 0;
+}