some code restructure to make position not exit instantly on fail

develop
mizipzor 2010-02-21 01:12:12 +01:00
parent cfddcf38eb
commit 9799a78afe
1 changed files with 28 additions and 28 deletions

@ -16,37 +16,37 @@ int main (void)
if(!DF.Attach()) if(!DF.Attach())
{ {
cerr << "DF not found" << endl; cerr << "DF not found" << endl;
return 1;
}
if (DF.InitViewAndCursor())
{
int32_t x,y,z;
if(DF.getViewCoords(x,y,z))
cout << "view coords: " << x << "/" << y << "/" << z << endl;
if(DF.getCursorCoords(x,y,z))
cout << "cursor coords: " << x << "/" << y << "/" << z << endl;
}
else
{
cerr << "cursor and window parameters are unsupported on your version of DF" << endl;
}
if(DF.InitViewSize())
{
int32_t width,height;
if(DF.getWindowSize(width,height))
cout << "window size : " << width << " " << height << endl;
} }
else else
{ {
cerr << "view size is unsupported on your version of DF" << endl; if (DF.InitViewAndCursor())
} {
int32_t x,y,z;
if(!DF.Detach()) if(DF.getViewCoords(x,y,z))
{ cout << "view coords: " << x << "/" << y << "/" << z << endl;
cerr << "Can't detach from DF" << endl; if(DF.getCursorCoords(x,y,z))
return 1; cout << "cursor coords: " << x << "/" << y << "/" << z << endl;
}
else
{
cerr << "cursor and window parameters are unsupported on your version of DF" << endl;
}
if(DF.InitViewSize())
{
int32_t width,height;
if(DF.getWindowSize(width,height))
cout << "window size : " << width << " " << height << endl;
}
else
{
cerr << "view size is unsupported on your version of DF" << endl;
}
if(!DF.Detach())
{
cerr << "Can't detach from DF" << endl;
}
} }
#ifndef LINUX_BUILD #ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl; cout << "Done. Press any key to continue" << endl;