ifmapper 1.0.0 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. data/HISTORY.txt +648 -627
  2. data/IFMapper.gemspec +29 -28
  3. data/IFMapper.rbw +31 -31
  4. data/TODO.txt +8 -7
  5. data/bin/IFMapper +31 -31
  6. data/docs/en/index.html +0 -0
  7. data/docs/en/start.html +3 -2
  8. data/docs/en/start.html~ +516 -0
  9. data/docs/es/index.html +0 -0
  10. data/docs/es/start.html +13 -14
  11. data/docs/es/start.html~ +1280 -0
  12. data/docs/images/IFMapper_main.gif +0 -0
  13. data/docs/images/automap.gif +0 -0
  14. data/docs/images/complex_connection.gif +0 -0
  15. data/docs/images/connection.gif +0 -0
  16. data/docs/images/connection_menu.gif +0 -0
  17. data/docs/images/room_description.gif +0 -0
  18. data/docs/images/room_small.gif +0 -0
  19. data/icons/copy.png +0 -0
  20. data/icons/cut.png +0 -0
  21. data/icons/filenew.png +0 -0
  22. data/icons/fileopen.png +0 -0
  23. data/icons/filesave.png +0 -0
  24. data/icons/filesaveas.png +0 -0
  25. data/icons/help.png +0 -0
  26. data/icons/kill.png +0 -0
  27. data/icons/nextpage.png +0 -0
  28. data/icons/paste.png +0 -0
  29. data/icons/prevpage.png +0 -0
  30. data/icons/printicon.png +0 -0
  31. data/icons/redo.png +0 -0
  32. data/icons/room_e.gif +0 -0
  33. data/icons/room_e.xpm +0 -0
  34. data/icons/room_n.gif +0 -0
  35. data/icons/room_n.xpm +0 -0
  36. data/icons/room_ne.gif +0 -0
  37. data/icons/room_ne.xpm +0 -0
  38. data/icons/room_nw.gif +0 -0
  39. data/icons/room_nw.xpm +0 -0
  40. data/icons/room_s.gif +0 -0
  41. data/icons/room_s.xpm +0 -0
  42. data/icons/room_se.gif +0 -0
  43. data/icons/room_se.xpm +0 -0
  44. data/icons/room_sw.gif +0 -0
  45. data/icons/room_sw.xpm +0 -0
  46. data/icons/room_w.gif +0 -0
  47. data/icons/room_w.xpm +0 -0
  48. data/icons/saveas.png +0 -0
  49. data/icons/undo.png +0 -0
  50. data/icons/winapp.png +0 -0
  51. data/icons/zoom.png +0 -0
  52. data/lib/IFMapper/AStar.rb +250 -250
  53. data/lib/IFMapper/Connection.rb +202 -202
  54. data/lib/IFMapper/FXAboutDialogBox.rb +32 -32
  55. data/lib/IFMapper/FXConnection.rb +364 -364
  56. data/lib/IFMapper/FXConnectionDialogBox.rb +124 -124
  57. data/lib/IFMapper/FXDCPostscript.rb +404 -404
  58. data/lib/IFMapper/FXDCPrint.rb +15 -15
  59. data/lib/IFMapper/FXItemList.rb +108 -0
  60. data/lib/IFMapper/FXMap.rb +2147 -2116
  61. data/lib/IFMapper/FXMapColorBox.rb +88 -88
  62. data/lib/IFMapper/FXMapDialogBox.rb +127 -127
  63. data/lib/IFMapper/FXMapFileDialog.rb +34 -34
  64. data/lib/IFMapper/FXMapperSettings.rb +206 -205
  65. data/lib/IFMapper/FXMapperWindow.rb +1592 -1571
  66. data/lib/IFMapper/FXPDFMapExporterOptionsDialogBox.rb +46 -0
  67. data/lib/IFMapper/FXRoom.rb +263 -263
  68. data/lib/IFMapper/FXRoomDialogBox.rb +159 -159
  69. data/lib/IFMapper/FXRoomList.rb +95 -95
  70. data/lib/IFMapper/FXSearchDialogBox.rb +51 -51
  71. data/lib/IFMapper/FXSection.rb +33 -33
  72. data/lib/IFMapper/FXSectionDialogBox.rb +38 -38
  73. data/lib/IFMapper/FXSpline.rb +52 -52
  74. data/lib/IFMapper/FXWarningBox.rb +51 -50
  75. data/lib/IFMapper/GUEReader.rb +445 -445
  76. data/lib/IFMapper/IFMReader.rb +584 -584
  77. data/lib/IFMapper/IFMWriter.rb +245 -227
  78. data/lib/IFMapper/Inform7Writer.rb +579 -573
  79. data/lib/IFMapper/InformReader.rb +478 -478
  80. data/lib/IFMapper/InformWriter.rb +364 -359
  81. data/lib/IFMapper/Map.rb +202 -200
  82. data/lib/IFMapper/MapPrinting.rb +162 -162
  83. data/lib/IFMapper/MapReader.rb +900 -900
  84. data/lib/IFMapper/PDFMapExporter.rb +526 -483
  85. data/lib/IFMapper/Room.rb +153 -151
  86. data/lib/IFMapper/Section.rb +234 -234
  87. data/lib/IFMapper/TADSReader.rb +474 -471
  88. data/lib/IFMapper/TADSWriter.rb +375 -370
  89. data/lib/IFMapper/TranscriptDialogBox.rb +0 -0
  90. data/lib/IFMapper/TranscriptReader.rb +1361 -1359
  91. data/lib/IFMapper/locales/en/Messages.rb +446 -435
  92. data/lib/IFMapper/locales/es/Messages.rb +451 -440
  93. data/lib/IFMapper/locales/es/Messages_iso-8859-1.rb +455 -440
  94. data/lib/IFMapper/locales/es/runme.sh +3 -3
  95. data/maps/A New Life.map b/data/maps/A New → Life.map +0 -0
  96. data/maps/AMFV.map +0 -0
  97. data/maps/AllRoads.map +0 -0
  98. data/maps/Aotearoa.map +0 -0
  99. data/maps/Bronze.map +0 -0
  100. data/maps/Bureaucracy.ifm +0 -0
  101. data/maps/Bureaucracy.map +0 -0
  102. data/maps/CityOfSecrets.map +0 -0
  103. data/maps/DDIV.map +0 -0
  104. data/maps/Following_A_Star.map +0 -0
  105. data/maps/Heated.map +0 -0
  106. data/maps/Heroine.map +0 -0
  107. data/maps/History Repeating.map b/data/maps/History → Repeating.map +0 -0
  108. data/maps/Hollywood_Hijinx.ifm +0 -0
  109. data/maps/Janitor.map +0 -0
  110. data/maps/Jigsaw.ifm +0 -0
  111. data/maps/Jigsaw.map +0 -0
  112. data/maps/LGOP.ifm +0 -0
  113. data/maps/Mercy.ifm +0 -0
  114. data/maps/Ninjas_Fate.map +0 -0
  115. data/maps/Pen_and_Paint.map +0 -0
  116. data/maps/Planetfall.ifm +0 -0
  117. data/maps/Planetfall.map +0 -0
  118. data/maps/Plundered_Hearts.ifm +0 -0
  119. data/maps/QuietEvening.map +0 -0
  120. data/maps/Ralph.ifm +0 -0
  121. data/maps/Reliques_of_Tolti_Alph.map +0 -0
  122. data/maps/Revolution.map +0 -0
  123. data/maps/Robots_of_Dawn.ifm +0 -0
  124. data/maps/SavoirFare.map +0 -0
  125. data/maps/Seastalker.ifm +0 -0
  126. data/maps/Seastalker.map +0 -0
  127. data/maps/Sherlock.ifm +0 -0
  128. data/maps/SoFar.ifm +0 -0
  129. data/maps/Starcross.ifm +0 -0
  130. data/maps/Suspended.ifm +0 -0
  131. data/maps/Tangle.map +0 -0
  132. data/maps/The_Lost_Sheep.map +0 -0
  133. data/maps/Unforgotten.map +0 -0
  134. data/maps/Warbler's Nest.map +0 -0
  135. data/maps/Warbler's_Nest.map +0 -0
  136. data/maps/Westminster_Abbey.map +0 -0
  137. data/maps/WinterWonderland.map +0 -0
  138. data/maps/Wishbringer.ifm +0 -0
  139. data/maps/Wishbringer2.ifm +0 -0
  140. data/maps/Zork1.ifm +0 -0
  141. data/maps/Zork2.ifm +0 -0
  142. data/maps/Zork3.ifm +0 -0
  143. data/maps/Zork_Zero.ifm +0 -0
  144. data/maps/anchor.ifm +0 -0
  145. data/maps/anchor.map +0 -0
  146. data/maps/atrox.ifm +0 -0
  147. data/maps/awaken.ifm +0 -0
  148. data/maps/babel.ifm +0 -0
  149. data/maps/balances.map +0 -0
  150. data/maps/ballerina.map +0 -0
  151. data/maps/bear.map +0 -0
  152. data/maps/bluechairs.map +0 -0
  153. data/maps/break_in.map +0 -0
  154. data/maps/bse.ifm +0 -0
  155. data/maps/building.map +0 -0
  156. data/maps/change.ifm +0 -0
  157. data/maps/christminster.map +0 -0
  158. data/maps/curses.ifm +0 -0
  159. data/maps/curves.ifm +0 -0
  160. data/maps/deadline.map +0 -0
  161. data/maps/delusions.map +0 -0
  162. data/maps/devours.map +0 -0
  163. data/maps/distress.map +0 -0
  164. data/maps/djinni.map +0 -0
  165. data/maps/dreamhold.map +0 -0
  166. data/maps/drift3.map +0 -0
  167. data/maps/eas.map +0 -0
  168. data/maps/eas2.map +0 -0
  169. data/maps/eas3.map +0 -0
  170. data/maps/edifice.ifm +0 -0
  171. data/maps/fallacy.map +0 -0
  172. data/maps/frozen.ifm +0 -0
  173. data/maps/gamlet.map +0 -0
  174. data/maps/glow.ifm +0 -0
  175. data/maps/guilty_bastards.map +0 -0
  176. data/maps/heist.map +0 -0
  177. data/maps/heroes.map +0 -0
  178. data/maps/inhumane.map +0 -0
  179. data/maps/kaged.map +0 -0
  180. data/maps/library.ifm +0 -0
  181. data/maps/lurkinghorror.map +0 -0
  182. data/maps/metamorphoses.map +0 -0
  183. data/maps/mindelec.ifm +0 -0
  184. data/maps/minster.ifm +0 -0
  185. data/maps/mite.map +0 -0
  186. data/maps/moonmist.map +0 -0
  187. data/maps/muldoon_legacy.map +0 -0
  188. data/maps/muse.ifm +0 -0
  189. data/maps/paperchase.ifm +0 -0
  190. data/maps/party.map +0 -0
  191. data/maps/pawn.map +0 -0
  192. data/maps/photograph.map +0 -0
  193. data/maps/pkgirl.map +0 -0
  194. data/maps/pytho.map +0 -0
  195. data/maps/risorgimento.map +0 -0
  196. data/maps/sherbet.map +0 -0
  197. data/maps/simple.map +0 -0
  198. data/maps/slouch.map +0 -0
  199. data/maps/space_st.ifm +0 -0
  200. data/maps/splashdown.map +0 -0
  201. data/maps/spring.map +0 -0
  202. data/maps/squarecircle.map +0 -0
  203. data/maps/stationfall.ifm +0 -0
  204. data/maps/theatre.ifm +0 -0
  205. data/maps/toonesia.ifm +0 -0
  206. data/maps/tortoise.ifm +0 -0
  207. data/maps/trinity.map +0 -0
  208. data/maps/vespers.map +0 -0
  209. data/maps/vgame.ifm +0 -0
  210. data/maps/wasp.map +0 -0
  211. data/maps/weather.ifm +0 -0
  212. data/maps/windhall.ifm +0 -0
  213. data/maps/worlds.map +0 -0
  214. data/maps/xtcontest.map +0 -0
  215. data/maps/zdungeon.map +0 -0
  216. data/maps/zebulon.ifm +0 -0
  217. data/maps/zerosum.map +0 -0
  218. metadata +226 -183
@@ -1,227 +1,245 @@
1
-
2
-
3
-
4
- class IFMWriter
5
-
6
- def link(c)
7
- return if @links.include?(c) # already spit out
8
- a = c.roomA
9
- return if not a
10
- b = c.roomB
11
- roomA = @elem[a]
12
- roomB = @elem[b]
13
- @f.puts
14
- @f.print "link #{roomA} to #{roomB}"
15
- directions(c, a, b)
16
- @f.print ";\n"
17
- end
18
-
19
- def directions(c, a, b)
20
- @links << c
21
- if c.gpts.empty?
22
- # simple connection
23
- idx = a.next_to?(b)
24
- dir = ' ' + Room::DIRECTIONS[idx]
25
- else
26
- # complex path
27
- dir = ''
28
- pts = c.gpts.dup
29
- x = a.x
30
- y = a.y
31
- if c.roomA != a
32
- pts.reverse!
33
- end
34
-
35
- pts.each { |p|
36
- dx, dy = [ p[0] - x, p[1] - y ]
37
- idx = Room::vector_to_dir(dx, dy)
38
- dir += " #{Room::DIRECTIONS[idx]}"
39
- x = p[0]
40
- y = p[1]
41
- }
42
- dx, dy = [ b.x - x, b.y - y ]
43
- idx = Room::vector_to_dir(dx, dy)
44
- dir += " #{Room::DIRECTIONS[idx]}"
45
- end
46
- @f.print " dir#{dir}"
47
-
48
- if c.exitAtext != 0
49
- dir = Connection::EXIT_TEXT[c.exitAtext].downcase
50
- @f.print " go #{dir}"
51
- end
52
-
53
- if c.dir == Connection::AtoB
54
- @f.print " oneway"
55
- end
56
-
57
- if c.type == Connection::SPECIAL
58
- @f.print " style special"
59
- end
60
- end
61
-
62
- def get_tag(e, t)
63
- return @elem[e] if @elem.has_key?(e)
64
-
65
- tag = t.dup
66
- tag.gsub!(/[\s,\.'"#$@\/\\-]+/, '_')
67
- tagname = tag
68
- idx = 2
69
- while @tags.include?(tagname)
70
- tagname = tag + '_' + idx.to_s
71
- idx += 1
72
- end
73
- @tags << tagname
74
- @elem[e] = tagname
75
- return tagname
76
- end
77
-
78
- # hook up two rooms that are not linked
79
- def nolink(a, b)
80
- x = a.x
81
- y = a.y
82
-
83
- # find free room exit in a
84
- exit = 0
85
- a.exits.each_with_index { |e, idx|
86
- next if e
87
- exit = idx
88
- break
89
- }
90
- dir = Room::DIRECTIONS[exit]
91
- dx, dy = Room::DIR_TO_VECTOR[exit]
92
- x += dx
93
- y += dy
94
- while x != b.x or y != b.y
95
- dx = dy = 0
96
- if b.x > x
97
- dx = 1
98
- elsif b.x < x
99
- dx = -1
100
- end
101
- if b.y > y
102
- dy = 1
103
- elsif b.y < y
104
- dy = -1
105
- end
106
- idx = Room::vector_to_dir(dx, dy)
107
- dir += " #{Room::DIRECTIONS[idx]}"
108
- x += dx
109
- y += dy
110
- end
111
-
112
- @f.print " dir #{dir} nolink"
113
- end
114
-
115
- def room(r)
116
- return if @rooms.include?(r)
117
- @rooms << r
118
- tag = get_tag(r, r.name)
119
-
120
- @f.puts
121
- @f.print "room \"#{r.name}\" tag #{tag}"
122
- if @link
123
- if @link[3]
124
- nolink(@last_room, r)
125
- else
126
- directions(@link[0], @link[1], @link[2])
127
- if @last_room and @link[1] != @last_room
128
- tag = get_tag(@link[1], @link[1].name)
129
- @f.print " from #{tag}"
130
- end
131
- end
132
- end
133
- @f.print ";\n"
134
- @last_room = r
135
-
136
- objs = r.objects.split("\n")
137
- objs.each { |obj|
138
- tag = get_tag(obj, obj)
139
- @f.puts "\titem \"#{obj}\" tag #{tag};"
140
- }
141
- tasks = r.tasks.split("\n")
142
- tasks.each { |task|
143
- tag = get_tag(task, task)
144
- @f.puts "\ttask \"#{task}\" tag #{tag};"
145
- }
146
-
147
- r.exits.each { |c|
148
- next if not c or @links.include?(c)
149
- if c.roomA == c.roomB
150
- # self-link
151
- link(c)
152
- next
153
- end
154
- if r == c.roomA
155
- @link = [c, c.roomA, c.roomB]
156
- room(c.roomB) # Recurse along this branch...
157
- else
158
- @link = [c, c.roomB, c.roomA]
159
- room(c.roomA) # Recurse along this branch...
160
- end
161
- }
162
- end
163
-
164
- def sections
165
- old_section = @map.section
166
- @map.sections.each_with_index { |section, idx|
167
- @f.puts
168
- @f.puts '#' * 79
169
- @f.puts
170
- if section.name.to_s == ''
171
- if @map.sections.size > 1
172
- @f.puts "map \"Section #{idx+1}\";"
173
- end
174
- else
175
- @f.puts "map \"#{section.name}\";"
176
- end
177
- @map.section = idx
178
- @link = nil
179
- section.rooms.each { |r|
180
- room(r)
181
- @link << 'nolink'
182
- }
183
- section.connections.each { |c|
184
- link(c)
185
- }
186
- }
187
- @map.section = old_section
188
- end
189
-
190
- def header
191
- @f.puts <<-"HEADER"
192
- #
193
- # IFM map for #{@map.name}
194
- # Created by #{@map.creator}
195
- # #{Time.now}
196
- #
197
- # Map created using the Interactive Fiction Mapper
198
- # (C) 2005 - Gonzalo Garramuno
199
- #
200
-
201
- HEADER
202
-
203
- if @map.name.to_s != ''
204
- puts "title \"#{@map.name}\";\n"
205
- end
206
-
207
- end
208
-
209
-
210
- def export(file)
211
- @f = File.open(file, 'w')
212
- header
213
- sections
214
- @f.close
215
- end
216
-
217
- def initialize(map, file)
218
- @link = nil
219
- @links = []
220
- @rooms = []
221
- @last_room = nil
222
- @tags = []
223
- @elem = {}
224
- @map = map
225
- export(file)
226
- end
227
- end
1
+
2
+
3
+
4
+ class IFMWriter
5
+
6
+ EXIT_TEXT = [
7
+ '',
8
+ 'up',
9
+ 'down',
10
+ 'in',
11
+ 'out'
12
+ ]
13
+
14
+
15
+
16
+ def link(c)
17
+ return if @links.include?(c) # already spit out
18
+ return if c.stub?
19
+ a = c.roomA
20
+ return if not a
21
+ b = c.roomB
22
+ roomA = @elem[a]
23
+ roomB = @elem[b]
24
+ @f.puts
25
+ @f.print "link #{roomA} to #{roomB}"
26
+ directions(c, a, b)
27
+ @f.print ";\n"
28
+ end
29
+
30
+ def directions(c, a, b)
31
+ return if c.stub?
32
+
33
+ @links << c
34
+ if c.gpts.empty?
35
+ # self connection
36
+ if a == b
37
+ idx = c.dirs[0]
38
+ else
39
+ # simple connection
40
+ idx = a.next_to?(b)
41
+ end
42
+ dir = ' ' + Room::DIRECTIONS[idx]
43
+ else
44
+ # complex path
45
+ dir = ''
46
+ pts = c.gpts.dup
47
+ x = a.x
48
+ y = a.y
49
+ if c.roomA != a
50
+ pts.reverse!
51
+ end
52
+
53
+ pts.each { |p|
54
+ dx, dy = [ p[0] - x, p[1] - y ]
55
+ idx = Room::vector_to_dir(dx, dy)
56
+ dir += " #{Room::DIRECTIONS[idx]}"
57
+ x = p[0]
58
+ y = p[1]
59
+ }
60
+ dx, dy = [ b.x - x, b.y - y ]
61
+ idx = Room::vector_to_dir(dx, dy)
62
+ dir += " #{Room::DIRECTIONS[idx]}"
63
+ end
64
+ @f.print " dir#{dir}"
65
+
66
+ end
67
+
68
+ def get_tag(e, t)
69
+ return @elem[e] if @elem.has_key?(e)
70
+
71
+ tag = t.dup
72
+ tag.gsub!(/[\-\(\s,\.'"#$@\/\\\-\)]+/, '_')
73
+ tagname = tag
74
+ idx = 2
75
+ while @tags.include?(tagname) or tagname.empty? or tagname.size == 1
76
+ tagname = tag + '_' + idx.to_s
77
+ idx += 1
78
+ end
79
+ @tags << tagname
80
+ @elem[e] = tagname
81
+ return tagname
82
+ end
83
+
84
+ # hook up two rooms that are not linked
85
+ def nolink(a, b)
86
+ x = a.x
87
+ y = a.y
88
+ # find free room exit in a
89
+ exit = 0
90
+ a.exits.each_with_index { |e, idx|
91
+ next if e
92
+ exit = idx
93
+ break
94
+ }
95
+ dir = Room::DIRECTIONS[exit]
96
+ dx, dy = Room::DIR_TO_VECTOR[exit]
97
+ x += dx
98
+ y += dy
99
+ while x != b.x or y != b.y
100
+ dx = dy = 0
101
+ if b.x > x
102
+ dx = 1
103
+ elsif b.x < x
104
+ dx = -1
105
+ end
106
+ if b.y > y
107
+ dy = 1
108
+ elsif b.y < y
109
+ dy = -1
110
+ end
111
+ idx = Room::vector_to_dir(dx, dy)
112
+ dir += " #{Room::DIRECTIONS[idx]}"
113
+ x += dx
114
+ y += dy
115
+ end
116
+
117
+ @f.print " dir #{dir} nolink"
118
+ end
119
+
120
+ def room(r)
121
+ return if @rooms.include?(r) or r == nil
122
+ @rooms << r
123
+ tag = get_tag(r, r.name)
124
+
125
+ @f.puts
126
+ @f.print "room \"#{r.name}\" tag #{tag}"
127
+ if not @link.empty?
128
+ if @link[3]
129
+ nolink(@last_room, r)
130
+ else
131
+ directions(@link[0], @link[1], @link[2])
132
+ if @last_room and @link[1] != @last_room
133
+ tag = get_tag(@link[1], @link[1].name)
134
+ @f.print " from #{tag}"
135
+ end
136
+ if @link[0].exitAtext != 0
137
+ dir = EXIT_TEXT[@link[0].exitAtext]
138
+ @f.print " go #{dir}"
139
+ end
140
+
141
+ if @link[0].dir == Connection::AtoB
142
+ @f.print " oneway"
143
+ end
144
+
145
+ if @link[0].type == Connection::SPECIAL
146
+ @f.print " style special"
147
+ end
148
+
149
+ end
150
+ end
151
+ @f.print ";\n"
152
+ @last_room = r
153
+
154
+ objs = r.objects.split("\n")
155
+ objs.each { |obj|
156
+ tag = get_tag(obj, obj)
157
+ @f.puts "\titem \"#{obj}\" tag #{tag};"
158
+ }
159
+ tasks = r.tasks.split("\n")
160
+ tasks.each { |task|
161
+ tag = get_tag(task, task)
162
+ @f.puts "\ttask \"#{task}\" tag #{tag};"
163
+ }
164
+
165
+ r.exits.each { |c|
166
+ next if not c or @links.include?(c)
167
+ if c.roomA == c.roomB
168
+ # self-link
169
+ link(c)
170
+ next
171
+ end
172
+ if r == c.roomA
173
+ @link = [c, c.roomA, c.roomB]
174
+ room(c.roomB) # Recurse along this branch...
175
+ else
176
+ @link = [c, c.roomB, c.roomA]
177
+ room(c.roomA) # Recurse along this branch...
178
+ end
179
+ }
180
+ end
181
+
182
+ def sections
183
+ old_section = @map.section
184
+ @map.sections.each_with_index { |section, idx|
185
+ @f.puts
186
+ @f.puts '#' * 79
187
+ @f.puts
188
+ if section.name.to_s == ''
189
+ if @map.sections.size > 1
190
+ @f.puts "map \"Section #{idx+1}\";"
191
+ end
192
+ else
193
+ @f.puts "map \"#{section.name}\";"
194
+ end
195
+ @map.section = idx
196
+ @link = []
197
+ section.rooms.each { |r|
198
+ room(r)
199
+ @link << 'nolink'
200
+ }
201
+ section.connections.each { |c|
202
+ link(c)
203
+ }
204
+ }
205
+ @map.section = old_section
206
+ end
207
+
208
+ def header
209
+ @f.puts <<-"HEADER"
210
+ #
211
+ # IFM map for #{@map.name}
212
+ # Created by #{@map.creator}
213
+ # #{Time.now}
214
+ #
215
+ # Map created using the Interactive Fiction Mapper
216
+ # (C) 2005 - Gonzalo Garramuno
217
+ #
218
+
219
+ HEADER
220
+
221
+ if @map.name.to_s != ''
222
+ @f.puts "title \"#{@map.name}\";\n"
223
+ end
224
+
225
+ end
226
+
227
+
228
+ def export(file)
229
+ @f = File.open(file, 'w')
230
+ header
231
+ sections
232
+ @f.close
233
+ end
234
+
235
+ def initialize(map, file)
236
+ @link = nil
237
+ @links = []
238
+ @rooms = []
239
+ @last_room = nil
240
+ @tags = []
241
+ @elem = {}
242
+ @map = map
243
+ export(file)
244
+ end
245
+ end