Checks for terminal size, exits if it's not >=80>24.
authorlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Fri, 8 Dec 2006 14:14:56 +0000 (14:14 +0000)
committerlimb <limb@bc5cbbab-a4ec-0310-bb52-ff3d296db539>
Fri, 8 Dec 2006 14:14:56 +0000 (14:14 +0000)
git-svn-id: svn+ssh://svn/var/repos/curfender@582 bc5cbbab-a4ec-0310-bb52-ff3d296db539

main.cpp

index 76a70dd..cfa4737 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -504,8 +504,6 @@ game_object pod_chase(game_object lander, game_object pod){
 }
 
 int main(){
-  
-  //Check screen size 80x25 and exit if not big enough
 
   //Initialize world
  
@@ -534,8 +532,6 @@ int main(){
   strcpy (player.line1, "<_==>");
   strcpy (player.radar, "=");
 
-  
-
   //gate
   game_object gate;
   gate.number = 10;
@@ -698,6 +694,17 @@ int main(){
 
   initscr();
 
+  //Check screen size 80x24 and exit if not big enough
+  int maxx, maxy;
+
+  getmaxyx(stdscr, maxx, maxy);
+
+  if(maxx<24||maxy<80){
+    endwin();
+    printf("Screen only %d x %d, needs to be at least 80x24\n", maxy, maxx);
+    exit(1);
+  };
+
   //main loop
 
   int loopvar = 0;