Skip to content

Commit

Permalink
Fix so the game works again
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmire committed Feb 13, 2013
1 parent b9534c9 commit ae45420
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions app/javascripts/common/meta.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,28 @@ define 'meta', ->
typeof mixin[sk] is 'function' and
mixin[sk].__original__?
)
# console.log "}{ #{properMixinName}[#{sk}] }{ -> #{properBaseName}[#{tk}]"
# If a module has a function that contains _super, it has already been
# wrapped. The problem is that an attempt to mix it into this object
# will result in a double-wrapped function; plus, the original
# object's _super call will also most likely refer to the default _super
# function (which is an empty function). So, here we unwrap the function
# and re-wrap it in this context.
##console.log "}{ #{properMixinName}[#{sk}] }{ -> #{properBaseName}[#{tk}]"
base[tk] = _wrap(mixin[sk].__original__, _super[tk])
else if (
typeof mixin[sk] is 'function' and
_fnContainsSuper(mixin[sk]) and
typeof _super[tk] is 'function'
)
# console.log "{ #{properMixinName}[#{sk}] } -> #{properBaseName}[#{tk}]"
# if properBaseName is 'game.ticker' and tk is '_includeMixin'
# console.log _super[tk].toString()
# If base and the object we're mixing into the object both have a
# function with the same name, and the mixin's function contains a call
# to _super(), replace base's function with the mixin's function, but
# first wrap the mixin's function in another function that sets _super
# to the base function.
##console.log "{ #{properMixinName}[#{sk}] } -> #{properBaseName}[#{tk}]"
base[tk] = _wrap(mixin[sk], _super[tk])
else
# console.log "#{properMixinName}[#{sk}] -> #{properBaseName}[#{tk}]"
##console.log "#{properMixinName}[#{sk}] -> #{properBaseName}[#{tk}]"
base[tk] = mixin[sk]

# Call extended hook
Expand Down
2 changes: 1 addition & 1 deletion app/javascripts/game/collidable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define 'game.Collidable', ->
meta = require('meta')

# This assumes Mappable
Collidable = meta.def
Collidable = meta.def 'game.Collidable',
init: (args...) ->
@_super(args...)
@_initCollidableBounds()
Expand Down
2 changes: 1 addition & 1 deletion app/javascripts/game/filtered_object_matrix.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
define 'game.FilteredObjectMatrix', ->
meta = require('meta')

return meta.def
meta.def 'game.FilteredObjectMatrix'
without: (@exception) ->
return this

Expand Down
2 changes: 1 addition & 1 deletion app/javascripts/game/mappable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define 'game.Mappable', ->
meta = require('meta')

# This assumes assignable
Mappable = meta.def
Mappable = meta.def 'game.Mappable',
init: (@width, @height) ->
@_initMappableBounds()
@_initPrevMappableBounds()
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/app/game/collidable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/javascripts/app/game/filtered_object_matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
define('game.FilteredObjectMatrix', function() {
var meta;
meta = require('meta');
return meta.def({
return meta.def('game.FilteredObjectMatrix', {
without: function(exception) {
this.exception = exception;
return this;
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/app/game/mappable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae45420

Please sign in to comment.