Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

loadbi3.cpp File Reference

Importing maps from Battle Isle. More...

#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include "loadbi3.h"
#include "newfont.h"
#include "typen.h"
#include "buildingtype.h"
#include "vehicletype.h"
#include "misc.h"
#include "gameoptions.h"
#include "graphicset.h"
#include "spfst.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.

Functions

void checkbi3dir (void)
ASCString getbi3path (void)
 returns the path to the BI3 installation
Bi3MapTranslationTablefindTable (const ASCString &filename)
vector< ASCStringgetBI3ImportTables ()
 returns the names of the import tables that are available
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
void importbattleislemap (const ASCString &path, const ASCString &mapfilename, TerrainType::Weather *trrn, const ASCString &importTable, ASCString *errorOutput, bool fakemap)
 Imports a Battle Isle 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.

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   ) 
 

Definition at line 85 of file loadbi3.cpp.

References appendbackslash(), battleisleversion, exist(), CGameOptions::Instance(), libs_to_load, TLIBFiles::Name, pathdelimitterstring, and readgameoptions().

Bi3MapTranslationTable* findTable const ASCString filename  ) 
 

Definition at line 358 of file loadbi3.cpp.

Referenced by importbattleislemap(), and insertbattleislemap().

void generatemap TerrainType::Weather bt,
int  xsize,
int  ysize
 

Definition at line 695 of file loadbi3.cpp.

References GameMap::_resourcemode, actmap, GameMap::allocateFields(), Player::computer, displaymessage(), GameMap::field, GameMap::maptitle, GameMap::player, tfield::setMap(), tfield::setparams(), Player::stat, and tfield::typ.

Referenced by ImportBiMap::preparemap().

vector<ASCString> getBI3ImportTables  ) 
 

returns the names of the import tables that are available

Definition at line 365 of file loadbi3.cpp.

Referenced by ImportBI3MapDialog::ImportBI3MapDialog().

ASCString getbi3path void   ) 
 

returns the path to the BI3 installation

Definition at line 128 of file loadbi3.cpp.

References 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:
path the path to the BI3 installation
mapfilename The name of the map
trrn The terrain that is used for all fields which are unknown to ASC
errorOutput Pointer to a string which will store all warning and error messages from the import. May be NULL.
__fakeMap If 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 1647 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:
x The x coordinate of field where the upper left field of the BI map will be placed.
y The y coordinate of field where the upper left field of the BI map will be placed.
path the path to the BI3 installation
filename The name of the map

Definition at line 1669 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 1640 of file loadbi3.cpp.

Referenced by main().

void stu_height Vehicle vehicle  ) 
 

Definition at line 760 of file loadbi3.cpp.

References TerrainAccess::accessible(), tfield::bdt, chfahrend, chsatellit, chschwimmend, chtiefgetaucht, getfield(), Vehicletype::height, Vehicle::height, log2(), Vehicletype::movement, Vehicle::setMovement(), Vehicletype::terrainaccess, Vehicle::typ, Vehicle::xpos, and Vehicle::ypos.


Variable Documentation

const char* ACTNID = "ACTN"
 

Definition at line 410 of file loadbi3.cpp.

int battleisleversion = -1
 

Definition at line 55 of file loadbi3.cpp.

Referenced by checkbi3dir().

PointerVector<Bi3MapTranslationTable*> bi3ImportTables
 

Definition at line 356 of file loadbi3.cpp.

const int bi3unitnum = 74
 

Definition at line 644 of file loadbi3.cpp.

ASCString defaultImportTranslationTable
 

Definition at line 1638 of file loadbi3.cpp.

const int energyfactor = 390
 

Definition at line 404 of file loadbi3.cpp.

const int fuelfactor = 120
 

Definition at line 402 of file loadbi3.cpp.

const char* HeadID = "MSSN"
 

Definition at line 409 of file loadbi3.cpp.

Referenced by tloadBImap::LoadFromFile().

TLIBFiles LIBFiles[LIBFilesAnz]
 

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 412 of file loadbi3.cpp.

const int materialfactor = 390
 

Definition at line 403 of file loadbi3.cpp.

const char* MISSID = "MISS"
 

Definition at line 413 of file loadbi3.cpp.

const char* SHOPID = "SHOP"
 

Definition at line 411 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 645 of file loadbi3.cpp.


Generated on Tue Jun 24 01:48:25 2008 for Advanced Strategic Command by  doxygen 1.4.2