50c0327dbc423226ed631c436e3b95c481fda3bb
[supertux.git] / src / worldmap.cpp
1 //  $Id$
2 //
3 //  SuperTux -  A Jump'n Run
4 //  Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 #include <iostream>
21 #include <fstream>
22 #include <vector>
23 #include <assert.h>
24 #include "globals.h"
25 #include "texture.h"
26 #include "screen.h"
27 #include "lispreader.h"
28 #include "gameloop.h"
29 #include "setup.h"
30 #include "worldmap.h"
31 #include "resources.h"
32
33 namespace WorldMapNS {
34
35 Direction reverse_dir(Direction direction)
36 {
37   switch(direction)
38     {
39     case WEST:
40       return EAST;
41     case EAST:
42       return WEST;
43     case NORTH:
44       return SOUTH;
45     case SOUTH:
46       return NORTH;
47     case NONE:
48       return NONE;
49     }
50   return NONE;
51 }
52
53 std::string
54 direction_to_string(Direction direction)
55 {
56   switch(direction)
57     {
58     case WEST:
59       return "west";
60     case EAST:
61       return "east";
62     case NORTH:
63       return "north";
64     case SOUTH:
65       return "south";
66     default:
67       return "none";
68     }
69 }
70
71 Direction
72 string_to_direction(const std::string& directory)
73 {
74   if (directory == "west")
75     return WEST;
76   else if (directory == "east")
77     return EAST;
78   else if (directory == "north")
79     return NORTH;
80   else if (directory == "south")
81     return SOUTH;
82   else
83     return NONE;
84 }
85
86 TileManager::TileManager()
87 {
88   std::string stwt_filename = datadir +  "images/worldmap/antarctica.stwt";
89   lisp_object_t* root_obj = lisp_read_from_file(stwt_filename);
90  
91   if (!root_obj)
92     st_abort("Couldn't load file", stwt_filename);
93
94   if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap-tiles") == 0)
95     {
96       lisp_object_t* cur = lisp_cdr(root_obj);
97
98       while(!lisp_nil_p(cur))
99         {
100           lisp_object_t* element = lisp_car(cur);
101
102           if (strcmp(lisp_symbol(lisp_car(element)), "tile") == 0)
103             {
104               int id = 0;
105               std::string filename = "<invalid>";
106
107               Tile* tile = new Tile;             
108               tile->north = true;
109               tile->east  = true;
110               tile->south = true;
111               tile->west  = true;
112               tile->stop  = true;
113   
114               LispReader reader(lisp_cdr(element));
115               reader.read_int("id",  &id);
116               reader.read_bool("north", &tile->north);
117               reader.read_bool("south", &tile->south);
118               reader.read_bool("west",  &tile->west);
119               reader.read_bool("east",  &tile->east);
120               reader.read_bool("stop",  &tile->stop);
121               reader.read_string("image",  &filename);
122
123               tile->sprite = new Surface(
124                            datadir +  "/images/worldmap/" + filename, 
125                            USE_ALPHA);
126
127               if (id >= int(tiles.size()))
128                 tiles.resize(id+1);
129
130               tiles[id] = tile;
131             }
132           else
133             {
134               puts("Unhandled symbol");
135             }
136
137           cur = lisp_cdr(cur);
138         }
139     }
140   else
141     {
142       assert(0);
143     }
144
145   lisp_free(root_obj);
146 }
147
148 TileManager::~TileManager()
149 {
150   for(std::vector<Tile*>::iterator i = tiles.begin(); i != tiles.end(); ++i)
151     delete *i;
152 }
153
154 Tile*
155 TileManager::get(int i)
156 {
157   assert(i >=0 && i < int(tiles.size()));
158   return tiles[i];
159 }
160
161 //---------------------------------------------------------------------------
162
163 Tux::Tux(WorldMap* worldmap_)
164   : worldmap(worldmap_)
165 {
166   sprite = new Surface(datadir +  "/images/worldmap/tux.png", USE_ALPHA);
167   offset = 0;
168   moving = false;
169   tile_pos.x = 4;
170   tile_pos.y = 5;
171   direction = NONE;
172   input_direction = NONE;
173 }
174
175 Tux::~Tux()
176 {
177   delete sprite;
178 }
179
180 void
181 Tux::draw(const Point& offset)
182 {
183   Point pos = get_pos();
184   sprite->draw(pos.x + offset.x, 
185                pos.y + offset.y - 10);
186 }
187
188
189 Point
190 Tux::get_pos()
191 {
192   float x = tile_pos.x * 32;
193   float y = tile_pos.y * 32;
194
195   switch(direction)
196     {
197     case WEST:
198       x -= offset - 32;
199       break;
200     case EAST:
201       x += offset - 32;
202       break;
203     case NORTH:
204       y -= offset - 32;
205       break;
206     case SOUTH:
207       y += offset - 32;
208       break;
209     case NONE:
210       break;
211     }
212   
213   return Point((int)x, (int)y); 
214 }
215
216 void
217 Tux::stop()
218 {
219   offset = 0;
220   direction = NONE;
221   moving = false;
222 }
223
224 void
225 Tux::update(float delta)
226 {
227   if (!moving)
228     {
229       if (input_direction != NONE)
230         { 
231           WorldMap::Level* level = worldmap->at_level();
232
233           // We got a new direction, so lets start walking when possible
234           Point next_tile;
235           if ((!level || level->solved)
236               && worldmap->path_ok(input_direction, tile_pos, &next_tile))
237             {
238               tile_pos = next_tile;
239               moving = true;
240               direction = input_direction;
241               back_direction = reverse_dir(direction);
242             }
243           else if (input_direction == back_direction)
244             {
245               std::cout << "Back triggered" << std::endl;
246               moving = true;
247               direction = input_direction;
248               tile_pos = worldmap->get_next_tile(tile_pos, direction);
249               back_direction = reverse_dir(direction);
250             }
251         }
252     }
253   else
254     {
255       // Let tux walk a few pixels (20 pixel/sec)
256       offset += 20.0f * delta;
257
258       if (offset > 32)
259         { // We reached the next tile, so we check what to do now
260           offset -= 32;
261
262           if (worldmap->at(tile_pos)->stop || worldmap->at_level())
263             {
264               stop();
265             }
266           else
267             {
268               // Walk automatically to the next tile
269               Point next_tile;
270               if (worldmap->path_ok(direction, tile_pos, &next_tile))
271                 {
272                   tile_pos = next_tile;
273                 }
274               else
275                 {
276                   puts("Tilemap data is buggy");
277                   stop();
278                 }
279             }
280         }
281     }
282 }
283
284 //---------------------------------------------------------------------------
285 Tile::Tile()
286 {
287 }
288
289 Tile::~Tile()
290 {
291   delete sprite;
292 }
293
294 //---------------------------------------------------------------------------
295
296 WorldMap::WorldMap()
297 {
298   tile_manager = new TileManager();
299   tux = new Tux(this);
300
301   width  = 20;
302   height = 15;
303
304   level_sprite = new Surface(datadir +  "/images/worldmap/levelmarker.png", USE_ALPHA);
305   leveldot_green = new Surface(datadir +  "/images/worldmap/leveldot_green.png", USE_ALPHA);
306   leveldot_red = new Surface(datadir +  "/images/worldmap/leveldot_red.png", USE_ALPHA);
307
308   input_direction = NONE;
309   enter_level = false;
310
311   name = "<no file>";
312   music = "SALCON.MOD";
313
314   load_map();
315 }
316
317 WorldMap::~WorldMap()
318 {
319   delete tux;
320   delete tile_manager;
321
322   delete level_sprite;
323   delete leveldot_green;
324   delete leveldot_red;
325 }
326
327 void
328 WorldMap::load_map()
329 {
330   std::string filename = datadir +  "levels/default/worldmap.stwm";
331   
332   lisp_object_t* root_obj = lisp_read_from_file(filename);
333   if (!root_obj)
334     st_abort("Couldn't load file", filename);
335   
336   if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0)
337     {
338       lisp_object_t* cur = lisp_cdr(root_obj);
339
340       while(!lisp_nil_p(cur))
341         {
342           lisp_object_t* element = lisp_car(cur);
343
344           if (strcmp(lisp_symbol(lisp_car(element)), "tilemap") == 0)
345             {
346               LispReader reader(lisp_cdr(element));
347               reader.read_int("width",  &width);
348               reader.read_int("height", &height);
349               reader.read_int_vector("data", &tilemap);
350             }
351           else if (strcmp(lisp_symbol(lisp_car(element)), "properties") == 0)
352             {
353               LispReader reader(lisp_cdr(element));
354               reader.read_string("name",  &name);
355               reader.read_string("music", &music);
356             }
357           else if (strcmp(lisp_symbol(lisp_car(element)), "levels") == 0)
358             {
359               lisp_object_t* cur = lisp_cdr(element);
360               
361               while(!lisp_nil_p(cur))
362                 {
363                   lisp_object_t* element = lisp_car(cur);
364                   
365                   if (strcmp(lisp_symbol(lisp_car(element)), "level") == 0)
366                     {
367                       Level level;
368                       LispReader reader(lisp_cdr(element));
369                       level.solved = false;
370                       
371                       level.north = true;
372                       level.east  = true;
373                       level.south = true;
374                       level.west  = true;
375
376                       reader.read_string("name",  &level.name);
377                       reader.read_int("x", &level.x);
378                       reader.read_int("y", &level.y);
379
380                       get_level_title(&level);   // get level's title
381
382                       levels.push_back(level);
383                     }
384                   
385                   cur = lisp_cdr(cur);      
386                 }
387             }
388           else
389             {
390               
391             }
392           
393           cur = lisp_cdr(cur);
394         }
395     }
396
397     lisp_free(root_obj);
398 }
399
400 void WorldMap::get_level_title(Levels::pointer level)
401 {
402   /** get level's title */
403   level->title = "<no title>";
404
405   FILE * fi;
406   lisp_object_t* root_obj = 0;
407   fi = fopen((datadir +  "levels/" + level->name).c_str(), "r");
408   if (fi == NULL)
409   {
410     perror((datadir +  "levels/" + level->name).c_str());
411     return;
412   }
413
414   lisp_stream_t stream;
415   lisp_stream_init_file (&stream, fi);
416   root_obj = lisp_read (&stream);
417
418   if (root_obj->type == LISP_TYPE_EOF || root_obj->type == LISP_TYPE_PARSE_ERROR)
419   {
420     printf("World: Parse Error in file %s", level->name.c_str());
421   }
422
423   if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-level") == 0)
424   {
425     LispReader reader(lisp_cdr(root_obj));
426     reader.read_string("name",  &level->title);
427   }
428
429   lisp_free(root_obj);
430
431   fclose(fi);
432 }
433
434 void
435 WorldMap::on_escape_press()
436 {
437   // Show or hide the menu
438   if(!Menu::current())
439     Menu::set_current(worldmap_menu); 
440   else
441     Menu::set_current(0); 
442 }
443
444 void
445 WorldMap::get_input()
446 {
447   enter_level = false;
448   input_direction = NONE;
449    
450   SDL_Event event;
451   while (SDL_PollEvent(&event))
452     {
453       if (Menu::current())
454         {
455           Menu::current()->event(event);
456         }
457       else
458         {
459           switch(event.type)
460             {
461             case SDL_QUIT:
462               st_abort("Received window close", "");
463               break;
464           
465             case SDL_KEYDOWN:
466               switch(event.key.keysym.sym)
467                 {
468                 case SDLK_ESCAPE:
469                   on_escape_press();
470                   break;
471                 case SDLK_LCTRL:
472                 case SDLK_RETURN:
473                   enter_level = true;
474                   break;
475                 default:
476                   break;
477                 }
478               break;
479           
480             case SDL_JOYAXISMOTION:
481               if (event.jaxis.axis == joystick_keymap.x_axis)
482                 {
483                   if (event.jaxis.value < -joystick_keymap.dead_zone)
484                     input_direction = WEST;
485                   else if (event.jaxis.value > joystick_keymap.dead_zone)
486                     input_direction = EAST;
487                 }
488               else if (event.jaxis.axis == joystick_keymap.y_axis)
489                 {
490                   if (event.jaxis.value > joystick_keymap.dead_zone)
491                     input_direction = SOUTH;
492                   else if (event.jaxis.value < -joystick_keymap.dead_zone)
493                     input_direction = NORTH;
494                 }
495               break;
496
497             case SDL_JOYBUTTONDOWN:
498               if (event.jbutton.button == joystick_keymap.b_button)
499                 enter_level = true;
500               else if (event.jbutton.button == joystick_keymap.start_button)
501                 on_escape_press();
502               break;
503
504             default:
505               break;
506             }
507         }
508     }
509
510   if (!Menu::current())
511     {
512       Uint8 *keystate = SDL_GetKeyState(NULL);
513   
514       if (keystate[SDLK_LEFT])
515         input_direction = WEST;
516       else if (keystate[SDLK_RIGHT])
517         input_direction = EAST;
518       else if (keystate[SDLK_UP])
519         input_direction = NORTH;
520       else if (keystate[SDLK_DOWN])
521         input_direction = SOUTH;
522     }
523 }
524
525 Point
526 WorldMap::get_next_tile(Point pos, Direction direction)
527 {
528   switch(direction)
529     {
530     case WEST:
531       pos.x -= 1;
532       break;
533     case EAST:
534       pos.x += 1;
535       break;
536     case NORTH:
537       pos.y -= 1;
538       break;
539     case SOUTH:
540       pos.y += 1;
541       break;
542     case NONE:
543       break;
544     }
545   return pos;
546 }
547
548 bool
549 WorldMap::path_ok(Direction direction, Point old_pos, Point* new_pos)
550 {
551   *new_pos = get_next_tile(old_pos, direction);
552
553   if (!(new_pos->x >= 0 && new_pos->x < width
554         && new_pos->y >= 0 && new_pos->y < height))
555     { // New position is outsite the tilemap
556       return false;
557     }
558   else
559     { // Check if we the tile allows us to go to new_pos
560       switch(direction)
561         {
562         case WEST:
563           return (at(old_pos)->west && at(*new_pos)->east);
564
565         case EAST:
566           return (at(old_pos)->east && at(*new_pos)->west);
567
568         case NORTH:
569           return (at(old_pos)->north && at(*new_pos)->south);
570
571         case SOUTH:
572           return (at(old_pos)->south && at(*new_pos)->north);
573
574         case NONE:
575           assert(!"path_ok() can't work if direction is NONE");
576         }
577       return false;
578     }
579 }
580
581 void
582 WorldMap::update()
583 {
584   if (enter_level && !tux->is_moving())
585     {
586       Level* level = at_level();
587       if (level)
588         {
589           if (level->x == tux->get_tile_pos().x && 
590               level->y == tux->get_tile_pos().y)
591             {
592               std::cout << "Enter the current level: " << level->name << std::endl;;
593               GameSession session(datadir +  "levels/" + level->name,
594                                   1, ST_GL_LOAD_LEVEL_FILE);
595
596               switch (session.run())
597                 {
598                 case GameSession::LEVEL_FINISHED:
599                   level->solved = true;
600                   if (session.get_world()->get_tux()->got_coffee)
601                     player_status.bonus = PlayerStatus::FLOWER_BONUS;
602                   else if (session.get_world()->get_tux()->size == BIG)
603                     player_status.bonus = PlayerStatus::GROWUP_BONUS;
604                   else
605                     player_status.bonus = PlayerStatus::NO_BONUS;
606                   break;
607                 case GameSession::LEVEL_ABORT:
608                   // Reseting the player_status might be a worthy
609                   // consideration, but I don't think we need it
610                   // 'cause only the bad players will use it to
611                   // 'cheat' a few items and that isn't necesarry a
612                   // bad thing (ie. better they continue that way,
613                   // then stop playing the game all together since it
614                   // is to hard)
615                   break;
616                 case GameSession::GAME_OVER:
617                   quit = true;
618                   break;
619                 case GameSession::NONE:
620                   // Should never be reached 
621                   break;
622                 }
623
624               music_manager->play_music(song);
625               Menu::set_current(0);
626               if (!savegame_file.empty())
627                 savegame(savegame_file);
628               return;
629             }
630         }
631       else
632         {
633           std::cout << "Nothing to enter at: "
634                     << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl;
635         }
636     }
637   else
638     {
639       tux->set_direction(input_direction);
640       tux->update(0.33f);
641     }
642   
643   Menu* menu = Menu::current();
644   if(menu)
645     {
646       menu->action();
647
648       if(menu == worldmap_menu)
649         {
650           switch (worldmap_menu->check())
651             {
652             case MNID_RETURNWORLDMAP: // Return to game
653               break;
654             case MNID_SAVEGAME:
655               if (!savegame_file.empty())
656                 savegame(savegame_file);
657               break;
658                 
659             case MNID_QUITWORLDMAP: // Quit Worldmap
660               quit = true;
661               break;
662             }
663         }
664       else if(menu == options_menu)
665         {
666           process_options_menu();
667         }
668     }
669 }
670
671 Tile*
672 WorldMap::at(Point p)
673 {
674   assert(p.x >= 0 
675          && p.x < width
676          && p.y >= 0
677          && p.y < height);
678
679   return tile_manager->get(tilemap[width * p.y + p.x]);
680 }
681
682 WorldMap::Level*
683 WorldMap::at_level()
684 {
685   for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
686     {
687       if (i->x == tux->get_tile_pos().x && 
688           i->y == tux->get_tile_pos().y)
689         return &*i; 
690     }
691
692   return 0;
693 }
694
695
696 void
697 WorldMap::draw(const Point& offset)
698 {
699   for(int y = 0; y < height; ++y)
700     for(int x = 0; x < width; ++x)
701       {
702         Tile* tile = at(Point(x, y));
703         tile->sprite->draw(x*32 + offset.x,
704                            y*32 + offset.y);
705       }
706   
707   for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
708     {
709       if (i->solved)
710         leveldot_green->draw(i->x*32 + offset.x, 
711                              i->y*32 + offset.y);
712       else
713         leveldot_red->draw(i->x*32 + offset.x, 
714                            i->y*32 + offset.y);        
715     }
716
717   tux->draw(offset);
718   draw_status();
719 }
720
721 void
722 WorldMap::draw_status()
723 {
724   char str[80];
725   sprintf(str, "%d", player_status.score);
726   white_text->draw("SCORE", 0, 0);
727   gold_text->draw(str, 96, 0);
728
729   sprintf(str, "%d", player_status.distros);
730   white_text->draw_align("COINS", 320-64, 0,  A_LEFT, A_TOP);
731   gold_text->draw_align(str, 320+64, 0, A_RIGHT, A_TOP);
732
733   white_text->draw("LIVES", 480, 0);
734   if (player_status.lives >= 5)
735     {
736       sprintf(str, "%dx", player_status.lives);
737       gold_text->draw(str, 585, 0);
738       tux_life->draw(565+(18*3), 0);
739     }
740   else
741     {
742       for(int i= 0; i < player_status.lives; ++i)
743         tux_life->draw(565+(18*i),0);
744     }
745
746   if (!tux->is_moving())
747     {
748       for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
749         {
750           if (i->x == tux->get_tile_pos().x && 
751               i->y == tux->get_tile_pos().y)
752             {
753               white_text->draw_align(i->title.c_str(), screen->w/2, screen->h,  A_HMIDDLE, A_BOTTOM);
754               break;
755             }
756         }
757     }
758 }
759
760 void
761 WorldMap::display()
762 {
763   Menu::set_current(0);
764
765   quit = false;
766
767   song = music_manager->load_music(datadir +  "/music/" + music);
768   music_manager->play_music(song);
769
770   while(!quit) {
771     Point tux_pos = tux->get_pos();
772     if (1)
773       {
774         offset.x = -tux_pos.x + screen->w/2;
775         offset.y = -tux_pos.y + screen->h/2;
776
777         if (offset.x > 0) offset.x = 0;
778         if (offset.y > 0) offset.y = 0;
779
780         if (offset.x < screen->w - width*32) offset.x = screen->w - width*32;
781         if (offset.y < screen->h - height*32) offset.y = screen->h - height*32;
782       } 
783
784     draw(offset);
785     get_input();
786     update();
787
788   if(Menu::current())
789     {
790       Menu::current()->draw();
791       mouse_cursor->draw();
792     }
793     flipscreen();
794
795     SDL_Delay(20);
796   }
797 }
798
799 void
800 WorldMap::savegame(const std::string& filename)
801 {
802   std::cout << "savegame: " << filename << std::endl;
803   std::ofstream out(filename.c_str());
804
805   int nb_solved_levels = 0;
806   for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
807     {
808       if (i->solved)
809         ++nb_solved_levels;
810     }
811
812   out << "(supertux-savegame\n"
813       << "  (version 1)\n"
814       << "  (title  \"Icyisland - " << nb_solved_levels << "/" << levels.size() << "\")\n"
815       << "  (lives   " << player_status.lives << ")\n"
816       << "  (score   " << player_status.score << ")\n"
817       << "  (distros " << player_status.distros << ")\n"
818       << "  (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")\n"
819       << "       (back \"" << direction_to_string(tux->back_direction) << "\")\n"
820       << "       (bonus \"" << bonus_to_string(player_status.bonus) <<  "\"))\n"
821       << "  (levels\n";
822   
823   for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
824     {
825       if (i->solved)
826         {
827           out << "     (level (name \"" << i->name << "\")\n"
828               << "            (solved #t))\n";
829         }
830     }  
831
832   out << "   )\n"
833       << " )\n\n;; EOF ;;" << std::endl;
834 }
835
836 void
837 WorldMap::loadgame(const std::string& filename)
838 {
839   std::cout << "loadgame: " << filename << std::endl;
840   savegame_file = filename;
841
842   if (access(filename.c_str(), F_OK) != 0)
843     return;
844   
845   lisp_object_t* savegame = lisp_read_from_file(filename);
846   lisp_object_t* cur = savegame;
847
848   if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-savegame") != 0)
849     return;
850
851   cur = lisp_cdr(cur);
852   LispReader reader(cur);
853
854   reader.read_int("lives",  &player_status.lives);
855   reader.read_int("score",  &player_status.score);
856   reader.read_int("distros", &player_status.distros);
857
858   if (player_status.lives < 0)
859     player_status.lives = START_LIVES;
860
861   lisp_object_t* tux_cur = 0;
862   if (reader.read_lisp("tux", &tux_cur))
863     {
864       Point p;
865       std::string back_str = "none";
866
867       LispReader tux_reader(tux_cur);
868       tux_reader.read_int("x", &p.x);
869       tux_reader.read_int("y", &p.y);
870       tux_reader.read_string("back", &back_str);
871       
872       tux->back_direction = string_to_direction(back_str);      
873       tux->set_tile_pos(p);
874     }
875
876   lisp_object_t* level_cur = 0;
877   if (reader.read_lisp("levels", &level_cur))
878     {
879       while(level_cur)
880         {
881           lisp_object_t* sym  = lisp_car(lisp_car(level_cur));
882           lisp_object_t* data = lisp_cdr(lisp_car(level_cur));
883
884           if (strcmp(lisp_symbol(sym), "level") == 0)
885             {
886               std::string name;
887               bool solved = false;
888
889               LispReader level_reader(data);
890               level_reader.read_string("name",   &name);
891               level_reader.read_bool("solved", &solved);
892
893               for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
894                 {
895                   if (name == i->name)
896                     i->solved = solved;
897                 }
898             }
899
900           level_cur = lisp_cdr(level_cur);
901         }
902     }
903  
904   lisp_free(savegame);
905 }
906
907 } // namespace WorldMapNS
908
909 /* Local Variables: */
910 /* mode:c++ */
911 /* End: */
912