indexing description: "Message containing server options" date: "$Date$" revision: "$Revision$" class BB_MP_OPTIONS inherit EM_NET_2PC_EVENT_OBJECT redefine make_set_type end create {BB_MP_OBJECT_TYPES} make_set_type feature {NONE} -- Initialisation make_set_type (a_type_id: INTEGER) is -- Set `create_type_id' to `a_type_id'. do Precursor (a_type_id) -- set remote_item_effect_mode to a default value remote_item_effect_mode := "Random" start_level := "Random" number_of_games_to_win := 3 difficulty := "Insane" level_set := "Full" end feature -- Status report score_for_enemy_block: INTEGER remote_item_effect_chance: INTEGER remote_item_effect_mode: STRING start_level: STRING number_of_games_to_win: INTEGER difficulty: STRING level_set: STRING feature -- Status setting set_score_for_enemy_block (an_integer: INTEGER) is -- set `score_for_enemy_block' do score_for_enemy_block := an_integer ensure value_set: score_for_enemy_block = an_integer end set_remote_item_effect_chance (an_integer: INTEGER) is -- set `remote_item_effect_chance' do remote_item_effect_chance := an_integer ensure value_set: remote_item_effect_chance = an_integer end set_remote_item_effect_mode (a_string: STRING) is -- set `remote_item_effect_mode' do remote_item_effect_mode := a_string.out ensure value_set: remote_item_effect_mode.is_equal (a_string) end set_start_level (a_string: STRING) is -- set `start_level' do start_level := a_string.out ensure value_set: start_level.is_equal (a_string) end set_number_of_games_to_win (an_integer: INTEGER) is -- set `number_of_games_to_win' do number_of_games_to_win := an_integer ensure value_set: number_of_games_to_win = an_integer end set_difficulty (a_string: STRING) is -- set `difficulty' do difficulty := a_string.out ensure value_set: difficulty.is_equal (a_string) end set_level_set (a_string: STRING) is -- set `level_set' do level_set := a_string.out ensure value_set: level_set.is_equal (a_string) end feature -- Serialization serialize (a_serializer: EM_NET_SERIALIZER) is -- Serialize to the given stream using `a_serializer' do a_serializer.put_integer (id) a_serializer.put_integer (score_for_enemy_block) a_serializer.put_integer (remote_item_effect_chance) a_serializer.put_line (remote_item_effect_mode) a_serializer.put_integer (number_of_games_to_win) a_serializer.put_line (start_level) a_serializer.put_line (difficulty) a_serializer.put_line (level_set) end serialization_byte_count: INTEGER is -- Count of bytes needed for a successful serialization do Result := 16 + remote_item_effect_mode.count + start_level.count + difficulty.count + level_set.count + 4 end unserialize (an_unserializer: EM_NET_UNSERIALIZER) is -- Unserialize from a given stream using `an_unserializer' do an_unserializer.read_integer id := an_unserializer.last_integer an_unserializer.read_integer score_for_enemy_block := an_unserializer.last_integer an_unserializer.read_integer remote_item_effect_chance := an_unserializer.last_integer an_unserializer.read_line remote_item_effect_mode := an_unserializer.last_string an_unserializer.read_integer number_of_games_to_win := an_unserializer.last_integer an_unserializer.read_line start_level := an_unserializer.last_string an_unserializer.read_line difficulty := an_unserializer.last_string an_unserializer.read_line level_set := an_unserializer.last_string end end