Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/peterix/DF2MC
Browse files Browse the repository at this point in the history
  • Loading branch information
RosaryMala committed Nov 3, 2011
2 parents 54501bf + 0f6389f commit ea35678
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include_directories (
${dfhack_SOURCE_DIR}/library/depends/tinyxml/
${CMAKE_SOURCE_DIR}
)
add_subdirectory (cNBT)

SET(PROJECT_SRCS
${dfhack_SOURCE_DIR}/library/depends/tinyxml/tinystr.cpp
Expand All @@ -14,5 +13,5 @@ SET(PROJECT_SRCS
${dfhack_SOURCE_DIR}/library/depends/tinyxml/tinyxmlparser.cpp
source/df2minecraft.cpp
)
DFHACK_PLUGIN(df2minecraft ${PROJECT_SRCS} LINK_LIBRARIES nbt z)
DFHACK_PLUGIN(df2minecraft ${PROJECT_SRCS} LINK_LIBRARIES z)
INSTALL(FILES df2mc.xml DESTINATION ${DFHACK_DATA_DESTINATION})
24 changes: 12 additions & 12 deletions source/df2minecraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,14 @@ int compressFile ( char* src, char* dest )
FILE *s = fopen ( "out.mcraw","rb" );
if ( s==NULL )
{
DFConsole->print ( "Could not open file for reading, exiting." );
DFConsole->printerr ( "Could not open file for reading, exiting." );
return -50;
}

FILE *f = fopen ( dest,"wb" );
if ( f==NULL )
{
DFConsole->print ( "Could not open file for writing, exiting." );
DFConsole->printerr ( "Could not open file for writing, exiting." );
return -51;
}

Expand All @@ -638,7 +638,7 @@ int compressFile ( char* src, char* dest )
ret = deflateInit2 ( &strm, Z_BEST_COMPRESSION,Z_DEFLATED,31,9,Z_DEFAULT_STRATEGY );//the 31 indicates gzip, set to 15 for normal zlib file header
if ( ret != Z_OK )
{
DFConsole->print ( "Unable to initalize compression routine, exiting." );
DFConsole->printerr ( "Unable to initalize compression routine, exiting." );
return ret;
}

Expand Down Expand Up @@ -901,7 +901,7 @@ int saveChunk ( char* dirname,uint8_t* mclayers,uint8_t* mcdata,uint8_t* mcskyli
int res = compressFile ( "out.mcraw",path );
if ( res != Z_OK )
{
DFConsole->print ( "\nError compressing file (%d)\n",res );
DFConsole->printerr ( "\nError compressing file (%d)\n",res );
}
else
{
Expand All @@ -914,7 +914,7 @@ int saveChunk ( char* dirname,uint8_t* mclayers,uint8_t* mcdata,uint8_t* mcskyli
}
else
{
DFConsole->print ( " Error getting file size " );
DFConsole->printerr ( " Error getting file size " );
}
}

Expand Down Expand Up @@ -1138,7 +1138,7 @@ int saveMCLevelAlpha ( uint8_t* mclayers,uint8_t* mcdata,uint8_t* mcskylight,uin
int res = compressFile ( "out.mcraw",filename );
if ( res != Z_OK )
{
DFConsole->print ( "\nError compressing file (%d)\n",res );
DFConsole->printerr ( "\nError compressing file (%d)\n",res );
}
else
{
Expand Down Expand Up @@ -2378,7 +2378,7 @@ void convertDFBlock ( DFHack::Maps *Maps, DFHack::Materials * Mats, vector< vect
}
else
{
DFConsole->print ( "Cant find building that should already be defined!\n" );
DFConsole->printerr ( "Cant find building that should already be defined!\n" );
}
}

Expand Down Expand Up @@ -2477,7 +2477,7 @@ int convertMaps ( DFHack::Core *DF,DFHack::Materials * Mats )
TiXmlElement *uio = NULL;
if ( createUnknown )
{
TiXmlDocument *doc = new TiXmlDocument ( "unimplementedobjects.xml" );
TiXmlDocument *doc = new TiXmlDocument ( "hack/unimplementedobjects.xml" );
bool loadOkay = doc->LoadFile();
uio=doc->FirstChildElement ( "unimplemented_objects" );
if ( uio==NULL )
Expand Down Expand Up @@ -2512,7 +2512,7 @@ int convertMaps ( DFHack::Core *DF,DFHack::Materials * Mats )

if ( xoffset>x_max || yoffset>y_max )
{
DFConsole->print ( "Invalid level size.\n" );
DFConsole->printerr ( "Invalid level size.\n" );
return 21;
}

Expand Down Expand Up @@ -2682,7 +2682,7 @@ int convertMaps ( DFHack::Core *DF,DFHack::Materials * Mats )

if ( mcxsquares<0 || mcysquares<0 || mczsquares<0 )
{
DFConsole->print ( "Area too small\n" );
DFConsole->printerr ( "Area too small\n" );
return 20;
}

Expand Down Expand Up @@ -2876,7 +2876,7 @@ int convertMaps ( DFHack::Core *DF,DFHack::Materials * Mats )
uint8_t* mcblocklight = new uint8_t[mcxsquares*mcysquares*mczsquares];
if ( mclayers==NULL || mcdata == NULL || mcskylight == NULL || mcblocklight == NULL )
{
DFConsole->print ( "Unable to allocate memory to store level data, exiting." );
DFConsole->printerr ( "Unable to allocate memory to store level data, exiting." );
return 10;
}
memset ( mclayers,0,sizeof ( uint8_t ) * ( mcxsquares*mcysquares*mczsquares ) );
Expand Down Expand Up @@ -3370,7 +3370,7 @@ DFhackCExport command_result mc_export (Core * c, vector <string> & parameters)
//convert the map
int result = convertMaps ( c,Mats );

doc.SaveFile ( "updated.xml" );
doc.SaveFile ( "hack/updated.xml" );

if (result)
return CR_FAILURE;
Expand Down

0 comments on commit ea35678

Please sign in to comment.