ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/preprocess
Revision: 1.27
Committed: Mon May 7 04:21:11 2007 UTC (17 years ago) by root
Branch: MAIN
Changes since 1.26: +2 -0 lines
Log Message:
some more structure optimisations saving lots of code

File Contents

# Content
1 #!/opt/bin/perl
2
3 my %ARG = @ARGV;
4
5 use List::Util;
6
7 # todo: gather dynamically
8 my @kw = qw(
9 no_pass
10 walk_on
11 walk_off
12 fly_on
13 fly_off
14 flying
15
16 attack_skill
17 ranged_skill
18
19 ac
20 activate_on_push
21 activate_on_release
22 alive
23 anim_speed
24 animation
25 applied
26 arch
27 armour
28 attach
29 attack_movement
30 attacktype
31 auto_apply
32 been_applied
33 berserk
34 blocksview
35 body_range
36 body_arm
37 body_torso
38 body_head
39 body_neck
40 body_skill
41 body_finger
42 body_shoulder
43 body_foot
44 body_hand
45 body_wrist
46 body_waist
47 body_shield
48 body_combat
49 can_apply
50 can_cast_spell
51 can_roll
52 can_see_in_dark
53 can_use_armour
54 can_use_bow
55 can_use_horn
56 can_use_range
57 can_use_ring
58 can_use_rod
59 can_use_scroll
60 can_use_shield
61 can_use_skill
62 can_use_wand
63 can_use_weapon
64 carrying
65 casting_time
66 cha
67 changing
68 client_type
69 con
70 confused
71 connected
72 container
73 cursed
74 custom_name
75 dam
76 dam_modifier
77 damned
78 destroy_on_death
79 dex
80 direction
81 duration
82 duration_modifier
83 editable
84 editor_folder
85 elevation
86 end
87 endlore
88 endmsg
89 exp
90 expmul
91 face
92 food
93 friendly
94 gen_sp_armour
95 generator
96 glow_radius
97 grace
98 has_ready_bow
99 has_ready_scroll
100 has_ready_skill
101 has_ready_weapon
102 has_ready_range
103 hitback
104 hp
105 identified
106 immune
107 inherit
108 int
109 inv_locked
110 invisible
111 is_animated
112 is_blind
113 is_buildable
114 is_cauldron
115 is_dust
116 is_floor
117 is_hilly
118 is_lightable
119 is_thrown
120 is_turnable
121 is_used_up
122 is_water
123 is_wooded
124 item_power
125 known_cursed
126 known_magical
127 last_eat
128 last_grace
129 last_heal
130 last_sp
131 level
132 lifesave
133 lore
134 luck
135 magic
136 make_invisible
137 material
138 materialname
139 maxgrace
140 maxhp
141 maxsp
142 monster
143 more
144 move_allow
145 move_block
146 move_off
147 move_on
148 move_slow
149 move_slow_penalty
150 move_state
151 move_type
152 msg
153 name
154 name_pl
155 neutral
156 no_attack
157 no_damage
158 no_drop
159 no_fix_player
160 no_magic
161 no_pick
162 no_skill_ident
163 no_steal
164 no_strength
165 nrof
166 obj_original
167 object
168 oid
169 one_hit
170 only_attack
171 other_arch
172 overlay_floor
173 path_attuned
174 path_denied
175 path_repelled
176 perm_exp
177 pick_up
178 player_sold
179 pow
180 precious
181 protected
182 race
183 random_move
184 random_movement
185 randomitems
186 range
187 range_modifier
188 reflect_missile
189 reflect_spell
190 reflecting
191 resist_acid
192 resist_blind
193 resist_cancellation
194 resist_chaos
195 resist_cold
196 resist_confusion
197 resist_counterspell
198 resist_death
199 resist_deplete
200 resist_disease
201 resist_drain
202 resist_electricity
203 resist_fear
204 resist_fire
205 resist_ghosthit
206 resist_godpower
207 resist_holyword
208 resist_internal
209 resist_life_stealing
210 resist_magic
211 resist_paralyze
212 resist_physical
213 resist_poison
214 resist_slow
215 resist_turn_undead
216 resist_weaponmagic
217 run_away
218 scared
219 see_anywhere
220 see_invisible
221 skill
222 slaying
223 sleep
224 slow_move
225 smoothlevel
226 sp
227 speed
228 speed_left
229 splitting
230 stand_still
231 startequip
232 state
233 stealth
234 str
235 subtype
236 tear_down
237 title
238 tooltype
239 treasure_env
240 type
241 unaggressive
242 undead
243 unique
244 unpaid
245 use_content_on_gen
246 uuid
247 value
248 vulnerable
249 was_wiz
250 wc
251 weapontype
252 weight
253 will_apply
254 wis
255 wiz
256 x
257 xrays
258 y
259
260 maplore
261 endmaplore
262 enter_x
263 enter_y
264 width
265 height
266 reset_timeout
267 reset_time
268 swap_time
269 difficulty
270 darkness
271 fixed_resettime
272 per_player
273 per_party
274 region
275 shopitems
276 shopgreed
277 shopmin
278 shopmax
279 shoprace
280 outdoor
281 tile_path_1
282 tile_path_2
283 tile_path_3
284 tile_path_4
285
286 file_format_version
287
288 temp
289 pressure
290 humid
291 windspeed
292 winddir
293 sky
294
295 map
296 savebed_map
297 bed_x
298 bed_y
299 password
300 bowtype
301 petmode
302 gen_hp
303 gen_sp
304 gen_grace
305 listening
306 peaceful
307 digestion
308 pickup
309 outputs_sync
310 outputs_count
311 usekeys
312 unapply
313 weapon_sp
314 lev_array
315 endplst
316
317 visibility
318 magicmap
319
320 match
321 parent
322 longname
323 jail_map
324 jail_x
325 jail_y
326 fallback
327 nomore
328
329 chance
330 mods
331 diff
332 saves
333 description
334 density
335 damage
336
337 anim
338 mina
339 facings
340 player
341
342 allowed
343 keycode
344 trans
345 yield
346 ingred
347 cauldron
348
349 Str
350 Dex
351 Con
352 Wis
353 Cha
354 Int
355 Pow
356
357 treasure
358 treasureone
359 list
360 change_name
361 change_title
362 change_slaying
363 yes
364 no
365 );
366
367 open GPERF, "|-", "exec $ARG{GPERF} -m50 >kw_hash.h"
368 or die "$ARGV{GPERF}: $!";
369
370 print GPERF <<EOF;
371 %language=C++
372 %enum
373 %define class-name kw_lex
374 %define lookup-function-name match
375 %struct-type
376 %compare-strncmp
377 %delimiters=,
378 struct keyword_idx { const char *name; enum keyword index; };
379 %%
380 EOF
381
382 for (@kw) {
383 printf GPERF "%s,%s\n", $_, "KW_$_";
384 }
385
386 print GPERF <<EOF;
387 %%
388 extern const char *const keyword_str [] = {
389 "<EOF>",
390 "<ERROR>",
391 EOF
392
393 for (@kw) {
394 printf GPERF " \"%s\",\n", $_;
395 }
396
397 print GPERF "};\n";
398
399 printf GPERF "\nextern const unsigned char keyword_len [] = { 5, 7, %s };\n\n",
400 join ", ", map length, @kw;
401
402 close GPERF
403 or die "$ARG{GPERF}: failed to run";
404
405 open KW, ">", "keyword.h";
406
407 print KW <<EOF;
408 #ifndef KW_H__
409 #define KW_H__
410
411 enum keyword {
412 KW_NULL = 0,
413 KW_EOF = 0,
414 KW_ERROR,
415 EOF
416
417 for (@kw) {
418 printf KW " %s,\n", "KW_$_",
419 }
420
421 print KW <<EOF;
422 NUM_KEYWORD,
423 };
424
425 extern const char *const keyword_str [];
426 extern const unsigned char keyword_len [];
427
428 EOF
429
430 printf KW "#define MAX_KEYWORD_LEN %d\n", List::Util::max map length, @kw;
431
432 print KW <<EOF;
433
434 #endif
435
436 EOF
437