summaryrefslogtreecommitdiff
path: root/MapLoading.cpp
diff options
context:
space:
mode:
authorJapa2011-07-20 17:14:14 +0000
committerJapa2011-07-20 17:14:14 +0000
commitd73d5fe58beefb57c8301f934ea01e868a9c10d3 (patch)
treedd860adc1b0a39cb10c3b3e82adff03a5287d44b /MapLoading.cpp
parentaee9dc6758120d57a8fabc013a16c82f6682099c (diff)
downloadstonesense-d73d5fe58beefb57c8301f934ea01e868a9c10d3.tar.gz
stonesense-d73d5fe58beefb57c8301f934ea01e868a9c10d3.tar.bz2
stonesense-d73d5fe58beefb57c8301f934ea01e868a9c10d3.tar.xz
Sucessfully connected to DF. some bugs remain, but who cares. we got a DF connection.
Diffstat (limited to 'MapLoading.cpp')
-rw-r--r--MapLoading.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/MapLoading.cpp b/MapLoading.cpp
index 692ea97..24695c4 100644
--- a/MapLoading.cpp
+++ b/MapLoading.cpp
@@ -215,7 +215,8 @@ void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int C
{
if(config.skipMaps)
return;
-
+ if(!Maps->Start())
+ return;
//boundry check
int cellDimX, cellDimY, cellDimZ;
Maps->getSize((unsigned int &)cellDimX, (unsigned int &)cellDimY, (unsigned int &)cellDimZ);
@@ -1208,7 +1209,7 @@ void read_segment( void *arg)
altSegment->Dispose();
delete(altSegment);
}
- pDFApiHandle->Suspend();
+ //pDFApiHandle->Suspend();
if (firstLoad || config.follow_DFscreen)
{
firstLoad = 0;
@@ -1224,7 +1225,7 @@ void read_segment( void *arg)
altSegment = ReadMapSegment(*pDFApiHandle, parms.x, parms.y, parms.z,
parms.sizex, parms.sizey, parms.sizez);
config.threadstarted = 0;
- pDFApiHandle->Resume();
+ //pDFApiHandle->Resume();
beautify_Segment(altSegment);
if(viewedSegment)
al_lock_mutex(viewedSegment->mutie);
@@ -1244,20 +1245,11 @@ static void * threadedSegment(ALLEGRO_THREAD *thread, void *arg)
return 0;
}
-void reloadDisplayedSegment(){
+void reloadDisplayedSegment(DFHack::Core * c){
//create handle to dfHack API
- bool firstLoad = (pDFApiHandle == 0);
- if(pDFApiHandle == 0)
- {
- al_clear_to_color(al_map_rgb(0,0,0));
- draw_textf_border(font, al_map_rgb(255,255,255),
- al_get_bitmap_width(al_get_target_bitmap())/2,
- al_get_bitmap_height(al_get_target_bitmap())/2,
- ALLEGRO_ALIGN_CENTRE, "Connecting to DF...");
- al_flip_display();
- memInfoHasBeenRead = false;
- }
- DFHack::Core& DF = *pDFApiHandle;
+ static bool firstLoad = 1;
+ DFHack::Core & DF = *c;
+ pDFApiHandle = c;
TMR1_START;
#ifndef RELEASE
@@ -1267,7 +1259,7 @@ void reloadDisplayedSegment(){
if (timeToReloadConfig)
{
parms.thread_connect = 0;
- DF.Suspend();
+ //DF.Suspend();
contentLoader.Load(DF);
timeToReloadConfig = false;
//DF.Resume();