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.
- data/HISTORY.txt +648 -627
- data/IFMapper.gemspec +29 -28
- data/IFMapper.rbw +31 -31
- data/TODO.txt +8 -7
- data/bin/IFMapper +31 -31
- data/docs/en/index.html +0 -0
- data/docs/en/start.html +3 -2
- data/docs/en/start.html~ +516 -0
- data/docs/es/index.html +0 -0
- data/docs/es/start.html +13 -14
- data/docs/es/start.html~ +1280 -0
- data/docs/images/IFMapper_main.gif +0 -0
- data/docs/images/automap.gif +0 -0
- data/docs/images/complex_connection.gif +0 -0
- data/docs/images/connection.gif +0 -0
- data/docs/images/connection_menu.gif +0 -0
- data/docs/images/room_description.gif +0 -0
- data/docs/images/room_small.gif +0 -0
- data/icons/copy.png +0 -0
- data/icons/cut.png +0 -0
- data/icons/filenew.png +0 -0
- data/icons/fileopen.png +0 -0
- data/icons/filesave.png +0 -0
- data/icons/filesaveas.png +0 -0
- data/icons/help.png +0 -0
- data/icons/kill.png +0 -0
- data/icons/nextpage.png +0 -0
- data/icons/paste.png +0 -0
- data/icons/prevpage.png +0 -0
- data/icons/printicon.png +0 -0
- data/icons/redo.png +0 -0
- data/icons/room_e.gif +0 -0
- data/icons/room_e.xpm +0 -0
- data/icons/room_n.gif +0 -0
- data/icons/room_n.xpm +0 -0
- data/icons/room_ne.gif +0 -0
- data/icons/room_ne.xpm +0 -0
- data/icons/room_nw.gif +0 -0
- data/icons/room_nw.xpm +0 -0
- data/icons/room_s.gif +0 -0
- data/icons/room_s.xpm +0 -0
- data/icons/room_se.gif +0 -0
- data/icons/room_se.xpm +0 -0
- data/icons/room_sw.gif +0 -0
- data/icons/room_sw.xpm +0 -0
- data/icons/room_w.gif +0 -0
- data/icons/room_w.xpm +0 -0
- data/icons/saveas.png +0 -0
- data/icons/undo.png +0 -0
- data/icons/winapp.png +0 -0
- data/icons/zoom.png +0 -0
- data/lib/IFMapper/AStar.rb +250 -250
- data/lib/IFMapper/Connection.rb +202 -202
- data/lib/IFMapper/FXAboutDialogBox.rb +32 -32
- data/lib/IFMapper/FXConnection.rb +364 -364
- data/lib/IFMapper/FXConnectionDialogBox.rb +124 -124
- data/lib/IFMapper/FXDCPostscript.rb +404 -404
- data/lib/IFMapper/FXDCPrint.rb +15 -15
- data/lib/IFMapper/FXItemList.rb +108 -0
- data/lib/IFMapper/FXMap.rb +2147 -2116
- data/lib/IFMapper/FXMapColorBox.rb +88 -88
- data/lib/IFMapper/FXMapDialogBox.rb +127 -127
- data/lib/IFMapper/FXMapFileDialog.rb +34 -34
- data/lib/IFMapper/FXMapperSettings.rb +206 -205
- data/lib/IFMapper/FXMapperWindow.rb +1592 -1571
- data/lib/IFMapper/FXPDFMapExporterOptionsDialogBox.rb +46 -0
- data/lib/IFMapper/FXRoom.rb +263 -263
- data/lib/IFMapper/FXRoomDialogBox.rb +159 -159
- data/lib/IFMapper/FXRoomList.rb +95 -95
- data/lib/IFMapper/FXSearchDialogBox.rb +51 -51
- data/lib/IFMapper/FXSection.rb +33 -33
- data/lib/IFMapper/FXSectionDialogBox.rb +38 -38
- data/lib/IFMapper/FXSpline.rb +52 -52
- data/lib/IFMapper/FXWarningBox.rb +51 -50
- data/lib/IFMapper/GUEReader.rb +445 -445
- data/lib/IFMapper/IFMReader.rb +584 -584
- data/lib/IFMapper/IFMWriter.rb +245 -227
- data/lib/IFMapper/Inform7Writer.rb +579 -573
- data/lib/IFMapper/InformReader.rb +478 -478
- data/lib/IFMapper/InformWriter.rb +364 -359
- data/lib/IFMapper/Map.rb +202 -200
- data/lib/IFMapper/MapPrinting.rb +162 -162
- data/lib/IFMapper/MapReader.rb +900 -900
- data/lib/IFMapper/PDFMapExporter.rb +526 -483
- data/lib/IFMapper/Room.rb +153 -151
- data/lib/IFMapper/Section.rb +234 -234
- data/lib/IFMapper/TADSReader.rb +474 -471
- data/lib/IFMapper/TADSWriter.rb +375 -370
- data/lib/IFMapper/TranscriptDialogBox.rb +0 -0
- data/lib/IFMapper/TranscriptReader.rb +1361 -1359
- data/lib/IFMapper/locales/en/Messages.rb +446 -435
- data/lib/IFMapper/locales/es/Messages.rb +451 -440
- data/lib/IFMapper/locales/es/Messages_iso-8859-1.rb +455 -440
- data/lib/IFMapper/locales/es/runme.sh +3 -3
- data/maps/A New Life.map b/data/maps/A New → Life.map +0 -0
- data/maps/AMFV.map +0 -0
- data/maps/AllRoads.map +0 -0
- data/maps/Aotearoa.map +0 -0
- data/maps/Bronze.map +0 -0
- data/maps/Bureaucracy.ifm +0 -0
- data/maps/Bureaucracy.map +0 -0
- data/maps/CityOfSecrets.map +0 -0
- data/maps/DDIV.map +0 -0
- data/maps/Following_A_Star.map +0 -0
- data/maps/Heated.map +0 -0
- data/maps/Heroine.map +0 -0
- data/maps/History Repeating.map b/data/maps/History → Repeating.map +0 -0
- data/maps/Hollywood_Hijinx.ifm +0 -0
- data/maps/Janitor.map +0 -0
- data/maps/Jigsaw.ifm +0 -0
- data/maps/Jigsaw.map +0 -0
- data/maps/LGOP.ifm +0 -0
- data/maps/Mercy.ifm +0 -0
- data/maps/Ninjas_Fate.map +0 -0
- data/maps/Pen_and_Paint.map +0 -0
- data/maps/Planetfall.ifm +0 -0
- data/maps/Planetfall.map +0 -0
- data/maps/Plundered_Hearts.ifm +0 -0
- data/maps/QuietEvening.map +0 -0
- data/maps/Ralph.ifm +0 -0
- data/maps/Reliques_of_Tolti_Alph.map +0 -0
- data/maps/Revolution.map +0 -0
- data/maps/Robots_of_Dawn.ifm +0 -0
- data/maps/SavoirFare.map +0 -0
- data/maps/Seastalker.ifm +0 -0
- data/maps/Seastalker.map +0 -0
- data/maps/Sherlock.ifm +0 -0
- data/maps/SoFar.ifm +0 -0
- data/maps/Starcross.ifm +0 -0
- data/maps/Suspended.ifm +0 -0
- data/maps/Tangle.map +0 -0
- data/maps/The_Lost_Sheep.map +0 -0
- data/maps/Unforgotten.map +0 -0
- data/maps/Warbler's Nest.map +0 -0
- data/maps/Warbler's_Nest.map +0 -0
- data/maps/Westminster_Abbey.map +0 -0
- data/maps/WinterWonderland.map +0 -0
- data/maps/Wishbringer.ifm +0 -0
- data/maps/Wishbringer2.ifm +0 -0
- data/maps/Zork1.ifm +0 -0
- data/maps/Zork2.ifm +0 -0
- data/maps/Zork3.ifm +0 -0
- data/maps/Zork_Zero.ifm +0 -0
- data/maps/anchor.ifm +0 -0
- data/maps/anchor.map +0 -0
- data/maps/atrox.ifm +0 -0
- data/maps/awaken.ifm +0 -0
- data/maps/babel.ifm +0 -0
- data/maps/balances.map +0 -0
- data/maps/ballerina.map +0 -0
- data/maps/bear.map +0 -0
- data/maps/bluechairs.map +0 -0
- data/maps/break_in.map +0 -0
- data/maps/bse.ifm +0 -0
- data/maps/building.map +0 -0
- data/maps/change.ifm +0 -0
- data/maps/christminster.map +0 -0
- data/maps/curses.ifm +0 -0
- data/maps/curves.ifm +0 -0
- data/maps/deadline.map +0 -0
- data/maps/delusions.map +0 -0
- data/maps/devours.map +0 -0
- data/maps/distress.map +0 -0
- data/maps/djinni.map +0 -0
- data/maps/dreamhold.map +0 -0
- data/maps/drift3.map +0 -0
- data/maps/eas.map +0 -0
- data/maps/eas2.map +0 -0
- data/maps/eas3.map +0 -0
- data/maps/edifice.ifm +0 -0
- data/maps/fallacy.map +0 -0
- data/maps/frozen.ifm +0 -0
- data/maps/gamlet.map +0 -0
- data/maps/glow.ifm +0 -0
- data/maps/guilty_bastards.map +0 -0
- data/maps/heist.map +0 -0
- data/maps/heroes.map +0 -0
- data/maps/inhumane.map +0 -0
- data/maps/kaged.map +0 -0
- data/maps/library.ifm +0 -0
- data/maps/lurkinghorror.map +0 -0
- data/maps/metamorphoses.map +0 -0
- data/maps/mindelec.ifm +0 -0
- data/maps/minster.ifm +0 -0
- data/maps/mite.map +0 -0
- data/maps/moonmist.map +0 -0
- data/maps/muldoon_legacy.map +0 -0
- data/maps/muse.ifm +0 -0
- data/maps/paperchase.ifm +0 -0
- data/maps/party.map +0 -0
- data/maps/pawn.map +0 -0
- data/maps/photograph.map +0 -0
- data/maps/pkgirl.map +0 -0
- data/maps/pytho.map +0 -0
- data/maps/risorgimento.map +0 -0
- data/maps/sherbet.map +0 -0
- data/maps/simple.map +0 -0
- data/maps/slouch.map +0 -0
- data/maps/space_st.ifm +0 -0
- data/maps/splashdown.map +0 -0
- data/maps/spring.map +0 -0
- data/maps/squarecircle.map +0 -0
- data/maps/stationfall.ifm +0 -0
- data/maps/theatre.ifm +0 -0
- data/maps/toonesia.ifm +0 -0
- data/maps/tortoise.ifm +0 -0
- data/maps/trinity.map +0 -0
- data/maps/vespers.map +0 -0
- data/maps/vgame.ifm +0 -0
- data/maps/wasp.map +0 -0
- data/maps/weather.ifm +0 -0
- data/maps/windhall.ifm +0 -0
- data/maps/worlds.map +0 -0
- data/maps/xtcontest.map +0 -0
- data/maps/zdungeon.map +0 -0
- data/maps/zebulon.ifm +0 -0
- data/maps/zerosum.map +0 -0
- metadata +226 -183
data/lib/IFMapper/Connection.rb
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
# Class used to represent a connection between one
|
|
4
|
-
# room and another
|
|
5
|
-
#
|
|
6
|
-
class Connection
|
|
7
|
-
attr_accessor :type
|
|
8
|
-
attr_reader :dir
|
|
9
|
-
attr_accessor :room
|
|
10
|
-
attr_accessor :exitText
|
|
11
|
-
|
|
12
|
-
# Type constants
|
|
13
|
-
FREE = 0
|
|
14
|
-
LOCKED_DOOR = 1
|
|
15
|
-
SPECIAL = 2
|
|
16
|
-
CLOSED_DOOR = 3
|
|
17
|
-
|
|
18
|
-
# Direction constants
|
|
19
|
-
BOTH = 0
|
|
20
|
-
AtoB = 1
|
|
21
|
-
BtoA = 2 # NO LONGER USED.
|
|
22
|
-
|
|
23
|
-
# Text near connection (to indicate other dir)
|
|
24
|
-
EXIT_TEXT = [
|
|
25
|
-
'',
|
|
26
|
-
'U',
|
|
27
|
-
'D',
|
|
28
|
-
'I',
|
|
29
|
-
'O'
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
def dir=(x)
|
|
33
|
-
if x == BtoA
|
|
34
|
-
@dir = AtoB
|
|
35
|
-
flip
|
|
36
|
-
else
|
|
37
|
-
@dir = x
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def roomA=(x)
|
|
42
|
-
@room[0] = x
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def roomB=(x)
|
|
46
|
-
@room[1] = x
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def roomA
|
|
50
|
-
return @room[0]
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def roomB
|
|
54
|
-
return @room[1]
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def exitAtext=(x)
|
|
58
|
-
@exitText[0] = x
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def exitBtext=(x)
|
|
62
|
-
@exitText[1] = x
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def exitAtext
|
|
66
|
-
return @exitText[0]
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def exitBtext
|
|
70
|
-
return @exitText[1]
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def marshal_load(vars)
|
|
74
|
-
if vars[2].kind_of?(Array)
|
|
75
|
-
@type, @dir, @room, @exitText = vars
|
|
76
|
-
else
|
|
77
|
-
@type = vars[0]
|
|
78
|
-
@dir = vars[1]
|
|
79
|
-
@room = [vars[2], vars[3]]
|
|
80
|
-
@exitText = [vars[4], vars[5]]
|
|
81
|
-
if @dir == BtoA
|
|
82
|
-
@dir = AtoB
|
|
83
|
-
flip
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def marshal_dump
|
|
89
|
-
[ @type, @dir, @room, @exitText ]
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def initialize( roomA, roomB, dir = BOTH, type = FREE )
|
|
93
|
-
@room = []
|
|
94
|
-
@room[0] = roomA
|
|
95
|
-
@room[1] = roomB
|
|
96
|
-
@dir = dir
|
|
97
|
-
@type = type
|
|
98
|
-
@exitText = [0, 0]
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
#
|
|
102
|
-
# Given a room, return the opposite room in the connection.
|
|
103
|
-
# If room passed is not present in connection, raise an exception.
|
|
104
|
-
#
|
|
105
|
-
def opposite(room)
|
|
106
|
-
idx = self.index(room)
|
|
107
|
-
raise "Room #{room} not part of connection #{c}" unless idx
|
|
108
|
-
return @room[idx ^ 1]
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
#
|
|
112
|
-
# Given a room, return the index of that room in the room[] array
|
|
113
|
-
# If room is not present in connection, return nil.
|
|
114
|
-
#
|
|
115
|
-
def index(room)
|
|
116
|
-
@room.each_with_index { |r, idx| return idx if r == room }
|
|
117
|
-
return nil
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
# Flip A and B rooms. This is mainly used to make a oneway AtoB
|
|
122
|
-
# connection become a BtoA connection.
|
|
123
|
-
#
|
|
124
|
-
def flip
|
|
125
|
-
return unless @room[1]
|
|
126
|
-
@room.reverse!
|
|
127
|
-
@exitText.reverse!
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
#
|
|
131
|
-
# Return the connected direction index for each room
|
|
132
|
-
#
|
|
133
|
-
def dirs
|
|
134
|
-
dirA = @room[0].exits.index(self)
|
|
135
|
-
if @room[1]
|
|
136
|
-
dirB = @room[1].exits.rindex(self)
|
|
137
|
-
else
|
|
138
|
-
dirB = nil
|
|
139
|
-
end
|
|
140
|
-
return [dirA, dirB]
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
#
|
|
144
|
-
# Return true if connection is a stub exit (ie. an exit leading nowhere)
|
|
145
|
-
#
|
|
146
|
-
def stub?
|
|
147
|
-
return true unless @room[1]
|
|
148
|
-
return false
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
#
|
|
152
|
-
# Return true if connection is a self-looping connection
|
|
153
|
-
#
|
|
154
|
-
def loop?
|
|
155
|
-
return false if @room[0] != @room[1]
|
|
156
|
-
dirA, dirB = dirs
|
|
157
|
-
return true if dirA == dirB
|
|
158
|
-
return false
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
#
|
|
162
|
-
# Return true if connection is a door
|
|
163
|
-
#
|
|
164
|
-
def door?
|
|
165
|
-
return true if @type == CLOSED_DOOR or @type == LOCKED_DOOR
|
|
166
|
-
return false
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
#
|
|
170
|
-
# For debugging purposes, print ourselves nicely
|
|
171
|
-
#
|
|
172
|
-
def to_s
|
|
173
|
-
dirA = dirB = ''
|
|
174
|
-
a = @room[0]? @room[0].name : 'nil'
|
|
175
|
-
b = @room[1]? @room[1].name : 'nil'
|
|
176
|
-
if @exitText[0] > 0
|
|
177
|
-
dirA = EXIT_TEXT[@exitText[0]]
|
|
178
|
-
else
|
|
179
|
-
if @room[0]
|
|
180
|
-
idx = @room[0].exits.index(self)
|
|
181
|
-
dirA = Room::DIRECTIONS[idx] if idx
|
|
182
|
-
dirA = dirA.upcase
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
if @exitText[1] > 0
|
|
186
|
-
dirB = EXIT_TEXT[@exitText[1]]
|
|
187
|
-
else
|
|
188
|
-
if @room[1]
|
|
189
|
-
idx = @room[1].exits.rindex(self)
|
|
190
|
-
dirB = Room::DIRECTIONS[idx] if idx
|
|
191
|
-
dirB = dirB.upcase
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
if @dir == AtoB
|
|
195
|
-
sym = ' --> '
|
|
196
|
-
else
|
|
197
|
-
sym = ' <-> '
|
|
198
|
-
end
|
|
199
|
-
"#{a} #{dirA}#{sym}#{b} #{dirB}"
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
1
|
+
|
|
2
|
+
#
|
|
3
|
+
# Class used to represent a connection between one
|
|
4
|
+
# room and another
|
|
5
|
+
#
|
|
6
|
+
class Connection
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
attr_reader :dir
|
|
9
|
+
attr_accessor :room
|
|
10
|
+
attr_accessor :exitText
|
|
11
|
+
|
|
12
|
+
# Type constants
|
|
13
|
+
FREE = 0
|
|
14
|
+
LOCKED_DOOR = 1
|
|
15
|
+
SPECIAL = 2
|
|
16
|
+
CLOSED_DOOR = 3
|
|
17
|
+
|
|
18
|
+
# Direction constants
|
|
19
|
+
BOTH = 0
|
|
20
|
+
AtoB = 1
|
|
21
|
+
BtoA = 2 # NO LONGER USED.
|
|
22
|
+
|
|
23
|
+
# Text near connection (to indicate other dir)
|
|
24
|
+
EXIT_TEXT = [
|
|
25
|
+
'',
|
|
26
|
+
'U',
|
|
27
|
+
'D',
|
|
28
|
+
'I',
|
|
29
|
+
'O'
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
def dir=(x)
|
|
33
|
+
if x == BtoA
|
|
34
|
+
@dir = AtoB
|
|
35
|
+
flip
|
|
36
|
+
else
|
|
37
|
+
@dir = x
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def roomA=(x)
|
|
42
|
+
@room[0] = x
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def roomB=(x)
|
|
46
|
+
@room[1] = x
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def roomA
|
|
50
|
+
return @room[0]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def roomB
|
|
54
|
+
return @room[1]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def exitAtext=(x)
|
|
58
|
+
@exitText[0] = x
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def exitBtext=(x)
|
|
62
|
+
@exitText[1] = x
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def exitAtext
|
|
66
|
+
return @exitText[0]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def exitBtext
|
|
70
|
+
return @exitText[1]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def marshal_load(vars)
|
|
74
|
+
if vars[2].kind_of?(Array)
|
|
75
|
+
@type, @dir, @room, @exitText = vars
|
|
76
|
+
else
|
|
77
|
+
@type = vars[0]
|
|
78
|
+
@dir = vars[1]
|
|
79
|
+
@room = [vars[2], vars[3]]
|
|
80
|
+
@exitText = [vars[4], vars[5]]
|
|
81
|
+
if @dir == BtoA
|
|
82
|
+
@dir = AtoB
|
|
83
|
+
flip
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def marshal_dump
|
|
89
|
+
[ @type, @dir, @room, @exitText ]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def initialize( roomA, roomB, dir = BOTH, type = FREE )
|
|
93
|
+
@room = []
|
|
94
|
+
@room[0] = roomA
|
|
95
|
+
@room[1] = roomB
|
|
96
|
+
@dir = dir
|
|
97
|
+
@type = type
|
|
98
|
+
@exitText = [0, 0]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
#
|
|
102
|
+
# Given a room, return the opposite room in the connection.
|
|
103
|
+
# If room passed is not present in connection, raise an exception.
|
|
104
|
+
#
|
|
105
|
+
def opposite(room)
|
|
106
|
+
idx = self.index(room)
|
|
107
|
+
raise "Room #{room} not part of connection #{c}" unless idx
|
|
108
|
+
return @room[idx ^ 1]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
#
|
|
112
|
+
# Given a room, return the index of that room in the room[] array
|
|
113
|
+
# If room is not present in connection, return nil.
|
|
114
|
+
#
|
|
115
|
+
def index(room)
|
|
116
|
+
@room.each_with_index { |r, idx| return idx if r == room }
|
|
117
|
+
return nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
#
|
|
121
|
+
# Flip A and B rooms. This is mainly used to make a oneway AtoB
|
|
122
|
+
# connection become a BtoA connection.
|
|
123
|
+
#
|
|
124
|
+
def flip
|
|
125
|
+
return unless @room[1]
|
|
126
|
+
@room.reverse!
|
|
127
|
+
@exitText.reverse!
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
#
|
|
131
|
+
# Return the connected direction index for each room
|
|
132
|
+
#
|
|
133
|
+
def dirs
|
|
134
|
+
dirA = @room[0].exits.index(self)
|
|
135
|
+
if @room[1]
|
|
136
|
+
dirB = @room[1].exits.rindex(self)
|
|
137
|
+
else
|
|
138
|
+
dirB = nil
|
|
139
|
+
end
|
|
140
|
+
return [dirA, dirB]
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
#
|
|
144
|
+
# Return true if connection is a stub exit (ie. an exit leading nowhere)
|
|
145
|
+
#
|
|
146
|
+
def stub?
|
|
147
|
+
return true unless @room[1]
|
|
148
|
+
return false
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
#
|
|
152
|
+
# Return true if connection is a self-looping connection
|
|
153
|
+
#
|
|
154
|
+
def loop?
|
|
155
|
+
return false if @room[0] != @room[1]
|
|
156
|
+
dirA, dirB = dirs
|
|
157
|
+
return true if dirA == dirB
|
|
158
|
+
return false
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
#
|
|
162
|
+
# Return true if connection is a door
|
|
163
|
+
#
|
|
164
|
+
def door?
|
|
165
|
+
return true if @type == CLOSED_DOOR or @type == LOCKED_DOOR
|
|
166
|
+
return false
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
#
|
|
170
|
+
# For debugging purposes, print ourselves nicely
|
|
171
|
+
#
|
|
172
|
+
def to_s
|
|
173
|
+
dirA = dirB = ''
|
|
174
|
+
a = @room[0]? @room[0].name : 'nil'
|
|
175
|
+
b = @room[1]? @room[1].name : 'nil'
|
|
176
|
+
if @exitText[0] > 0
|
|
177
|
+
dirA = EXIT_TEXT[@exitText[0]]
|
|
178
|
+
else
|
|
179
|
+
if @room[0]
|
|
180
|
+
idx = @room[0].exits.index(self)
|
|
181
|
+
dirA = Room::DIRECTIONS[idx] if idx
|
|
182
|
+
dirA = dirA.upcase
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
if @exitText[1] > 0
|
|
186
|
+
dirB = EXIT_TEXT[@exitText[1]]
|
|
187
|
+
else
|
|
188
|
+
if @room[1]
|
|
189
|
+
idx = @room[1].exits.rindex(self)
|
|
190
|
+
dirB = Room::DIRECTIONS[idx] if idx
|
|
191
|
+
dirB = dirB.upcase
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
if @dir == AtoB
|
|
195
|
+
sym = ' --> '
|
|
196
|
+
else
|
|
197
|
+
sym = ' <-> '
|
|
198
|
+
end
|
|
199
|
+
"#{a} #{dirA}#{sym}#{b} #{dirB}"
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class FXAboutDialogBox < FXDialogBox
|
|
4
|
-
|
|
5
|
-
def initialize(parent, title, text)
|
|
6
|
-
decor = DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE
|
|
7
|
-
|
|
8
|
-
super( parent, title, decor, 40, 40, 0, 0 )
|
|
9
|
-
mainFrame = FXVerticalFrame.new(self,
|
|
10
|
-
FRAME_SUNKEN|FRAME_THICK|
|
|
11
|
-
LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
|
12
|
-
|
|
13
|
-
frame = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
|
|
14
|
-
|
|
15
|
-
FXLabel.new(frame, text, nil, 0, LAYOUT_FILL_ROW)
|
|
16
|
-
|
|
17
|
-
# c = FXText.new(frame, nil, 0, LAYOUT_FILL_ROW)
|
|
18
|
-
# c.visibleRows = 10
|
|
19
|
-
# c.visibleColumns = 80
|
|
20
|
-
# c.editable = false
|
|
21
|
-
# c.text = text
|
|
22
|
-
|
|
23
|
-
buttons = FXHorizontalFrame.new(mainFrame,
|
|
24
|
-
LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|
|
|
25
|
-
PACK_UNIFORM_WIDTH)
|
|
26
|
-
# Accept
|
|
27
|
-
FXButton.new(buttons, "&Super!", nil, self, FXDialogBox::ID_ACCEPT,
|
|
28
|
-
FRAME_RAISED|LAYOUT_FILL_X|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
|
|
29
|
-
|
|
30
|
-
create
|
|
31
|
-
end
|
|
32
|
-
end
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class FXAboutDialogBox < FXDialogBox
|
|
4
|
+
|
|
5
|
+
def initialize(parent, title, text)
|
|
6
|
+
decor = DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE
|
|
7
|
+
|
|
8
|
+
super( parent, title, decor, 40, 40, 0, 0 )
|
|
9
|
+
mainFrame = FXVerticalFrame.new(self,
|
|
10
|
+
FRAME_SUNKEN|FRAME_THICK|
|
|
11
|
+
LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
|
12
|
+
|
|
13
|
+
frame = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
|
|
14
|
+
|
|
15
|
+
FXLabel.new(frame, text, nil, 0, LAYOUT_FILL_ROW)
|
|
16
|
+
|
|
17
|
+
# c = FXText.new(frame, nil, 0, LAYOUT_FILL_ROW)
|
|
18
|
+
# c.visibleRows = 10
|
|
19
|
+
# c.visibleColumns = 80
|
|
20
|
+
# c.editable = false
|
|
21
|
+
# c.text = text
|
|
22
|
+
|
|
23
|
+
buttons = FXHorizontalFrame.new(mainFrame,
|
|
24
|
+
LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|
|
|
25
|
+
PACK_UNIFORM_WIDTH)
|
|
26
|
+
# Accept
|
|
27
|
+
FXButton.new(buttons, "&Super!", nil, self, FXDialogBox::ID_ACCEPT,
|
|
28
|
+
FRAME_RAISED|LAYOUT_FILL_X|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
|
|
29
|
+
|
|
30
|
+
create
|
|
31
|
+
end
|
|
32
|
+
end
|