source: golgotha/src/golg/editor/commands/merge_terrain.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.6 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "editor/editor.hh"
10#include "file/get_filename.hh"
11#include "saver.hh"
12#include "mess_id.hh"
13
14void g1_editor_class::merge_terrain()
15{
16  i4_create_file_open_dialog(style,
17                             get_editor_string("merge_ter_title"),
18                             get_editor_string("merge_ter_start_dir"),
19                             get_editor_string("merge_ter_file_mask"),
20                             get_editor_string("merge_ter_mask_name"),
21                             this,
22                             G1_TMERGE_FILE_OPEN_OK,
23                             G1_TMERGE_FILE_OPEN_CANCEL);
24
25
26}
27
28i4_bool g1_editor_class::merge_terrain_ok(i4_user_message_event_class *ev)
29{
30  CAST_PTR(f, i4_file_open_message_class, ev);
31
32 
33  i4_bool ret=i4_F;
34  if (get_map())
35  {
36    i4_file_class *in=i4_open(*f->filename);
37    if (in)
38    {
39      g1_loader_class *l=g1_open_save_file(in);
40   
41      if (l)
42      {
43        g1_editor_instance.add_undo(G1_MAP_CELLS | G1_MAP_VERTS);
44
45        get_map()->load(l, G1_MAP_CELLS | G1_MAP_VERTS);
46        delete l;
47        ret=i4_T;
48      }
49
50      delete in;
51    }
52  }
53
54  return ret;
55}
56
Note: See TracBrowser for help on using the repository browser.