[MacRuby-devel] require [was: [ANN] The Flying Camera (game)]

Thomas R. Koll info at ananasblau.com
Fri Dec 17 02:09:23 PST 2010




Am 16.12.2010 um 01:58 schrieb Matt Aimonetti:

> FYI I'm getting a few error messages:
> 
> unknown: warning: already initialized constant MIN_SPEED
> unknown: warning: already initialized constant MAX_SPEED
> unknown: warning: already initialized constant MAX_TURN
> unknown: warning: already initialized constant SPEED_FACTOR


That's because I have to require some files more than once
as e.g. the Visibility class doesn't seem to be loaded
early enough in the rb_main. Thus I have to load it from both,
e.g. Enemy and then rb_main loads it again causing this error.

What didn't help was putting lib and game_items in the $LOAD_PATH
$LOAD_PATH << File.join(dir_path, 'lib') # doesn't work

How's everyone else solving this? Requiring every file manually
in rb_main?

At the end I solved my problem with "unless const_defined?('MIN_SPEED')"
but I'm not sure if I'm happy with this.

I think I saw a require_once popping up in ruby 1.9.2, or am I wrong?

ciao, tom

PS: New version of the game coming Sunday. With 100% more fun :|



More information about the MacRuby-devel mailing list