Commits

Anonymous committed 27b879d

adding missing version function to generated javascript ProtocolObjectFactory

  • Participants
  • Parent commits 7ac2ced

Comments (0)

Files changed (2)

File maven/protocol-generator-plugin/src/main/scripts/generate_source.rb

         factory_file_name = "#{new_output_dir}/ProtocolObjectFactory.js"
         File.open(factory_file_name, 'w') do |factory_file|
           factory_file.write(JavaScriptOut.file_header(package))
-          JavaScriptOut.new(factory_file,false).object_factory(structs)
+          JavaScriptOut.new(factory_file,false).object_factory(structs,version)
           factory_file.write(JavaScriptOut.file_footer(package))
         end
         puts "Wrote #{factory_file_name}" unless $quiet

File maven/protocol-generator-plugin/src/main/scripts/javascript_generator.rb

     end
   end
   
-  def object_factory(structs)
+  def object_factory(structs, version)
     wi("#{$javascript_namespace}.ProtocolObjectFactory = {};\n")
+    
+    wi("#{$javascript_namespace}.ProtocolObjectFactory.version = function() {")
+       wi("return #{version};",1)
+    wi("}")
+       
     wi("#{$javascript_namespace}.ProtocolObjectFactory.create = function(classId, gameData) {")
     wi("var protocolObject;",1)
     wi("switch(classId) {",1)