<commit_before>/* ************************
   Copyright Terrain Experts Inc.
   Terrain Experts Inc (TERREX) reserves all rights to this source code
   unless otherwise specified in writing by the President of TERREX.
   This copyright may be updated in the future, in which case that version
   supercedes this one.
   -------------------
   Terrex Experts Inc.
   4400 East Broadway #314
   Tucson, AZ  85711
   <EMAIL>
   Tel: (520) 323-7990
   ************************
   */

#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/* trpage_warchive.cpp
   This source file contains the implementations of trpgwArchive and trpgwGeomHelper.
   The Write Archive is used to write TerraPage archives.  All its important methods
   are virtual, so you shouldn't need to modify any of this code.  Simply subclass
   and override.
   The Geometry Helper is a class that's used to sort out polygons and build
   trpgGeometry objects, containing triangle strips and fans out of them.  The one
   contained here is fairly simple, but all its important methods are virtual.  So
   again, subclass and override if you need to change them.
*/

#include <trpage_geom.h>
#include <trpage_write.h>
#include <trpage_compat.h>
#include <trpage_read.h>

// Constructor
trpgwArchive::trpgwArchive(trpgEndian inNess,trpgwArchive::TileMode inTileMode,int majorVer, int minorVer)
{
    Init(inNess,inTileMode,majorVer, minorVer);
}

void trpgwArchive::Init(trpgEndian inNess, trpgwArchive::TileMode inTileMode,int majorVer, int minorVer)
{
    minorVersion = minorVer;
    majorVersion = majorVer;
    if (majorVersion < 1  || majorVersion >  TRPG_VERSION_MAJOR)
        throw 1;
    if(majorVersion == TRPG_VERSION_MAJOR)
    {
        if(minorVersion < 0 || minorVersion > TRPG_VERSION_MINOR)
            throw 1;
    }

    fp = NULL;
    strcpy(dir,".");
    ness = inNess;
    tileMode = inTileMode;
    cpuNess = trpg_cpu_byte_order();
    tileFile = NULL;
    tileFileCount = 0;
    isRegenerate = false;
    maxTileFileLen = -1;

    firstHeaderWrite = true;<commit_msg>Added initializer<commit_after>/* ************************
   Copyright Terrain Experts Inc.
   Terrain Experts Inc (TERREX) reserves all rights to this source code
   unless otherwise specified in writing by the President of TERREX.
   This copyright may be updated in the future, in which case that version
   supercedes this one.
   -------------------
   Terrex Experts Inc.
   4400 East Broadway #314
   Tucson, AZ  85711
   <EMAIL>
   Tel: (520) 323-7990
   ************************
   */

#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/* trpage_warchive.cpp
   This source file contains the implementations of trpgwArchive and trpgwGeomHelper.
   The Write Archive is used to write TerraPage archives.  All its important methods
   are virtual, so you shouldn't need to modify any of this code.  Simply subclass
   and override.
   The Geometry Helper is a class that's used to sort out polygons and build
   trpgGeometry objects, containing triangle strips and fans out of them.  The one
   contained here is fairly simple, but all its important methods are virtual.  So
   again, subclass and override if you need to change them.
*/

#include <trpage_geom.h>
#include <trpage_write.h>
#include <trpage_compat.h>
#include <trpage_read.h>

// Constructor
trpgwArchive::trpgwArchive(trpgEndian inNess,trpgwArchive::TileMode inTileMode,int majorVer, int minorVer)
{
    Init(inNess,inTileMode,majorVer, minorVer);
}

void trpgwArchive::Init(trpgEndian inNess, trpgwArchive::TileMode inTileMode,int majorVer, int minorVer)
{
    minorVersion = minorVer;
    majorVersion = majorVer;
    if (majorVersion < 1  || majorVersion >  TRPG_VERSION_MAJOR)
        throw 1;
    if(majorVersion == TRPG_VERSION_MAJOR)
    {
        if(minorVersion < 0 || minorVersion > TRPG_VERSION_MINOR)
            throw 1;
    }

    fp = NULL;
    strcpy(dir,".");
    ness = inNess;
    tileMode = inTileMode;
    cpuNess = trpg_cpu_byte_order();
    tileFile = NULL;
    tileFileCount = 0;
    isRegenerate = false;
    maxTileFileLen = -1;
    numLod = 0;

    firstHeaderWrite = true;
{'fraction_non_alphanumeric': 0.10543580131208997, 'fraction_numerical': 0.013355201499531396, 'mean_word_length': 3.4984193888303476, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3418040', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1317, 'n_words': 438}