indexing description: "[ XML processors for nodes. ]" date: "$Date$" revision: "$Revision$" class EM_GOOF_LOADER_LEVEL_NODE_PROCESSOR inherit EM_GOOF_LOADER_NODE_PROCESSOR create make feature -- Access Name: STRING is "level" -- Name of node to process. Mandatory_attributes: ARRAY [STRING] is -- Table of mandatory attributes. once Result := << "background","screen_width","screen_height","level_width","level_height" >> -- Result := << "screen_x","screen_y","screen_width","screen_height","level_x","level_y","level_width","level_height" >> Result.compare_objects end feature -- Basic operations process is -- Process node. local level_position: EM_VECTOR_2D level_size: EM_VECTOR_2D screen_position: EM_VECTOR_2D screen_size: EM_VECTOR_2D speed: DOUBLE collision_set_no: INTEGER movement_check: INTEGER do if not has_attribute ("background") then set_error (Mandatory_attribute_missing, << "background" >>) elseif not has_attribute ("screen_width") then set_error (Mandatory_attribute_missing, << "screen_width" >>) elseif not has_attribute ("screen_height") then set_error (Mandatory_attribute_missing, << "screen_height" >>) elseif not has_attribute ("level_width") then set_error (Mandatory_attribute_missing, << "level_width" >>) elseif not has_attribute ("level_height") then set_error (Mandatory_attribute_missing, << "level_height" >>) elseif not attribute("screen_width").is_double then set_error (Non_numeric_argument, << "screen_width" >>) elseif not attribute("screen_height").is_double then set_error (Non_numeric_argument, << "screen_height" >>) elseif not attribute("level_width").is_double then set_error (Non_numeric_argument, << "level_width" >>) elseif not attribute("level_height").is_double then set_error (Non_numeric_argument, << "level_height" >>) else create level_size.make(attribute("level_width").to_double,attribute("level_height").to_double) create level_position.make(0,0) if has_attribute("level_x") then if attribute("level_x").is_double then level_position.set_x(attribute("level_x").to_double) else set_error (Non_numeric_argument, << "level_x" >>) end end if has_attribute("level_y") then if attribute("level_y").is_double then level_position.set_y(attribute("level_y").to_double) else set_error (Non_numeric_argument, << "level_y" >>) end end create screen_size.make(attribute("screen_width").to_double,attribute("screen_height").to_double) create screen_position.make(0,0) if has_attribute("screen_x") then if attribute("screen_x").is_double then screen_position.set_x(attribute("screen_x").to_double) else set_error (Non_numeric_argument, << "screen_x" >>) end end if has_attribute("screen_y") then if attribute("screen_y").is_double then screen_position.set_y(attribute("screen_y").to_double) else set_error (Non_numeric_argument, << "screen_y" >>) end end if has_attribute("speed") then if attribute("speed").is_double then speed := attribute("speed").to_double else set_error (Non_numeric_argument, << "speed" >>) end else speed := 10 end if has_attribute("collision_set_no") then if attribute("collision_set_no").is_integer then collision_set_no := attribute("collision_set_no").to_integer else set_error (Non_numeric_argument, << "collision_set_no" >>) end else collision_set_no := 10 end if has_attribute("movement_check") then if attribute("movement_check").is_integer then movement_check := attribute("movement_check").to_integer else set_error (Non_numeric_argument, << "movement_check" >>) end else movement_check := 0 end level_factory.create_level(attribute("background"),level_size,level_position,screen_size,screen_position,speed,collision_set_no,movement_check) process_subnodes end end end