コード例 #1
0
        }         //end of the function AAS_DumpAASData

        //===========================================================================
        // allocate memory and read a lump of a AAS file
        //
        // Parameter:				-
        // Returns:					-
        // Changes Globals:		-
        //===========================================================================
        char *AAS_LoadAASLump(fileHandle_t fp, int offset, int length, int *lastoffset, int size)
        {
            char *buf;

            //
            if (!length)
            {
                //just alloc a dummy
                return((char *)GetClearedHunkMemory(size + 1));
            }             //end if
            //seek to the data
            if (offset != *lastoffset)
            {
                botimport.Print(PRT_WARNING, "AAS file not sequentially read\n");
                if (botimport.FS_Seek(fp, offset, FS_SEEK_SET))
                {
                    AAS_Error("can't seek to aas lump\n");
                    AAS_DumpAASData();
                    botimport.FS_FCloseFile(fp);
                    return(0);
                }         //end if
            }             //end if
            //allocate memory
            buf = (char *)GetClearedHunkMemory(length + 1);
            //read the data
            if (length)
            {
                botimport.FS_Read(buf, length, fp);
                *lastoffset += length;
            }     //end if
            return(buf);
        }         //end of the function AAS_LoadAASLump
コード例 #2
0
        /*
         * ====================
         * LAN_SaveServersToCache
         * ====================
         */
        void LAN_SaveServersToCache( )
        {
            int          size;
            fileHandle_t fileOut = FS_SV_FOpenFileWrite("servercache.dat");

            FS_Write(&cls.numglobalservers, sizeof(int), fileOut);
            FS_Write(&cls.nummplayerservers, sizeof(int), fileOut);
            FS_Write(&cls.numfavoriteservers, sizeof(int), fileOut);
            size = sizeof(cls.globalServers) + sizeof(cls.favoriteServers) + sizeof(cls.mplayerServers);
            FS_Write(&size, sizeof(int), fileOut);
            FS_Write(&cls.globalServers, sizeof(cls.globalServers), fileOut);
            FS_Write(&cls.mplayerServers, sizeof(cls.mplayerServers), fileOut);
            FS_Write(&cls.favoriteServers, sizeof(cls.favoriteServers), fileOut);
            FS_FCloseFile(fileOut);
        }