Advanced Strategic Command
Classes | Functions | Variables
loadbi3.cpp File Reference

Importing maps from Battle Isle. More...

#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include "loadbi3.h"
#include "typen.h"
#include "buildingtype.h"
#include "vehicletype.h"
#include "misc.h"
#include "gameoptions.h"
#include "graphicset.h"
#include "spfst.h"
#include "spfst-legacy.h"
#include "loaders.h"
#include "dialog.h"
#include "itemrepository.h"
#include "textfile_evaluation.h"
Include dependency graph for loadbi3.cpp:

Go to the source code of this file.

Classes

class  timporterror
 
struct  TLIBFiles
 
class  Bi3MapTranslationTable
 a table to translate a Battle Isle map into an ASC map More...
 
struct  Bi3MapTranslationTable::Terrain2id
 
struct  Bi3MapTranslationTable::Terraincombixlat
 
struct  Bi3MapTranslationTable::Objecttranslataion
 
class  tloadBImap
 
class  ImportBiMap
 
class  InsertBiMap
 
struct  blds
 

Functions

void checkbi3dir (void)
 
ASCString getbi3path (void)
 returns the path to the BI3 installation More...
 
Bi3MapTranslationTablefindTable (const ASCString &filename)
 
vector< ASCStringgetBI3ImportTables ()
 returns the names of the import tables that are available More...
 
void generatemap (TerrainType::Weather *bt, int xsize, int ysize)
 
void stu_height (Vehicle *vehicle)
 
void setDefaultBI3ImportTranslationTable (const ASCString &filename)
 to prevent the appearnce of the dialog "choose import translation table" when running in batch mode, a default translation table can be specified More...
 
void importbattleislemap (const ASCString &path, const ASCString &mapfilename, TerrainType::Weather *trrn, const ASCString &importTable, ASCString *errorOutput, bool fakemap)
 Imports a Battle Isle map. More...
 
void insertbattleislemap (int x, int y, const ASCString &path, const ASCString &mapfilename, const ASCString &importTable)
 Imports a Battle Isle map and inserts it into the current ASC map. More...
 

Variables

int battleisleversion = -1
 
const int LIBFilesAnz = 11
 
TLIBFiles LIBFiles [LIBFilesAnz]
 
int libs_to_load = 9
 
PointerVector
< Bi3MapTranslationTable * > 
bi3ImportTables
 
const int fuelfactor = 120
 
const int materialfactor = 390
 
const int energyfactor = 390
 
const char * HeadID = "MSSN"
 
const char * ACTNID = "ACTN"
 
const char * SHOPID = "SHOP"
 
const char * MAPID = "MAP\0"
 
const char * MISSID = "MISS"
 
const int bi3unitnum = 74
 
int translateunits [bi3unitnum][2]
 
ASCString defaultImportTranslationTable
 

Detailed Description

Importing maps from Battle Isle.

Definition in file loadbi3.cpp.

Function Documentation

void checkbi3dir ( void  )
Bi3MapTranslationTable* findTable ( const ASCString filename)

Definition at line 359 of file loadbi3.cpp.

Referenced by importbattleislemap(), and insertbattleislemap().

void generatemap ( TerrainType::Weather bt,
int  xsize,
int  ysize 
)
vector<ASCString> getBI3ImportTables ( )

returns the names of the import tables that are available

Definition at line 366 of file loadbi3.cpp.

Referenced by ImportBI3MapDialog::ImportBI3MapDialog().

ASCString getbi3path ( void  )

returns the path to the BI3 installation

Definition at line 129 of file loadbi3.cpp.

References CGameOptions::BI3directory, and CGameOptions::Instance().

Referenced by getbipath().

void importbattleislemap ( const ASCString path,
const ASCString mapfilename,
TerrainType::Weather trrn,
const ASCString importTable,
ASCString errorOutput = NULL,
bool  __fakeMap = false 
)

Imports a Battle Isle map.

Parameters
paththe path to the BI3 installation
mapfilenameThe name of the map
trrnThe terrain that is used for all fields which are unknown to ASC
errorOutputPointer to a string which will store all warning and error messages from the import. May be NULL.
__fakeMapIf true ASC tries to make the map look like the Battle Isle map, generating new ObjectType and TerrainType instances if necessary. This must not be used by any program other than map2pcx, since the maps can not be played. This is only used to generate the images of the Battle Isle Map Archive.

Definition at line 1666 of file loadbi3.cpp.

References tloadBImap::____fakeMap____(), GameMap::_resourcemode, actmap, GameMap::cleartemps(), findTable(), and tloadBImap::LoadFromFile().

Referenced by process_BI_map().

void insertbattleislemap ( int  x,
int  y,
const ASCString path,
const ASCString mapfilename,
const ASCString importTable 
)

Imports a Battle Isle map and inserts it into the current ASC map.

Parameters
xThe x coordinate of field where the upper left field of the BI map will be placed.
yThe y coordinate of field where the upper left field of the BI map will be placed.
paththe path to the BI3 installation
filenameThe name of the map

Definition at line 1688 of file loadbi3.cpp.

References GameMap::_resourcemode, actmap, GameMap::cleartemps(), findTable(), and tloadBImap::LoadFromFile().

void setDefaultBI3ImportTranslationTable ( const ASCString filename)

to prevent the appearnce of the dialog "choose import translation table" when running in batch mode, a default translation table can be specified

Definition at line 1659 of file loadbi3.cpp.

Referenced by main().

void stu_height ( Vehicle vehicle)

Variable Documentation

const char* ACTNID = "ACTN"

Definition at line 411 of file loadbi3.cpp.

int battleisleversion = -1

Definition at line 55 of file loadbi3.cpp.

Referenced by checkbi3dir().

Definition at line 357 of file loadbi3.cpp.

const int bi3unitnum = 74

Definition at line 645 of file loadbi3.cpp.

ASCString defaultImportTranslationTable

Definition at line 1657 of file loadbi3.cpp.

const int energyfactor = 390

Definition at line 405 of file loadbi3.cpp.

const int fuelfactor = 120

Definition at line 403 of file loadbi3.cpp.

const char* HeadID = "MSSN"

Definition at line 410 of file loadbi3.cpp.

Referenced by tloadBImap::LoadFromFile().

Initial value:
=
{{"part000.lib", 0xC, 0x240, 0, 0x240, 1335},
{"unit000.lib", 0x4, 0x240, 0, 0x240, 128},
{"layr000.lib", 0x4, 0x240, 0, 0x240, 24},
{"layr001.lib", 0x4, 0x240, 0, 0x240, 24},
{"layr002.lib", 0x4, 0x240, 0, 0x240, 24},
{"layr003.lib", 0x4, 0x240, 0, 0x240, 24},
{"layr004.lib", 0x4, 0x240, 0, 0x240, 24},
{"layr005.lib", 0x4, 0x240, 0, 0x240, 24},
{"layr006.lib", 0x4, 0x240, 0, 0x240, 24},
{"curs000.lib", 0xC, 0x25E,0x1A, 0x240, 12},
{"palt000.lib", 0xC, 0x300, 0, 0x300, 4 } ,
}

Definition at line 67 of file loadbi3.cpp.

const int LIBFilesAnz = 11

Definition at line 57 of file loadbi3.cpp.

int libs_to_load = 9

Definition at line 82 of file loadbi3.cpp.

Referenced by checkbi3dir().

const char* MAPID = "MAP\0"

Definition at line 413 of file loadbi3.cpp.

const int materialfactor = 390

Definition at line 404 of file loadbi3.cpp.

const char* MISSID = "MISS"

Definition at line 414 of file loadbi3.cpp.

const char* SHOPID = "SHOP"

Definition at line 412 of file loadbi3.cpp.

int translateunits[bi3unitnum][2]
Initial value:
= { {1201,26}, {1270,26}, {1202,13}, {1200,6}, {1203,-1},
{1204,16}, {1205,17}, {1206,4}, {1207,65}, {1208,-1},
{1209,7}, {1210,66}, {1211,2}, {1212,3}, {1213,17},
{1214,51}, {1215,17}, {1216,2}, {1217,10}, {1218,11},
{1219,16}, {1220,61}, {1221,49},{1222,56}, {1276,-1},
{1223,25}, {1224,72}, {1225,57},{1226,58}, {1227,7},
{1228,59}, {1241,9}, {1242,22},{1244,19}, {1243,29},
{1245,55}, {1246,19}, {1271,21},{1247,52}, {1248,31},
{1251,15}, {1252,15}, {1256,39},{1257,42}, {1258,47},
{1259,14}, {1260,36}, {1261,34},{1262,47}, {1263,37},
{1264,38}, {1265,5}, {1229,18},{1277,-1}, {1249,-1},
{1230,1}, {1231,66}, {1266, 5},{1232,64}, {1233,-1},
{1234,4}, {1235,4}, {1267,35},{1250,29}}

Definition at line 646 of file loadbi3.cpp.