diff --git a/CMakeLists.txt b/CMakeLists.txt index b2ca196b4..f9c329a34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ add_library(lcf) set(LCF_SOURCES src/data.cpp + src/dbarray.cpp src/encoder.cpp src/ini.cpp src/inireader.cpp @@ -194,6 +195,9 @@ set(LCF_SOURCES set(LCF_HEADERS src/lcf/data.h + src/lcf/dbarray.h + src/lcf/dbarrayalloc.h + src/lcf/dbstring.h src/lcf/encoder.h src/lcf/enum_tags.h src/lcf/flag_set.h diff --git a/Makefile.am b/Makefile.am index 65df76355..b310a0c7b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,6 +43,7 @@ liblcf_la_LDFLAGS = \ -no-undefined liblcf_la_SOURCES = \ src/data.cpp \ + src/dbarray.cpp \ src/encoder.cpp \ src/ini.cpp \ src/inireader.cpp \ @@ -201,6 +202,9 @@ liblcf_la_SOURCES = \ lcfinclude_HEADERS = \ src/lcf/data.h \ + src/lcf/dbarray.h \ + src/lcf/dbarrayalloc.h \ + src/lcf/dbstring.h \ src/lcf/encoder.h \ src/lcf/enum_tags.h \ src/lcf/flag_set.h \ diff --git a/generator/csv/fields.csv b/generator/csv/fields.csv index 33137dd09..52fc2f068 100644 --- a/generator/csv/fields.csv +++ b/generator/csv/fields.csv @@ -1,16 +1,16 @@ #Structure,Field,Size Field?,Type,Index,Default Value,PersistIfDefault,Is2k3,Comment Learning,level,f,Int32,0x01,1,0,0,Integer Learning,skill_id,f,Ref,0x02,1,0,0,Integer -Actor,name,f,String,0x01,'',0,0,String -Actor,title,f,String,0x02,'',0,0,String -Actor,character_name,f,String,0x03,'',0,0,String +Actor,name,f,DBString,0x01,'',0,0,String +Actor,title,f,DBString,0x02,'',0,0,String +Actor,character_name,f,DBString,0x03,'',0,0,String Actor,character_index,f,Int32,0x04,0,0,0,Integer Actor,transparent,f,Boolean,0x05,False,0,0,Flag Actor,initial_level,f,Int32,0x07,1,0,0,Integer Actor,final_level,f,Int32,0x08,50|99,0,0,Integer Actor,critical_hit,f,Boolean,0x09,True,0,0,Flag Actor,critical_hit_chance,f,Int32,0x0A,30,0,0,Integer -Actor,face_name,f,String,0x0F,,0,0,String +Actor,face_name,f,DBString,0x0F,,0,0,String Actor,face_index,f,Int32,0x10,0,0,0,Integer Actor,two_weapon,f,Boolean,0x15,False,0,0,Flag Actor,lock_equipment,f,Boolean,0x16,False,0,0,Flag @@ -28,10 +28,10 @@ Actor,battle_y,f,Int32,0x3C,120,0,1,Integer - RPG2003 Actor,battler_animation,f,Ref,0x3E,1,0,1,Integer - RPG2003 Actor,skills,f,Array,0x3F,,1,0,Array - rpg::Learning Actor,rename_skill,f,Boolean,0x42,False,0,0,Flag -Actor,skill_name,f,String,0x43,'',0,0,String -Actor,state_ranks,t,UInt8,0x47,,0,0,Integer +Actor,skill_name,f,DBString,0x43,'',0,0,String +Actor,state_ranks,t,Vector,0x47,,0,0,Integer Actor,state_ranks,f,Vector,0x48,,1,0,Array - Short -Actor,attribute_ranks,t,UInt8,0x49,,0,0,Integer +Actor,attribute_ranks,t,Vector,0x49,,0,0,Integer Actor,attribute_ranks,f,Vector,0x4A,,1,0,Array - Short Actor,battle_commands,f,Vector>,0x50,,1,1,Array - rpg::BattleCommand - RPG2003 Sound,name,f,String,0x01,"(OFF)",1,0,String @@ -57,21 +57,21 @@ AnimationCellData,tone_blue,f,Int32,0x08,100,0,0,Integer AnimationCellData,tone_gray,f,Int32,0x09,100,0,0,Integer AnimationCellData,transparency,f,Int32,0x0A,0,0,0,Integer AnimationFrame,cells,f,Array,0x01,,1,0,Array - rpg::AnimationCellData -Animation,name,f,String,0x01,'',0,0,String -Animation,animation_name,f,String,0x02,'',0,0,String +Animation,name,f,DBString,0x01,'',0,0,String +Animation,animation_name,f,DBString,0x02,'',0,0,String Animation,large,f,Boolean,0x03,False,0,0,Battle2 animation when true Animation,timings,f,Array,0x06,,1,0,Array - rpg::AnimationTiming Animation,scope,f,Enum,0x09,0,1,0,Integer Animation,position,f,Enum,0x0A,2,1,0,Integer Animation,frames,f,Array,0x0C,,1,0,Array - rpg::AnimationFrames -Attribute,name,f,String,0x01,'',0,0,String +Attribute,name,f,DBString,0x01,'',0,0,String Attribute,type,f,Enum,0x02,0,1,0,Integer Attribute,a_rate,f,Int32,0x0B,300,0,0,Integer Attribute,b_rate,f,Int32,0x0C,200,0,0,Integer Attribute,c_rate,f,Int32,0x0D,100,0,0,Integer Attribute,d_rate,f,Int32,0x0E,50,0,0,Integer Attribute,e_rate,f,Int32,0x0F,0,0,0,Integer -BattleCommand,name,f,String,0x01,'',1,0,String +BattleCommand,name,f,DBString,0x01,'',1,0,String BattleCommand,type,f,Enum,0x02,0,0,0,Integer BattleCommands,placement,f,Enum,0x02,0,0,0,Integer BattleCommands,death_handler_unused,f,Boolean,0x04,0,0,1,Set by the RM2k3 Editor when you enable death handler; but has no effect in RPG_RT. @@ -88,26 +88,26 @@ BattleCommands,death_teleport_id,f,Ref,0x1A,1,0,0,Integer BattleCommands,death_teleport_x,f,Int32,0x1B,0,0,0,Integer BattleCommands,death_teleport_y,f,Int32,0x1C,0,0,0,Integer BattleCommands,death_teleport_face,f,Enum,0x1D,0,0,0,Integer -BattlerAnimationExtension,name,f,String,0x01,'',0,0,String -BattlerAnimationExtension,battler_name,f,String,0x02,'',0,0,String +BattlerAnimationExtension,name,f,DBString,0x01,'',0,0,String +BattlerAnimationExtension,battler_name,f,DBString,0x02,'',0,0,String BattlerAnimationExtension,battler_index,f,Int32,0x03,0,0,0,Integer BattlerAnimationExtension,animation_type,f,Enum,0x04,0,0,0,Integer BattlerAnimationExtension,animation_id,f,Ref,0x05,1,0,0,Integer -BattlerAnimation,name,f,String,0x01,'',0,0,String +BattlerAnimation,name,f,DBString,0x01,'',0,0,String BattlerAnimation,speed,f,Enum,0x02,0,0,0,Integer BattlerAnimation,base_data,f,Array,0x0A,,1,0,Array - rpg::BattlerAnimationExtension BattlerAnimation,weapon_data,f,Array,0x0B,,1,0,Array - rpg::BattlerAnimationExtension BattlerAnimationData,move,f,Enum,0x05,0,0,0,Integer BattlerAnimationData,after_image,f,Enum,0x06,0,0,0,Integer BattlerAnimationData,pose,f,Int32,0x0E,-1,0,0,Integer -Chipset,name,f,String,0x01,'',0,0,String -Chipset,chipset_name,f,String,0x02,'',0,0,String +Chipset,name,f,DBString,0x01,'',0,0,String +Chipset,chipset_name,f,DBString,0x02,'',0,0,String Chipset,terrain_data,f,Vector,0x03,[1]*162,0,0,Array - Short x 162 Chipset,passable_data_lower,f,Vector,0x04,[15]*162,0,0,Array - Bitflag x 162 Chipset,passable_data_upper,f,Vector,0x05,[31]+[15]*143,0,0,Array - Bitflag x 144 Chipset,animation_type,f,Enum,0x0B,0,0,0,Integer Chipset,animation_speed,f,Int32,0x0C,0,0,0,Integer -Class,name,f,String,0x01,'',0,0,String +Class,name,f,DBString,0x01,'',0,0,String Class,two_weapon,f,Boolean,0x15,False,0,0,Flag Class,lock_equipment,f,Boolean,0x16,False,0,0,Flag Class,auto_battle,f,Boolean,0x17,False,0,0,Flag @@ -118,21 +118,21 @@ Class,exp_inflation,f,Int32,0x2A,300,0,0,Integer Class,exp_correction,f,Int32,0x2B,0,0,0,Integer Class,battler_animation,f,Ref,0x3E,0,0,0,Integer Class,skills,f,Array,0x3F,,1,0,Array - rpg::Learning -Class,state_ranks,t,UInt8,0x47,,0,0,Integer +Class,state_ranks,t,Vector,0x47,,0,0,Integer Class,state_ranks,f,Vector,0x48,,1,0,Array - Short -Class,attribute_ranks,t,UInt8,0x49,,0,0,Integer +Class,attribute_ranks,t,Vector,0x49,,0,0,Integer Class,attribute_ranks,f,Vector,0x4A,,1,0,Array - Short Class,battle_commands,f,Vector>,0x50,,1,0,Array - Uint32 -CommonEvent,name,f,String,0x01,'',0,0,String +CommonEvent,name,f,DBString,0x01,'',0,0,String CommonEvent,trigger,f,Enum,0x0B,0,0,0,Integer CommonEvent,switch_flag,f,Boolean,0x0C,False,0,0,Flag CommonEvent,switch_id,f,Ref,0x0D,1,0,0,Integer -CommonEvent,event_commands,t,EventCommand,0x15,,1,0,Integer +CommonEvent,event_commands,t,Vector,0x15,,1,0,Integer CommonEvent,event_commands,f,Vector,0x16,,1,0,Array - rpg::EventCommand -Skill,name,f,String,0x01,'',0,0,String -Skill,description,f,String,0x02,'',0,0,String -Skill,using_message1,f,String,0x03,'',0,0,String - RPG2000 -Skill,using_message2,f,String,0x04,'',0,0,String - RPG2000 +Skill,name,f,DBString,0x01,'',0,0,String +Skill,description,f,DBString,0x02,'',0,0,String +Skill,using_message1,f,DBString,0x03,'',0,0,String - RPG2000 +Skill,using_message2,f,DBString,0x04,'',0,0,String - RPG2000 Skill,failure_message,f,Int32,0x07,0,0,0,Integer - RPG2000 Skill,type,f,Enum,0x08,0,1,0,Integer Skill,sp_type,f,Enum,0x09,0,0,1,Integer - RPG2003 @@ -158,9 +158,9 @@ Skill,affect_spirit,f,Boolean,0x23,False,0,0,Flag Skill,affect_agility,f,Boolean,0x24,False,0,0,Flag Skill,absorb_damage,f,Boolean,0x25,False,0,0,Flag Skill,ignore_defense,f,Boolean,0x26,False,0,0,Flag -Skill,state_effects,t,Boolean,0x29,,0,0,Integer +Skill,state_effects,t,Vector,0x29,,0,0,Integer Skill,state_effects,f,Vector,0x2A,,1,0,Array - Flag -Skill,attribute_effects,t,Boolean,0x2B,,0,0,Integer +Skill,attribute_effects,t,Vector,0x2B,,0,0,Integer Skill,attribute_effects,f,Vector,0x2C,,1,0,Array - Flag Skill,affect_attr_defence,f,Boolean,0x2D,False,0,0,Flag Skill,battler_animation,f,Ref,0x31,-1,0,1,Integer - RPG2003 @@ -174,8 +174,8 @@ ItemAnimation,ranged,f,Boolean,0x08,False,0,0, ItemAnimation,ranged_anim,f,Int32,0x09,0,0,0, ItemAnimation,ranged_speed,f,Enum,0x0C,0,0,0, ItemAnimation,battle_anim,f,Ref,0x0D,0,0,0, -Item,name,f,String,0x01,'',0,0,String -Item,description,f,String,0x02,'',0,0,String +Item,name,f,DBString,0x01,'',0,0,String +Item,description,f,DBString,0x02,'',0,0,String Item,type,f,Enum,0x03,0,1,0,Integer Item,price,f,Int32,0x05,0,0,0,Integer Item,uses,f,Int32,0x06,1,0,0,Integer @@ -215,18 +215,18 @@ Item,skill_id,f,Ref,0x35,1,0,0,Integer Item,switch_id,f,Ref,0x37,1,0,0,Integer Item,occasion_field2,f,Boolean,0x39,True,0,0,Flag Item,occasion_battle,f,Boolean,0x3A,False,0,0,Flag -Item,actor_set,t,Boolean,0x3D,,0,0,Integer +Item,actor_set,t,Vector,0x3D,,0,0,Integer Item,actor_set,f,Vector,0x3E,,1,0,Array - Flag -Item,state_set,t,Boolean,0x3F,,0,0,Integer +Item,state_set,t,Vector,0x3F,,0,0,Integer Item,state_set,f,Vector,0x40,,1,0,Array - Flag -Item,attribute_set,t,Boolean,0x41,,0,0,Integer +Item,attribute_set,t,Vector,0x41,,0,0,Integer Item,attribute_set,f,Vector,0x42,,1,0,Array - Flag Item,state_chance,f,Int32,0x43,0,0,0,Integer Item,reverse_state_effect,f,Boolean,0x44,False,0,0,Flag Item,weapon_animation,f,Ref,0x45,-1,0,1,Integer - RPG2003 Item,animation_data,f,Array>,0x46,,1,1,Array - RPG2003 Item,use_skill,f,Boolean,0x47,False,0,1,Flag - RPG2003 -Item,class_set,t,Boolean,0x48,,0,1,Integer - RPG2003 +Item,class_set,t,Vector,0x48,,0,1,Integer - RPG2003 Item,class_set,f,Vector,0x49,,1,1,Array - Flag - RPG2003 Item,ranged_trajectory,f,Enum,0x4B,0,0,0,Integer Item,ranged_target,f,Enum,0x4C,0,0,0,Integer @@ -243,8 +243,8 @@ EnemyAction,switch_on_id,f,Ref,0x0A,1,0,0,Integer EnemyAction,switch_off,f,Boolean,0x0B,False,0,0,Flag EnemyAction,switch_off_id,f,Ref,0x0C,1,0,0,Integer EnemyAction,rating,f,Int32,0x0D,50,0,0,Integer -Enemy,name,f,String,0x01,'',0,0,String -Enemy,battler_name,f,String,0x02,'',0,0,String +Enemy,name,f,DBString,0x01,'',0,0,String +Enemy,battler_name,f,DBString,0x02,'',0,0,String Enemy,battler_hue,f,Int32,0x03,0,0,0,Integer Enemy,max_hp,f,Int32,0x04,10,0,0,Integer Enemy,max_sp,f,Int32,0x05,10,0,0,Integer @@ -261,9 +261,9 @@ Enemy,critical_hit,f,Boolean,0x15,False,0,0,Flag Enemy,critical_hit_chance,f,Int32,0x16,30,0,0,Integer Enemy,miss,f,Boolean,0x1A,False,0,0,Flag Enemy,levitate,f,Boolean,0x1C,False,0,0,Flag -Enemy,state_ranks,t,UInt8,0x1F,,0,0,Integer +Enemy,state_ranks,t,Vector,0x1F,,0,0,Integer Enemy,state_ranks,f,Vector,0x20,,1,0,Array - Short -Enemy,attribute_ranks,t,UInt8,0x21,,0,0,Integer +Enemy,attribute_ranks,t,Vector,0x21,,0,0,Integer Enemy,attribute_ranks,f,Vector,0x22,,1,0,Array - Short Enemy,actions,f,Array,0x2A,,1,0,Array - rpg::EnemyAction TroopMember,enemy_id,f,Ref,0x01,1,0,0,Integer @@ -294,19 +294,19 @@ TroopPageCondition,turn_actor_b,f,Int32,0x15,0,0,1,Integer - RPG2003 TroopPageCondition,command_actor_id,f,Ref,0x16,1,0,1,Integer - RPG2003 TroopPageCondition,command_id,f,Ref,0x17,1,0,1,Integer - RPG2003 TroopPage,condition,f,TroopPageCondition,0x02,,1,0,rpg::TroopPageCondition -TroopPage,event_commands,t,EventCommand,0x0B,,1,0,Integer +TroopPage,event_commands,t,Vector,0x0B,,1,0,Integer TroopPage,event_commands,f,Vector,0x0C,,1,0,Array - rpg::EventCommand -Troop,name,f,String,0x01,'',0,0,String +Troop,name,f,DBString,0x01,'',0,0,String Troop,members,f,Array,0x02,,1,0,Array - rpg::TroopMember Troop,auto_alignment,f,Boolean,0x03,False,0,1,Flag -Troop,terrain_set,t,Boolean,0x04,,0,0,Integer +Troop,terrain_set,t,Vector,0x04,,0,0,Integer Troop,terrain_set,f,Vector,0x05,,1,0,Array - Flag Troop,appear_randomly,f,Boolean,0x06,False,0,1,Flag Troop,pages,f,Array,0x0B,,1,0,Array - rpg::TroopPage -Terrain,name,f,String,0x01,'',0,0,String +Terrain,name,f,DBString,0x01,'',0,0,String Terrain,damage,f,Int32,0x02,0,0,0,Integer Terrain,encounter_rate,f,Int32,0x03,100,0,0,Integer -Terrain,background_name,f,String,0x04,'',0,0,String +Terrain,background_name,f,DBString,0x04,'',0,0,String Terrain,boat_pass,f,Boolean,0x05,False,0,0,Flag Terrain,ship_pass,f,Boolean,0x06,False,0,0,Flag Terrain,airship_pass,f,Boolean,0x07,True,0,0,Flag @@ -315,13 +315,13 @@ Terrain,bush_depth,f,Enum,0x0B,0,1,0,Integer Terrain,footstep,f,Sound,0x0F,,1,1,rpg::Sound - RPG2003 Terrain,on_damage_se,f,Boolean,0x10,False,0,1,Flag - RPG2003 Terrain,background_type,f,Enum,0x11,0,0,1,Integer - RPG2003 -Terrain,background_a_name,f,String,0x15,'',0,1,String - RPG2003 +Terrain,background_a_name,f,DBString,0x15,'',0,1,String - RPG2003 Terrain,background_a_scrollh,f,Boolean,0x16,False,0,1,Flag - RPG2003 Terrain,background_a_scrollv,f,Boolean,0x17,False,0,1,Flag - RPG2003 Terrain,background_a_scrollh_speed,f,Int32,0x18,0,0,1,Integer - RPG2003 Terrain,background_a_scrollv_speed,f,Int32,0x19,0,0,1,Integer - RPG2003 Terrain,background_b,f,Boolean,0x1E,False,0,1,Flag - RPG2003 -Terrain,background_b_name,f,String,0x1F,'',0,1,String - RPG2003 +Terrain,background_b_name,f,DBString,0x1F,'',0,1,String - RPG2003 Terrain,background_b_scrollh,f,Boolean,0x20,False,0,1,Flag - RPG2003 Terrain,background_b_scrollv,f,Boolean,0x21,False,0,1,Flag - RPG2003 Terrain,background_b_scrollh_speed,f,Int32,0x22,0,0,1,Integer - RPG2003 @@ -335,7 +335,7 @@ Terrain,grid_location,f,Int32,0x2D,0,0,1,Integer - RPG2003 Terrain,grid_top_y,f,Int32,0x2E,120,0,1,Integer - RPG2003 Terrain,grid_elongation,f,Int32,0x2F,392,0,1,Integer - RPG2003 Terrain,grid_inclination,f,Int32,0x30,16000,0,1,Integer - RPG2003 -State,name,f,String,0x01,'',0,0,String +State,name,f,DBString,0x01,'',0,0,String State,type,f,Enum,0x02,0,1,0,Integer State,color,f,Int32,0x03,6,0,0,Integer State,priority,f,Int32,0x04,50,0,0,Integer @@ -364,11 +364,11 @@ State,restrict_magic,f,Boolean,0x2B,False,0,0,Flag State,restrict_magic_level,f,Int32,0x2C,0,0,0,Integer State,hp_change_type,f,Enum,0x2D,0,0,0,Integer State,sp_change_type,f,Enum,0x2E,0,0,0,Integer -State,message_actor,f,String,0x33,'',0,0,String -State,message_enemy,f,String,0x34,'',0,0,String -State,message_already,f,String,0x35,'',0,0,String -State,message_affected,f,String,0x36,'',0,0,String -State,message_recovery,f,String,0x37,'',0,0,String +State,message_actor,f,DBString,0x33,'',0,0,String +State,message_enemy,f,DBString,0x34,'',0,0,String +State,message_already,f,DBString,0x35,'',0,0,String +State,message_affected,f,DBString,0x36,'',0,0,String +State,message_recovery,f,DBString,0x37,'',0,0,String State,hp_change_max,f,Int32,0x3D,0,0,0,Integer State,hp_change_val,f,Int32,0x3E,0,0,0,Integer State,hp_change_map_steps,f,Int32,0x3F,0,0,0,Integer @@ -377,133 +377,133 @@ State,sp_change_max,f,Int32,0x41,0,0,0,Integer State,sp_change_val,f,Int32,0x42,0,0,0,Integer State,sp_change_map_steps,f,Int32,0x43,0,0,0,Integer State,sp_change_map_val,f,Int32,0x44,0,0,0,Integer -Terms,encounter,f,String,0x01,'',1,0,String -Terms,special_combat,f,String,0x02,'',1,0,String -Terms,escape_success,f,String,0x03,'',1,0,String -Terms,escape_failure,f,String,0x04,'',1,0,String -Terms,victory,f,String,0x05,'',1,0,String -Terms,defeat,f,String,0x06,'',1,0,String -Terms,exp_received,f,String,0x07,'',1,0,String -Terms,gold_recieved_a,f,String,0x08,'',1,0,String -Terms,gold_recieved_b,f,String,0x09,'',1,0,String -Terms,item_recieved,f,String,0x0A,'',1,0,String -Terms,attacking,f,String,0x0B,'',1,0,String -Terms,enemy_critical,f,String,0x0C,'',1,0,String -Terms,actor_critical,f,String,0x0D,'',1,0,String -Terms,defending,f,String,0x0E,'',1,0,String -Terms,observing,f,String,0x0F,'',1,0,String -Terms,focus,f,String,0x10,'',1,0,String -Terms,autodestruction,f,String,0x11,'',1,0,String -Terms,enemy_escape,f,String,0x12,'',1,0,String -Terms,enemy_transform,f,String,0x13,'',1,0,String -Terms,enemy_damaged,f,String,0x14,'',1,0,String -Terms,enemy_undamaged,f,String,0x15,'',1,0,String -Terms,actor_damaged,f,String,0x16,'',1,0,String -Terms,actor_undamaged,f,String,0x17,'',1,0,String -Terms,skill_failure_a,f,String,0x18,'',1,0,String -Terms,skill_failure_b,f,String,0x19,'',1,0,String -Terms,skill_failure_c,f,String,0x1A,'',1,0,String -Terms,dodge,f,String,0x1B,'',1,0,String -Terms,use_item,f,String,0x1C,'',1,0,String -Terms,hp_recovery,f,String,0x1D,'',1,0,String -Terms,parameter_increase,f,String,0x1E,'',1,0,String -Terms,parameter_decrease,f,String,0x1F,'',1,0,String -Terms,enemy_hp_absorbed,f,String,0x20,'',1,0,String -Terms,actor_hp_absorbed,f,String,0x21,'',1,0,String -Terms,resistance_increase,f,String,0x22,'',1,0,String -Terms,resistance_decrease,f,String,0x23,'',1,0,String -Terms,level_up,f,String,0x24,'',1,0,String -Terms,skill_learned,f,String,0x25,'',1,0,String -Terms,battle_start,f,String,0x26,'',1,1,String -Terms,miss,f,String,0x27,'',1,1,String -Terms,shop_greeting1,f,String,0x29,'',1,0,String -Terms,shop_regreeting1,f,String,0x2A,'',1,0,String -Terms,shop_buy1,f,String,0x2B,'',1,0,String -Terms,shop_sell1,f,String,0x2C,'',1,0,String -Terms,shop_leave1,f,String,0x2D,'',1,0,String -Terms,shop_buy_select1,f,String,0x2E,'',1,0,String -Terms,shop_buy_number1,f,String,0x2F,'',1,0,String -Terms,shop_purchased1,f,String,0x30,'',1,0,String -Terms,shop_sell_select1,f,String,0x31,'',1,0,String -Terms,shop_sell_number1,f,String,0x32,'',1,0,String -Terms,shop_sold1,f,String,0x33,'',1,0,String -Terms,shop_greeting2,f,String,0x36,'',1,0,String -Terms,shop_regreeting2,f,String,0x37,'',1,0,String -Terms,shop_buy2,f,String,0x38,'',1,0,String -Terms,shop_sell2,f,String,0x39,'',1,0,String -Terms,shop_leave2,f,String,0x3A,'',1,0,String -Terms,shop_buy_select2,f,String,0x3B,'',1,0,String -Terms,shop_buy_number2,f,String,0x3C,'',1,0,String -Terms,shop_purchased2,f,String,0x3D,'',1,0,String -Terms,shop_sell_select2,f,String,0x3E,'',1,0,String -Terms,shop_sell_number2,f,String,0x3F,'',1,0,String -Terms,shop_sold2,f,String,0x40,'',1,0,String -Terms,shop_greeting3,f,String,0x43,'',1,0,String -Terms,shop_regreeting3,f,String,0x44,'',1,0,String -Terms,shop_buy3,f,String,0x45,'',1,0,String -Terms,shop_sell3,f,String,0x46,'',1,0,String -Terms,shop_leave3,f,String,0x47,'',1,0,String -Terms,shop_buy_select3,f,String,0x48,'',1,0,String -Terms,shop_buy_number3,f,String,0x49,'',1,0,String -Terms,shop_purchased3,f,String,0x4A,'',1,0,String -Terms,shop_sell_select3,f,String,0x4B,'',1,0,String -Terms,shop_sell_number3,f,String,0x4C,'',1,0,String -Terms,shop_sold3,f,String,0x4D,'',1,0,String -Terms,inn_a_greeting_1,f,String,0x50,'',1,0,String -Terms,inn_a_greeting_2,f,String,0x51,'',1,0,String -Terms,inn_a_greeting_3,f,String,0x52,'',1,0,String -Terms,inn_a_accept,f,String,0x53,'',1,0,String -Terms,inn_a_cancel,f,String,0x54,'',1,0,String -Terms,inn_b_greeting_1,f,String,0x55,'',1,0,String -Terms,inn_b_greeting_2,f,String,0x56,'',1,0,String -Terms,inn_b_greeting_3,f,String,0x57,'',1,0,String -Terms,inn_b_accept,f,String,0x58,'',1,0,String -Terms,inn_b_cancel,f,String,0x59,'',1,0,String -Terms,possessed_items,f,String,0x5C,'',1,0,String -Terms,equipped_items,f,String,0x5D,'',1,0,String -Terms,gold,f,String,0x5F,'',1,0,String -Terms,battle_fight,f,String,0x65,'',1,0,String -Terms,battle_auto,f,String,0x66,'',1,0,String -Terms,battle_escape,f,String,0x67,'',1,0,String -Terms,command_attack,f,String,0x68,'',1,0,String -Terms,command_defend,f,String,0x69,'',1,0,String -Terms,command_item,f,String,0x6A,'',1,0,String -Terms,command_skill,f,String,0x6B,'',1,0,String -Terms,menu_equipment,f,String,0x6C,'',1,0,String -Terms,menu_save,f,String,0x6E,'',1,0,String -Terms,menu_quit,f,String,0x70,'',1,0,String -Terms,new_game,f,String,0x72,'',1,0,String -Terms,load_game,f,String,0x73,'',1,0,String -Terms,exit_game,f,String,0x75,'',1,0,String -Terms,status,f,String,0x76,'',1,1,String -Terms,row,f,String,0x77,'',1,1,String -Terms,order,f,String,0x78,'',1,1,String -Terms,wait_on,f,String,0x79,'',1,1,String -Terms,wait_off,f,String,0x7A,'',1,1,String -Terms,level,f,String,0x7B,'',1,0,String -Terms,health_points,f,String,0x7C,'',1,0,String -Terms,spirit_points,f,String,0x7D,'',1,0,String -Terms,normal_status,f,String,0x7E,'',1,0,String -Terms,exp_short,f,String,0x7F,'',1,0,String - char x 2? -Terms,lvl_short,f,String,0x80,'',1,0,String - char x 2? -Terms,hp_short,f,String,0x81,'',1,0,String - char x 2? -Terms,sp_short,f,String,0x82,'',1,0,String - char x 2? -Terms,sp_cost,f,String,0x83,'',1,0,String -Terms,attack,f,String,0x84,'',1,0,String -Terms,defense,f,String,0x85,'',1,0,String -Terms,spirit,f,String,0x86,'',1,0,String -Terms,agility,f,String,0x87,'',1,0,String -Terms,weapon,f,String,0x88,'',1,0,String -Terms,shield,f,String,0x89,'',1,0,String -Terms,armor,f,String,0x8A,'',1,0,String -Terms,helmet,f,String,0x8B,'',1,0,String -Terms,accessory,f,String,0x8C,'',1,0,String -Terms,save_game_message,f,String,0x92,'',1,0,String -Terms,load_game_message,f,String,0x93,'',1,0,String -Terms,file,f,String,0x94,'',1,0,String -Terms,exit_game_message,f,String,0x97,'',1,0,String -Terms,yes,f,String,0x98,'',1,0,String -Terms,no,f,String,0x99,'',1,0,String +Terms,encounter,f,DBString,0x01,'',1,0,String +Terms,special_combat,f,DBString,0x02,'',1,0,String +Terms,escape_success,f,DBString,0x03,'',1,0,String +Terms,escape_failure,f,DBString,0x04,'',1,0,String +Terms,victory,f,DBString,0x05,'',1,0,String +Terms,defeat,f,DBString,0x06,'',1,0,String +Terms,exp_received,f,DBString,0x07,'',1,0,String +Terms,gold_recieved_a,f,DBString,0x08,'',1,0,String +Terms,gold_recieved_b,f,DBString,0x09,'',1,0,String +Terms,item_recieved,f,DBString,0x0A,'',1,0,String +Terms,attacking,f,DBString,0x0B,'',1,0,String +Terms,enemy_critical,f,DBString,0x0C,'',1,0,String +Terms,actor_critical,f,DBString,0x0D,'',1,0,String +Terms,defending,f,DBString,0x0E,'',1,0,String +Terms,observing,f,DBString,0x0F,'',1,0,String +Terms,focus,f,DBString,0x10,'',1,0,String +Terms,autodestruction,f,DBString,0x11,'',1,0,String +Terms,enemy_escape,f,DBString,0x12,'',1,0,String +Terms,enemy_transform,f,DBString,0x13,'',1,0,String +Terms,enemy_damaged,f,DBString,0x14,'',1,0,String +Terms,enemy_undamaged,f,DBString,0x15,'',1,0,String +Terms,actor_damaged,f,DBString,0x16,'',1,0,String +Terms,actor_undamaged,f,DBString,0x17,'',1,0,String +Terms,skill_failure_a,f,DBString,0x18,'',1,0,String +Terms,skill_failure_b,f,DBString,0x19,'',1,0,String +Terms,skill_failure_c,f,DBString,0x1A,'',1,0,String +Terms,dodge,f,DBString,0x1B,'',1,0,String +Terms,use_item,f,DBString,0x1C,'',1,0,String +Terms,hp_recovery,f,DBString,0x1D,'',1,0,String +Terms,parameter_increase,f,DBString,0x1E,'',1,0,String +Terms,parameter_decrease,f,DBString,0x1F,'',1,0,String +Terms,enemy_hp_absorbed,f,DBString,0x20,'',1,0,String +Terms,actor_hp_absorbed,f,DBString,0x21,'',1,0,String +Terms,resistance_increase,f,DBString,0x22,'',1,0,String +Terms,resistance_decrease,f,DBString,0x23,'',1,0,String +Terms,level_up,f,DBString,0x24,'',1,0,String +Terms,skill_learned,f,DBString,0x25,'',1,0,String +Terms,battle_start,f,DBString,0x26,'',1,1,String +Terms,miss,f,DBString,0x27,'',1,1,String +Terms,shop_greeting1,f,DBString,0x29,'',1,0,String +Terms,shop_regreeting1,f,DBString,0x2A,'',1,0,String +Terms,shop_buy1,f,DBString,0x2B,'',1,0,String +Terms,shop_sell1,f,DBString,0x2C,'',1,0,String +Terms,shop_leave1,f,DBString,0x2D,'',1,0,String +Terms,shop_buy_select1,f,DBString,0x2E,'',1,0,String +Terms,shop_buy_number1,f,DBString,0x2F,'',1,0,String +Terms,shop_purchased1,f,DBString,0x30,'',1,0,String +Terms,shop_sell_select1,f,DBString,0x31,'',1,0,String +Terms,shop_sell_number1,f,DBString,0x32,'',1,0,String +Terms,shop_sold1,f,DBString,0x33,'',1,0,String +Terms,shop_greeting2,f,DBString,0x36,'',1,0,String +Terms,shop_regreeting2,f,DBString,0x37,'',1,0,String +Terms,shop_buy2,f,DBString,0x38,'',1,0,String +Terms,shop_sell2,f,DBString,0x39,'',1,0,String +Terms,shop_leave2,f,DBString,0x3A,'',1,0,String +Terms,shop_buy_select2,f,DBString,0x3B,'',1,0,String +Terms,shop_buy_number2,f,DBString,0x3C,'',1,0,String +Terms,shop_purchased2,f,DBString,0x3D,'',1,0,String +Terms,shop_sell_select2,f,DBString,0x3E,'',1,0,String +Terms,shop_sell_number2,f,DBString,0x3F,'',1,0,String +Terms,shop_sold2,f,DBString,0x40,'',1,0,String +Terms,shop_greeting3,f,DBString,0x43,'',1,0,String +Terms,shop_regreeting3,f,DBString,0x44,'',1,0,String +Terms,shop_buy3,f,DBString,0x45,'',1,0,String +Terms,shop_sell3,f,DBString,0x46,'',1,0,String +Terms,shop_leave3,f,DBString,0x47,'',1,0,String +Terms,shop_buy_select3,f,DBString,0x48,'',1,0,String +Terms,shop_buy_number3,f,DBString,0x49,'',1,0,String +Terms,shop_purchased3,f,DBString,0x4A,'',1,0,String +Terms,shop_sell_select3,f,DBString,0x4B,'',1,0,String +Terms,shop_sell_number3,f,DBString,0x4C,'',1,0,String +Terms,shop_sold3,f,DBString,0x4D,'',1,0,String +Terms,inn_a_greeting_1,f,DBString,0x50,'',1,0,String +Terms,inn_a_greeting_2,f,DBString,0x51,'',1,0,String +Terms,inn_a_greeting_3,f,DBString,0x52,'',1,0,String +Terms,inn_a_accept,f,DBString,0x53,'',1,0,String +Terms,inn_a_cancel,f,DBString,0x54,'',1,0,String +Terms,inn_b_greeting_1,f,DBString,0x55,'',1,0,String +Terms,inn_b_greeting_2,f,DBString,0x56,'',1,0,String +Terms,inn_b_greeting_3,f,DBString,0x57,'',1,0,String +Terms,inn_b_accept,f,DBString,0x58,'',1,0,String +Terms,inn_b_cancel,f,DBString,0x59,'',1,0,String +Terms,possessed_items,f,DBString,0x5C,'',1,0,String +Terms,equipped_items,f,DBString,0x5D,'',1,0,String +Terms,gold,f,DBString,0x5F,'',1,0,String +Terms,battle_fight,f,DBString,0x65,'',1,0,String +Terms,battle_auto,f,DBString,0x66,'',1,0,String +Terms,battle_escape,f,DBString,0x67,'',1,0,String +Terms,command_attack,f,DBString,0x68,'',1,0,String +Terms,command_defend,f,DBString,0x69,'',1,0,String +Terms,command_item,f,DBString,0x6A,'',1,0,String +Terms,command_skill,f,DBString,0x6B,'',1,0,String +Terms,menu_equipment,f,DBString,0x6C,'',1,0,String +Terms,menu_save,f,DBString,0x6E,'',1,0,String +Terms,menu_quit,f,DBString,0x70,'',1,0,String +Terms,new_game,f,DBString,0x72,'',1,0,String +Terms,load_game,f,DBString,0x73,'',1,0,String +Terms,exit_game,f,DBString,0x75,'',1,0,String +Terms,status,f,DBString,0x76,'',1,1,String +Terms,row,f,DBString,0x77,'',1,1,String +Terms,order,f,DBString,0x78,'',1,1,String +Terms,wait_on,f,DBString,0x79,'',1,1,String +Terms,wait_off,f,DBString,0x7A,'',1,1,String +Terms,level,f,DBString,0x7B,'',1,0,String +Terms,health_points,f,DBString,0x7C,'',1,0,String +Terms,spirit_points,f,DBString,0x7D,'',1,0,String +Terms,normal_status,f,DBString,0x7E,'',1,0,String +Terms,exp_short,f,DBString,0x7F,'',1,0,String - char x 2? +Terms,lvl_short,f,DBString,0x80,'',1,0,String - char x 2? +Terms,hp_short,f,DBString,0x81,'',1,0,String - char x 2? +Terms,sp_short,f,DBString,0x82,'',1,0,String - char x 2? +Terms,sp_cost,f,DBString,0x83,'',1,0,String +Terms,attack,f,DBString,0x84,'',1,0,String +Terms,defense,f,DBString,0x85,'',1,0,String +Terms,spirit,f,DBString,0x86,'',1,0,String +Terms,agility,f,DBString,0x87,'',1,0,String +Terms,weapon,f,DBString,0x88,'',1,0,String +Terms,shield,f,DBString,0x89,'',1,0,String +Terms,armor,f,DBString,0x8A,'',1,0,String +Terms,helmet,f,DBString,0x8B,'',1,0,String +Terms,accessory,f,DBString,0x8C,'',1,0,String +Terms,save_game_message,f,DBString,0x92,'',1,0,String +Terms,load_game_message,f,DBString,0x93,'',1,0,String +Terms,file,f,DBString,0x94,'',1,0,String +Terms,exit_game_message,f,DBString,0x97,'',1,0,String +Terms,yes,f,DBString,0x98,'',1,0,String +Terms,no,f,DBString,0x99,'',1,0,String Music,name,f,String,0x01,"(OFF)",1,0,String Music,fadein,f,Int32,0x02,0,0,0,Integer Music,volume,f,Int32,0x03,100,0,0,Integer @@ -517,19 +517,19 @@ TestBattler,armor_id,f,Ref,0x0D,0,0,0,Integer TestBattler,helmet_id,f,Ref,0x0E,0,0,0,Integer TestBattler,accessory_id,f,Ref,0x0F,0,0,0,Integer System,ldb_id,f,Int32,0x0A,0,0,0,Integer - RPG2003 -System,boat_name,f,String,0x0B,'',0,0,String -System,ship_name,f,String,0x0C,'',0,0,String -System,airship_name,f,String,0x0D,'',0,0,String +System,boat_name,f,DBString,0x0B,'',0,0,String +System,ship_name,f,DBString,0x0C,'',0,0,String +System,airship_name,f,DBString,0x0D,'',0,0,String System,boat_index,f,Int32,0x0E,0,0,0,Integer System,ship_index,f,Int32,0x0F,0,0,0,Integer System,airship_index,f,Int32,0x10,0,0,0,Integer -System,title_name,f,String,0x11,'',0,0,String -System,gameover_name,f,String,0x12,'',0,0,String -System,system_name,f,String,0x13,'',0,0,String -System,system2_name,f,String,0x14,'',0,1,String - RPG2003 -System,party,t,Count,0x15,,0,0,Integer +System,title_name,f,DBString,0x11,'',0,0,String +System,gameover_name,f,DBString,0x12,'',0,0,String +System,system_name,f,DBString,0x13,'',0,0,String +System,system2_name,f,DBString,0x14,'',0,1,String - RPG2003 +System,party,t,Count>,0x15,,0,0,Integer System,party,f,Vector,0x16,,1,0,Array - Short -System,menu_commands,t,Count,0x1A,,0,1,Integer - RPG2003 +System,menu_commands,t,Count>,0x1A,,0,1,Integer - RPG2003 System,menu_commands,f,Vector,0x1B,,1,1,Array - Short - RPG2003 System,title_music,f,Music,0x1F,,1,0,rpg::Music System,battle_music,f,Music,0x20,,1,0,rpg::Music @@ -561,7 +561,7 @@ System,message_stretch,f,Enum,0x47,0,0,0,Integer System,font_id,f,Enum,0x48,0,0,0,Integer System,selected_condition,f,Int32,0x51,0,0,0,Integer System,selected_hero,f,Ref,0x52,0,1,0,Integer -System,battletest_background,f,String,0x54,'',0,0,String +System,battletest_background,f,DBString,0x54,'',0,0,String System,battletest_data,f,Array,0x55,,1,0,Array - rpg::TestBattler System,save_count,f,Int32,0x5B,0,0,0,Integer System,battletest_terrain,f,Ref,0x5E,0,0,0,Integer @@ -570,11 +570,11 @@ System,battletest_condition,f,Enum,0x60,0,0,0,Integer System,equipment_setting,f,Enum,0x61,0,0,1,Integer RPG2003 - Whether equipment usage is by Actor or by Class. This is a global setting in RM2k3! System,battletest_alt_terrain,f,Ref,0x62,-1,0,1,Integer RPG2003 (EDITOR ONLY) - Double click on Terrain in Troops changes this setting and 0x54. Affects only the RM2k3 editor. System,show_frame,f,Boolean,0x63,False,0,1,Flag - RPG2003 -System,frame_name,f,String,0x64,'',0,1,String - RPG2003 +System,frame_name,f,DBString,0x64,'',0,1,String - RPG2003 System,invert_animations,f,Boolean,0x65,False,0,1,Flag - RPG2003 System,show_title,f,Boolean,0x6F,True,0,1,When false the title is skipped and the game starts directly. In TestPlay mode skips directly to the Load scene. Added in RPG Maker 2003 v1.11 -Switch,name,f,String,0x01,'',0,0,String -Variable,name,f,String,0x01,'',0,0,String +Switch,name,f,DBString,0x01,'',0,0,String +Variable,name,f,DBString,0x01,'',0,0,String Database,actors,f,Array,0x0B,,1,0,rpg::Actor Database,skills,f,Array,0x0C,,1,0,rpg::Skill Database,items,f,Array,0x0D,,1,0,rpg::Item @@ -598,7 +598,7 @@ Database,classes,f,Array,0x1E,,1,1,rpg::Class - RPG2003 Database,classD1,f,EmptyBlock,0x1F,,1,1,Duplicated? - Not used - RPG2003 Database,battleranimations,f,Array,0x20,,1,1,rpg::BattlerAnimation - RPG2003 Encounter,troop_id,f,Ref,0x01,0,0,0,Integer -MapInfo,name,f,String,0x01,'',0,0,String. Note: Map ID 0 used to be game title but it should be ignored (TreeCtrl dummy editor dumped data); always use RPG_RT.ini GameTitle instead +MapInfo,name,f,DBString,0x01,'',0,0,String. Note: Map ID 0 used to be game title but it should be ignored (TreeCtrl dummy editor dumped data); always use RPG_RT.ini GameTitle instead MapInfo,parent_map,f,Ref,0x02,0,0,0,Integer. Used to inherit parent map properties MapInfo,indentation,f,Int32,0x03,0,0,0,Integer. Dummy editor dumped data. Branch indentation level in TreeCtrl MapInfo,type,f,Enum,0x04,-1,0,0,Integer @@ -608,7 +608,7 @@ MapInfo,expanded_node,f,Boolean,0x07,False,0,0,Flag. Editor only MapInfo,music_type,f,Enum,0x0B,0,1,0,Integer. 0=inherit; 1=from event; 2=specified in 0x0C MapInfo,music,f,Music,0x0C,,1,0,Array - rpg::Music MapInfo,background_type,f,Enum,0x15,0,1,0,Integer. 0=inherit; 1=from terrain ldb data; 2=specified in 0x16 -MapInfo,background_name,f,String,0x16,'',0,0,String +MapInfo,background_name,f,DBString,0x16,'',0,0,String MapInfo,teleport,f,Enum,0x1F,0,1,0,Flag. 0=inherit; 1=allow; 2=disallow MapInfo,escape,f,Enum,0x20,0,1,0,Flag. 0=inherit; 1=allow; 2=disallow MapInfo,save,f,Enum,0x21,0,1,0,Flag. 0=inherit; 1=allow; 2=disallow @@ -637,12 +637,12 @@ EventPageCondition,actor_id,f,Ref,0x07,1,1,0,Integer EventPageCondition,timer_sec,f,Int32,0x08,0,0,0,Integer EventPageCondition,timer2_sec,f,Int32,0x09,0,0,1,Integer - RPG2003 EventPageCondition,compare_operator,f,Enum,0x0A,1,0,1,Integer - RPG2003 -MoveRoute,move_commands,t,MoveCommand,0x0B,,0,0,Integer +MoveRoute,move_commands,t,Vector,0x0B,,0,0,Integer MoveRoute,move_commands,f,Vector,0x0C,,1,0,Array - rpg::MoveCommand MoveRoute,repeat,f,Boolean,0x15,True,0,0,Flag MoveRoute,skippable,f,Boolean,0x16,False,0,0,Flag EventPage,condition,f,EventPageCondition,0x02,,1,0,rpg::EventPageCondition -EventPage,character_name,f,String,0x15,'',0,0,String +EventPage,character_name,f,DBString,0x15,'',0,0,String EventPage,character_index,f,Int32,0x16,0,0,0,Integer EventPage,character_direction,f,Enum,0x17,2,1,0,Integer EventPage,character_pattern,f,Enum,0x18,1,0,0,Integer @@ -655,9 +655,9 @@ EventPage,overlap_forbidden,f,Boolean,0x23,False,1,0,Flag EventPage,animation_type,f,Enum,0x24,0,1,0,Integer EventPage,move_speed,f,Enum,0x25,3,0,0,Integer EventPage,move_route,f,MoveRoute,0x29,,1,0,rpg::MoveRoute -EventPage,event_commands,t,EventCommand,0x33,,1,0,Integer +EventPage,event_commands,t,Vector,0x33,,1,0,Integer EventPage,event_commands,f,Vector,0x34,,1,0,Array - rpg::EventCommand -Event,name,f,String,0x01,'',0,0,String +Event,name,f,DBString,0x01,'',0,0,String Event,x,f,Int32,0x02,0,0,0,Integer Event,y,f,Int32,0x03,0,0,0,Integer Event,pages,f,Array,0x05,,1,0,Array - rpg::EventPage @@ -666,7 +666,7 @@ Map,width,f,Int32,0x02,20,0,0,Integer Map,height,f,Int32,0x03,15,0,0,Integer Map,scroll_type,f,Enum,0x0B,0,1,0,Integer Map,parallax_flag,f,Boolean,0x1F,False,0,0,Flag -Map,parallax_name,f,String,0x20,'',0,0,String +Map,parallax_name,f,DBString,0x20,'',0,0,String Map,parallax_loop_x,f,Boolean,0x21,False,0,0,Flag Map,parallax_loop_y,f,Boolean,0x22,False,0,0,Flag Map,parallax_auto_loop_x,f,Boolean,0x23,False,0,0,Flag @@ -710,9 +710,9 @@ SaveSystem,frame_count,f,Int32,0x0B,0,0,0, SaveSystem,graphics_name,f,String,0x15,'',0,0,string SaveSystem,message_stretch,f,Enum,0x16,0,0,0,Integer SaveSystem,font_id,f,Enum,0x17,0,0,0,Integer -SaveSystem,switches,t,Count,0x1F,0,0,0, +SaveSystem,switches,t,Count>,0x1F,0,0,0, SaveSystem,switches,f,Vector,0x20,,1,0, -SaveSystem,variables,t,Count,0x21,0,0,0, +SaveSystem,variables,t,Count>,0x21,0,0,0, SaveSystem,variables,f,Vector,0x22,,1,0, SaveSystem,message_transparent,f,Int32,0x29,0,0,0, SaveSystem,message_position,f,Int32,0x2A,2,0,0, @@ -866,13 +866,13 @@ SaveActor,attack_mod,f,Int32,0x29,0,0,0,int SaveActor,defense_mod,f,Int32,0x2A,0,0,0,int SaveActor,spirit_mod,f,Int32,0x2B,0,0,0,int SaveActor,agility_mod,f,Int32,0x2C,0,0,0,int -SaveActor,skills,t,Count,0x33,0,0,0,? +SaveActor,skills,t,Count>,0x33,0,0,0,? SaveActor,skills,f,Vector,0x34,,1,0,short[] SaveActor,equipped,f,Vector,0x3D,,1,0,short[5] SaveActor,current_hp,f,Int32,0x47,-1,0,0,int SaveActor,current_sp,f,Int32,0x48,-1,0,0,int SaveActor,battle_commands,f,Vector>,0x50,,0,1,array of (uncompressed) int32 -SaveActor,status,t,Count,0x51,0,0,0,? +SaveActor,status,t,Count>,0x51,0,0,0,? SaveActor,status,f,Vector,0x52,,1,0,array of short SaveActor,changed_battle_commands,f,Boolean,0x53,False,0,0,bool SaveActor,class_id,f,Ref,0x5A,-1,0,0,int class-id @@ -882,9 +882,9 @@ SaveActor,lock_equipment,f,Boolean,0x5D,False,0,1,bool SaveActor,auto_battle,f,Boolean,0x5E,False,0,1,bool SaveActor,super_guard,f,Boolean,0x5F,False,0,1,bool SaveActor,battler_animation,f,Ref,0x60,0,0,1,Integer - RPG2003 -SaveInventory,party,t,Count,0x01,0,1,0,? +SaveInventory,party,t,Count>,0x01,0,1,0,? SaveInventory,party,f,Vector,0x02,,1,0,? -SaveInventory,item_ids,t,Count,0x0B,0,1,0,? +SaveInventory,item_ids,t,Count>,0x0B,0,1,0,? SaveInventory,item_ids,f,Vector,0x0C,,1,0,short[]: item list SaveInventory,item_counts,f,Vector,0x0D,,1,0,? SaveInventory,item_usage,f,Vector,0x0E,,1,0,? @@ -908,12 +908,12 @@ SaveTarget,map_x,f,Int32,0x02,0,0,0,int SaveTarget,map_y,f,Int32,0x03,0,0,0,int SaveTarget,switch_on,f,Boolean,0x04,False,0,0,bool SaveTarget,switch_id,f,Ref,0x05,0,0,0,int -SaveEventExecFrame,commands,t,EventCommand,0x01,0,1,0,int +SaveEventExecFrame,commands,t,Vector,0x01,0,1,0,int SaveEventExecFrame,commands,f,Vector,0x02,,1,0,event command list SaveEventExecFrame,current_command,f,Int32,0x0B,0,0,0,int SaveEventExecFrame,event_id,f,Int32,0x0C,0,0,0,0 if it's common event or in other map SaveEventExecFrame,triggered_by_decision_key,f,Boolean,0x0D,False,0,0,Event was triggered by the Action Key -SaveEventExecFrame,subcommand_path,t,UInt8,0x15,0,0,0,size of the 0x16 vector - indention level +SaveEventExecFrame,subcommand_path,t,Vector,0x15,0,0,0,size of the 0x16 vector - indention level SaveEventExecFrame,subcommand_path,f,Vector,0x16,,1,0,byte For each indention level in the script; an ID is stored there which corresponds to the branch to take in case a command allows multiple branches. For example; the Show Choice command would write the result of the choice (for example 2 for the third item) into the current indention level's entry in this array; and the script processor would later look for the Case subcommand with the corresponding ID; if any; and jump to that one (if none found; it would jump to the End Case subcommand). Once the jump is executed; the ID is set to 255 (probably a protection mechanism even though there should normally not be multiple subcommands with the same ID). SaveEventExecState,stack,f,Array,0x01,,1,0,array SaveEventExecState,show_message,f,Boolean,0x04,False,0,0,Show Message command has been executed in the current move route @@ -1019,10 +1019,10 @@ Equipment,helmet_id,,Ref,,0,0,0, Equipment,accessory_id,,Ref,,0,0,0, EventCommand,code,,Enum,,0,0,0, EventCommand,indent,,Int32,,0,0,0, -EventCommand,string,,String,,'',0,0, -EventCommand,parameters,,Vector,,,0,0, +EventCommand,string,,DBString,,'',0,0, +EventCommand,parameters,,DBArray,,,0,0, MoveCommand,command_id,,Enum,,0,0,0, -MoveCommand,parameter_string,,String,,'',0,0, +MoveCommand,parameter_string,,DBString,,'',0,0, MoveCommand,parameter_a,,Int32,,0,0,0, MoveCommand,parameter_b,,Int32,,0,0,0, MoveCommand,parameter_c,,Int32,,0,0,0, diff --git a/generator/generate.py b/generator/generate.py index 36a04028a..572bc5eb7 100755 --- a/generator/generate.py +++ b/generator/generate.py @@ -34,6 +34,7 @@ 'Int16': 'int16_t', 'Int32': 'int32_t', 'String': 'std::string', + 'DBString': 'DBString', } # Additional Jinja 2 functions @@ -70,6 +71,9 @@ def cpp_type(ty, prefix=True): m = re.match(r'(Vector|Array)<(.*)>', ty) if m: return 'std::vector<%s>' % cpp_type(m.group(2), prefix) + m = re.match(r'DBArray<(.*)>', ty) + if m: + return 'DBArray<%s>' % cpp_type(m.group(1), prefix) m = re.match(r'Ref<(.*):(.*)>', ty) if m: @@ -100,7 +104,7 @@ def pod_default(field): ftype = field.type # Not a POD, no default - if dfl == '' or dfl == '\'\'' or ftype.startswith('Vector') or ftype.startswith('Array'): + if dfl == '' or dfl == '\'\'' or ftype.startswith('Vector') or ftype.startswith('Array') or ftype.startswith('DBArray'): return "" if ftype == 'Boolean': @@ -164,6 +168,9 @@ def struct_headers(ty, header_map): if ty == 'String': return [''] + if ty == 'DBString': + return ['"lcf/dbstring.h"'] + if ty in int_types or ty == "DatabaseVersion": return [''] @@ -191,6 +198,10 @@ def struct_headers(ty, header_map): if m: return [''] + struct_headers(m.group(2), header_map) + m = re.match(r'DBArray<(.*)>', ty) + if m: + return [''] + struct_headers(m.group(1), header_map) + header = header_map.get(ty) if header is not None: return ['"lcf/rpg/%s.h"' % header] @@ -336,7 +347,7 @@ def needs_ctor(struct_name): for method, hdrs in setup[struct_name]) def type_is_array(ty): - return re.match(r'(Vector|Array)<(.*)>', ty) + return re.match(r'(Vector|Array|DBArray)<(.*)>', ty) def is_monotonic_from_0(enum): expected = 0 diff --git a/src/dbarray.cpp b/src/dbarray.cpp new file mode 100644 index 000000000..4b2362c38 --- /dev/null +++ b/src/dbarray.cpp @@ -0,0 +1,91 @@ +#include "lcf/dbarrayalloc.h" +#include "lcf/dbarray.h" +#include "lcf/dbstring.h" +#include +#include + +//#define LCF_DEBUG_DBARRAY + +#ifdef LCF_DEBUG_DBARRAY +#include +#endif + +namespace lcf { + +constexpr DBArrayAlloc::size_type DBArrayAlloc::_empty_buf; +constexpr DBString::size_type DBString::npos; + +static ptrdiff_t HeaderSize(size_t align) { + return std::max(sizeof(DBArrayAlloc::size_type), align); +} + +static size_t AllocSize(size_t size, size_t align) { + return HeaderSize(align) + size; +} + +static void* Adjust(void* p, ptrdiff_t off) { + return reinterpret_cast(reinterpret_cast(p) + off); +} + +void* DBArrayAlloc::alloc(size_type size, size_type field_size, size_type align) { + if (field_size == 0) { + return empty_buf(); + } + assert(align <= alignof(std::max_align_t)); + auto* raw = ::operator new(AllocSize(size, align)); + auto* p = Adjust(raw, HeaderSize(align)); + *get_size_ptr(p) = field_size; +#ifdef LCF_DEBUG_DBARRAY + std::cout << "DBArray: Allocated" + << " size=" << size + << " field_size=" << *get_size_ptr(p) + << " align=" << align + << " ptr=" << raw + << " adjusted=" << p + << std::endl; +#endif + return p; +} + +void DBArrayAlloc::free(void* p, size_type align) noexcept { + assert(p != nullptr); + if (p != empty_buf()) { + auto* raw = Adjust(p, -HeaderSize(align)); +#ifdef LCF_DEBUG_DBARRAY + std::cout << "DBArray: Free" + << " align=" << align + << " ptr=" << raw + << " adjusted=" << p + << " field_size=" << *get_size_ptr(p) + << std::endl; +#endif + ::operator delete(raw); + } +} + +char* DBString::construct_z(const char* s, size_t len) { + auto* p = alloc(len); + if (len) { + std::memcpy(p, s, len + 1); + } + return p; +} + +char* DBString::construct_sv(const char* s, size_t len) { + auto* p = alloc(len); + if (len) { + std::memcpy(p, s, len); + p[len] = '\0'; + } + return p; +} + +DBString& DBString::operator=(const DBString& o) { + if (this != &o) { + destroy(); + _storage = construct_z(o.data(), o.size()); + } + return *this; +} + +} // namespace lcf diff --git a/src/generated/lcf/rpg/actor.h b/src/generated/lcf/rpg/actor.h index 629c9003a..d963830e3 100644 --- a/src/generated/lcf/rpg/actor.h +++ b/src/generated/lcf/rpg/actor.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/rpg/equipment.h" #include "lcf/rpg/learning.h" #include "lcf/rpg/parameters.h" @@ -31,16 +31,16 @@ namespace rpg { public: void Setup(); int ID = 0; - std::string name; - std::string title; - std::string character_name; + DBString name; + DBString title; + DBString character_name; int32_t character_index = 0; bool transparent = false; int32_t initial_level = 1; int32_t final_level = -1; bool critical_hit = true; int32_t critical_hit_chance = 30; - std::string face_name; + DBString face_name; int32_t face_index = 0; bool two_weapon = false; bool lock_equipment = false; @@ -58,7 +58,7 @@ namespace rpg { int32_t battler_animation = 1; std::vector skills; bool rename_skill = false; - std::string skill_name; + DBString skill_name; std::vector state_ranks; std::vector attribute_ranks; std::vector battle_commands; diff --git a/src/generated/lcf/rpg/animation.h b/src/generated/lcf/rpg/animation.h index da7e28bb1..f76d4cc9c 100644 --- a/src/generated/lcf/rpg/animation.h +++ b/src/generated/lcf/rpg/animation.h @@ -13,8 +13,8 @@ #define LCF_RPG_ANIMATION_H // Headers -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/animationframe.h" #include "lcf/rpg/animationtiming.h" @@ -48,8 +48,8 @@ namespace rpg { ); int ID = 0; - std::string name; - std::string animation_name; + DBString name; + DBString animation_name; bool large = false; std::vector timings; int32_t scope = 0; diff --git a/src/generated/lcf/rpg/attribute.h b/src/generated/lcf/rpg/attribute.h index 02d320f74..223a7b74c 100644 --- a/src/generated/lcf/rpg/attribute.h +++ b/src/generated/lcf/rpg/attribute.h @@ -14,7 +14,7 @@ // Headers #include -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -36,7 +36,7 @@ namespace rpg { ); int ID = 0; - std::string name; + DBString name; int32_t type = 0; int32_t a_rate = 300; int32_t b_rate = 200; diff --git a/src/generated/lcf/rpg/battlecommand.h b/src/generated/lcf/rpg/battlecommand.h index 47aebd848..fbd595a68 100644 --- a/src/generated/lcf/rpg/battlecommand.h +++ b/src/generated/lcf/rpg/battlecommand.h @@ -13,7 +13,7 @@ #define LCF_RPG_BATTLECOMMAND_H // Headers -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -45,7 +45,7 @@ namespace rpg { ); int ID = 0; - std::string name; + DBString name; int32_t type = 0; }; inline std::ostream& operator<<(std::ostream& os, BattleCommand::Type code) { diff --git a/src/generated/lcf/rpg/battleranimation.h b/src/generated/lcf/rpg/battleranimation.h index 5ad4ed58f..f689d80d7 100644 --- a/src/generated/lcf/rpg/battleranimation.h +++ b/src/generated/lcf/rpg/battleranimation.h @@ -13,8 +13,8 @@ #define LCF_RPG_BATTLERANIMATION_H // Headers -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/battleranimationextension.h" #include @@ -34,7 +34,7 @@ namespace rpg { }; int ID = 0; - std::string name; + DBString name; int32_t speed = 0; std::vector base_data; std::vector weapon_data; diff --git a/src/generated/lcf/rpg/battleranimationextension.h b/src/generated/lcf/rpg/battleranimationextension.h index 0169fdfec..63992c8a5 100644 --- a/src/generated/lcf/rpg/battleranimationextension.h +++ b/src/generated/lcf/rpg/battleranimationextension.h @@ -14,7 +14,7 @@ // Headers #include -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -36,8 +36,8 @@ namespace rpg { ); int ID = 0; - std::string name; - std::string battler_name; + DBString name; + DBString battler_name; int32_t battler_index = 0; int32_t animation_type = 0; int32_t animation_id = 1; diff --git a/src/generated/lcf/rpg/chipset.h b/src/generated/lcf/rpg/chipset.h index d322a6226..cf129ce9a 100644 --- a/src/generated/lcf/rpg/chipset.h +++ b/src/generated/lcf/rpg/chipset.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -39,8 +39,8 @@ namespace rpg { Chipset(); void Init(); int ID = 0; - std::string name; - std::string chipset_name; + DBString name; + DBString chipset_name; std::vector terrain_data; std::vector passable_data_lower; std::vector passable_data_upper; diff --git a/src/generated/lcf/rpg/class.h b/src/generated/lcf/rpg/class.h index 685dc32d9..95ac4110a 100644 --- a/src/generated/lcf/rpg/class.h +++ b/src/generated/lcf/rpg/class.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/rpg/learning.h" #include "lcf/rpg/parameters.h" #include @@ -29,7 +29,7 @@ namespace rpg { class Class { public: int ID = 0; - std::string name; + DBString name; bool two_weapon = false; bool lock_equipment = false; bool auto_battle = false; diff --git a/src/generated/lcf/rpg/commonevent.h b/src/generated/lcf/rpg/commonevent.h index 9315810f4..dcedcd0df 100644 --- a/src/generated/lcf/rpg/commonevent.h +++ b/src/generated/lcf/rpg/commonevent.h @@ -13,8 +13,8 @@ #define LCF_RPG_COMMONEVENT_H // Headers -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/eventcommand.h" #include @@ -34,7 +34,7 @@ namespace rpg { }; int ID = 0; - std::string name; + DBString name; int32_t trigger = 0; bool switch_flag = false; int32_t switch_id = 1; diff --git a/src/generated/lcf/rpg/enemy.h b/src/generated/lcf/rpg/enemy.h index b22cad9ce..10e75489e 100644 --- a/src/generated/lcf/rpg/enemy.h +++ b/src/generated/lcf/rpg/enemy.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/rpg/enemyaction.h" #include #include @@ -28,8 +28,8 @@ namespace rpg { class Enemy { public: int ID = 0; - std::string name; - std::string battler_name; + DBString name; + DBString battler_name; int32_t battler_hue = 0; int32_t max_hp = 10; int32_t max_sp = 10; diff --git a/src/generated/lcf/rpg/event.h b/src/generated/lcf/rpg/event.h index 5db6413ae..4d19ff137 100644 --- a/src/generated/lcf/rpg/event.h +++ b/src/generated/lcf/rpg/event.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/rpg/eventpage.h" #include #include @@ -28,7 +28,7 @@ namespace rpg { class Event { public: int ID = 0; - std::string name; + DBString name; int32_t x = 0; int32_t y = 0; std::vector pages; diff --git a/src/generated/lcf/rpg/eventcommand.h b/src/generated/lcf/rpg/eventcommand.h index c8913320c..bbd63a192 100644 --- a/src/generated/lcf/rpg/eventcommand.h +++ b/src/generated/lcf/rpg/eventcommand.h @@ -13,9 +13,9 @@ #define LCF_RPG_EVENTCOMMAND_H // Headers +#include #include -#include -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -179,8 +179,8 @@ namespace rpg { int32_t code = 0; int32_t indent = 0; - std::string string; - std::vector parameters; + DBString string; + DBArray parameters; }; inline std::ostream& operator<<(std::ostream& os, EventCommand::Code code) { os << static_cast>(code); diff --git a/src/generated/lcf/rpg/eventpage.h b/src/generated/lcf/rpg/eventpage.h index c93074189..b0e0c5e6c 100644 --- a/src/generated/lcf/rpg/eventpage.h +++ b/src/generated/lcf/rpg/eventpage.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/eventcommand.h" #include "lcf/rpg/eventpagecondition.h" @@ -125,7 +125,7 @@ namespace rpg { int ID = 0; EventPageCondition condition; - std::string character_name; + DBString character_name; int32_t character_index = 0; int32_t character_direction = 2; int32_t character_pattern = 1; diff --git a/src/generated/lcf/rpg/item.h b/src/generated/lcf/rpg/item.h index e86c23db2..ae63948c6 100644 --- a/src/generated/lcf/rpg/item.h +++ b/src/generated/lcf/rpg/item.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/itemanimation.h" #include @@ -76,8 +76,8 @@ namespace rpg { ); int ID = 0; - std::string name; - std::string description; + DBString name; + DBString description; int32_t type = 0; int32_t price = 0; int32_t uses = 1; diff --git a/src/generated/lcf/rpg/map.h b/src/generated/lcf/rpg/map.h index 4d258c01c..a0cfb104a 100644 --- a/src/generated/lcf/rpg/map.h +++ b/src/generated/lcf/rpg/map.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/event.h" #include @@ -67,7 +67,7 @@ namespace rpg { int32_t height = 15; int32_t scroll_type = 0; bool parallax_flag = false; - std::string parallax_name; + DBString parallax_name; bool parallax_loop_x = false; bool parallax_loop_y = false; bool parallax_auto_loop_x = false; diff --git a/src/generated/lcf/rpg/mapinfo.h b/src/generated/lcf/rpg/mapinfo.h index 8fd9614e2..f6fbe65d7 100644 --- a/src/generated/lcf/rpg/mapinfo.h +++ b/src/generated/lcf/rpg/mapinfo.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/encounter.h" #include "lcf/rpg/music.h" @@ -62,7 +62,7 @@ namespace rpg { ); int ID = 0; - std::string name; + DBString name; int32_t parent_map = 0; int32_t indentation = 0; int32_t type = -1; @@ -72,7 +72,7 @@ namespace rpg { int32_t music_type = 0; Music music; int32_t background_type = 0; - std::string background_name; + DBString background_name; int32_t teleport = 0; int32_t escape = 0; int32_t save = 0; diff --git a/src/generated/lcf/rpg/movecommand.h b/src/generated/lcf/rpg/movecommand.h index a157e38b2..4982b7e97 100644 --- a/src/generated/lcf/rpg/movecommand.h +++ b/src/generated/lcf/rpg/movecommand.h @@ -14,7 +14,7 @@ // Headers #include -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -116,7 +116,7 @@ namespace rpg { ); int32_t command_id = 0; - std::string parameter_string; + DBString parameter_string; int32_t parameter_a = 0; int32_t parameter_b = 0; int32_t parameter_c = 0; diff --git a/src/generated/lcf/rpg/skill.h b/src/generated/lcf/rpg/skill.h index ee3d767e5..db7a6a01d 100644 --- a/src/generated/lcf/rpg/skill.h +++ b/src/generated/lcf/rpg/skill.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/battleranimationdata.h" #include "lcf/rpg/sound.h" @@ -67,10 +67,10 @@ namespace rpg { ); int ID = 0; - std::string name; - std::string description; - std::string using_message1; - std::string using_message2; + DBString name; + DBString description; + DBString using_message1; + DBString using_message2; int32_t failure_message = 0; int32_t type = 0; int32_t sp_type = 0; diff --git a/src/generated/lcf/rpg/state.h b/src/generated/lcf/rpg/state.h index 8258a0551..15379db9a 100644 --- a/src/generated/lcf/rpg/state.h +++ b/src/generated/lcf/rpg/state.h @@ -14,7 +14,7 @@ // Headers #include -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include #include @@ -71,7 +71,7 @@ namespace rpg { ); int ID = 0; - std::string name; + DBString name; int32_t type = 0; int32_t color = 6; int32_t priority = 50; @@ -100,11 +100,11 @@ namespace rpg { int32_t restrict_magic_level = 0; int32_t hp_change_type = 0; int32_t sp_change_type = 0; - std::string message_actor; - std::string message_enemy; - std::string message_already; - std::string message_affected; - std::string message_recovery; + DBString message_actor; + DBString message_enemy; + DBString message_already; + DBString message_affected; + DBString message_recovery; int32_t hp_change_max = 0; int32_t hp_change_val = 0; int32_t hp_change_map_steps = 0; diff --git a/src/generated/lcf/rpg/switch.h b/src/generated/lcf/rpg/switch.h index c006529eb..25556288a 100644 --- a/src/generated/lcf/rpg/switch.h +++ b/src/generated/lcf/rpg/switch.h @@ -13,7 +13,7 @@ #define LCF_RPG_SWITCH_H // Headers -#include +#include "lcf/dbstring.h" #include #include @@ -25,7 +25,7 @@ namespace rpg { class Switch { public: int ID = 0; - std::string name; + DBString name; }; inline bool operator==(const Switch& l, const Switch& r) { diff --git a/src/generated/lcf/rpg/system.h b/src/generated/lcf/rpg/system.h index 1c9e41fd0..2bd9d32c0 100644 --- a/src/generated/lcf/rpg/system.h +++ b/src/generated/lcf/rpg/system.h @@ -14,8 +14,8 @@ // Headers #include -#include #include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/music.h" #include "lcf/rpg/sound.h" @@ -178,16 +178,16 @@ namespace rpg { System(); void Init(); int32_t ldb_id = 0; - std::string boat_name; - std::string ship_name; - std::string airship_name; + DBString boat_name; + DBString ship_name; + DBString airship_name; int32_t boat_index = 0; int32_t ship_index = 0; int32_t airship_index = 0; - std::string title_name; - std::string gameover_name; - std::string system_name; - std::string system2_name; + DBString title_name; + DBString gameover_name; + DBString system_name; + DBString system2_name; std::vector party; std::vector menu_commands; Music title_music; @@ -220,7 +220,7 @@ namespace rpg { int32_t font_id = 0; int32_t selected_condition = 0; int32_t selected_hero = 0; - std::string battletest_background; + DBString battletest_background; std::vector battletest_data; int32_t save_count = 0; int32_t battletest_terrain = 0; @@ -229,7 +229,7 @@ namespace rpg { int32_t equipment_setting = 0; int32_t battletest_alt_terrain = -1; bool show_frame = false; - std::string frame_name; + DBString frame_name; bool invert_animations = false; bool show_title = true; }; diff --git a/src/generated/lcf/rpg/terms.h b/src/generated/lcf/rpg/terms.h index 08d180e05..c6d85d066 100644 --- a/src/generated/lcf/rpg/terms.h +++ b/src/generated/lcf/rpg/terms.h @@ -13,7 +13,7 @@ #define LCF_RPG_TERMS_H // Headers -#include +#include "lcf/dbstring.h" #include #include @@ -24,133 +24,133 @@ namespace lcf { namespace rpg { class Terms { public: - std::string encounter; - std::string special_combat; - std::string escape_success; - std::string escape_failure; - std::string victory; - std::string defeat; - std::string exp_received; - std::string gold_recieved_a; - std::string gold_recieved_b; - std::string item_recieved; - std::string attacking; - std::string enemy_critical; - std::string actor_critical; - std::string defending; - std::string observing; - std::string focus; - std::string autodestruction; - std::string enemy_escape; - std::string enemy_transform; - std::string enemy_damaged; - std::string enemy_undamaged; - std::string actor_damaged; - std::string actor_undamaged; - std::string skill_failure_a; - std::string skill_failure_b; - std::string skill_failure_c; - std::string dodge; - std::string use_item; - std::string hp_recovery; - std::string parameter_increase; - std::string parameter_decrease; - std::string enemy_hp_absorbed; - std::string actor_hp_absorbed; - std::string resistance_increase; - std::string resistance_decrease; - std::string level_up; - std::string skill_learned; - std::string battle_start; - std::string miss; - std::string shop_greeting1; - std::string shop_regreeting1; - std::string shop_buy1; - std::string shop_sell1; - std::string shop_leave1; - std::string shop_buy_select1; - std::string shop_buy_number1; - std::string shop_purchased1; - std::string shop_sell_select1; - std::string shop_sell_number1; - std::string shop_sold1; - std::string shop_greeting2; - std::string shop_regreeting2; - std::string shop_buy2; - std::string shop_sell2; - std::string shop_leave2; - std::string shop_buy_select2; - std::string shop_buy_number2; - std::string shop_purchased2; - std::string shop_sell_select2; - std::string shop_sell_number2; - std::string shop_sold2; - std::string shop_greeting3; - std::string shop_regreeting3; - std::string shop_buy3; - std::string shop_sell3; - std::string shop_leave3; - std::string shop_buy_select3; - std::string shop_buy_number3; - std::string shop_purchased3; - std::string shop_sell_select3; - std::string shop_sell_number3; - std::string shop_sold3; - std::string inn_a_greeting_1; - std::string inn_a_greeting_2; - std::string inn_a_greeting_3; - std::string inn_a_accept; - std::string inn_a_cancel; - std::string inn_b_greeting_1; - std::string inn_b_greeting_2; - std::string inn_b_greeting_3; - std::string inn_b_accept; - std::string inn_b_cancel; - std::string possessed_items; - std::string equipped_items; - std::string gold; - std::string battle_fight; - std::string battle_auto; - std::string battle_escape; - std::string command_attack; - std::string command_defend; - std::string command_item; - std::string command_skill; - std::string menu_equipment; - std::string menu_save; - std::string menu_quit; - std::string new_game; - std::string load_game; - std::string exit_game; - std::string status; - std::string row; - std::string order; - std::string wait_on; - std::string wait_off; - std::string level; - std::string health_points; - std::string spirit_points; - std::string normal_status; - std::string exp_short; - std::string lvl_short; - std::string hp_short; - std::string sp_short; - std::string sp_cost; - std::string attack; - std::string defense; - std::string spirit; - std::string agility; - std::string weapon; - std::string shield; - std::string armor; - std::string helmet; - std::string accessory; - std::string save_game_message; - std::string load_game_message; - std::string file; - std::string exit_game_message; - std::string yes; - std::string no; + DBString encounter; + DBString special_combat; + DBString escape_success; + DBString escape_failure; + DBString victory; + DBString defeat; + DBString exp_received; + DBString gold_recieved_a; + DBString gold_recieved_b; + DBString item_recieved; + DBString attacking; + DBString enemy_critical; + DBString actor_critical; + DBString defending; + DBString observing; + DBString focus; + DBString autodestruction; + DBString enemy_escape; + DBString enemy_transform; + DBString enemy_damaged; + DBString enemy_undamaged; + DBString actor_damaged; + DBString actor_undamaged; + DBString skill_failure_a; + DBString skill_failure_b; + DBString skill_failure_c; + DBString dodge; + DBString use_item; + DBString hp_recovery; + DBString parameter_increase; + DBString parameter_decrease; + DBString enemy_hp_absorbed; + DBString actor_hp_absorbed; + DBString resistance_increase; + DBString resistance_decrease; + DBString level_up; + DBString skill_learned; + DBString battle_start; + DBString miss; + DBString shop_greeting1; + DBString shop_regreeting1; + DBString shop_buy1; + DBString shop_sell1; + DBString shop_leave1; + DBString shop_buy_select1; + DBString shop_buy_number1; + DBString shop_purchased1; + DBString shop_sell_select1; + DBString shop_sell_number1; + DBString shop_sold1; + DBString shop_greeting2; + DBString shop_regreeting2; + DBString shop_buy2; + DBString shop_sell2; + DBString shop_leave2; + DBString shop_buy_select2; + DBString shop_buy_number2; + DBString shop_purchased2; + DBString shop_sell_select2; + DBString shop_sell_number2; + DBString shop_sold2; + DBString shop_greeting3; + DBString shop_regreeting3; + DBString shop_buy3; + DBString shop_sell3; + DBString shop_leave3; + DBString shop_buy_select3; + DBString shop_buy_number3; + DBString shop_purchased3; + DBString shop_sell_select3; + DBString shop_sell_number3; + DBString shop_sold3; + DBString inn_a_greeting_1; + DBString inn_a_greeting_2; + DBString inn_a_greeting_3; + DBString inn_a_accept; + DBString inn_a_cancel; + DBString inn_b_greeting_1; + DBString inn_b_greeting_2; + DBString inn_b_greeting_3; + DBString inn_b_accept; + DBString inn_b_cancel; + DBString possessed_items; + DBString equipped_items; + DBString gold; + DBString battle_fight; + DBString battle_auto; + DBString battle_escape; + DBString command_attack; + DBString command_defend; + DBString command_item; + DBString command_skill; + DBString menu_equipment; + DBString menu_save; + DBString menu_quit; + DBString new_game; + DBString load_game; + DBString exit_game; + DBString status; + DBString row; + DBString order; + DBString wait_on; + DBString wait_off; + DBString level; + DBString health_points; + DBString spirit_points; + DBString normal_status; + DBString exp_short; + DBString lvl_short; + DBString hp_short; + DBString sp_short; + DBString sp_cost; + DBString attack; + DBString defense; + DBString spirit; + DBString agility; + DBString weapon; + DBString shield; + DBString armor; + DBString helmet; + DBString accessory; + DBString save_game_message; + DBString load_game_message; + DBString file; + DBString exit_game_message; + DBString yes; + DBString no; }; inline bool operator==(const Terms& l, const Terms& r) { diff --git a/src/generated/lcf/rpg/terrain.h b/src/generated/lcf/rpg/terrain.h index babf77918..73bc3e3b5 100644 --- a/src/generated/lcf/rpg/terrain.h +++ b/src/generated/lcf/rpg/terrain.h @@ -15,7 +15,7 @@ // Headers #include #include -#include +#include "lcf/dbstring.h" #include "lcf/enum_tags.h" #include "lcf/rpg/sound.h" #include @@ -50,10 +50,10 @@ namespace rpg { ); int ID = 0; - std::string name; + DBString name; int32_t damage = 0; int32_t encounter_rate = 100; - std::string background_name; + DBString background_name; bool boat_pass = false; bool ship_pass = false; bool airship_pass = true; @@ -62,13 +62,13 @@ namespace rpg { Sound footstep; bool on_damage_se = false; int32_t background_type = 0; - std::string background_a_name; + DBString background_a_name; bool background_a_scrollh = false; bool background_a_scrollv = false; int32_t background_a_scrollh_speed = 0; int32_t background_a_scrollv_speed = 0; bool background_b = false; - std::string background_b_name; + DBString background_b_name; bool background_b_scrollh = false; bool background_b_scrollv = false; int32_t background_b_scrollh_speed = 0; diff --git a/src/generated/lcf/rpg/troop.h b/src/generated/lcf/rpg/troop.h index 64c9e5a48..017277004 100644 --- a/src/generated/lcf/rpg/troop.h +++ b/src/generated/lcf/rpg/troop.h @@ -13,8 +13,8 @@ #define LCF_RPG_TROOP_H // Headers -#include #include +#include "lcf/dbstring.h" #include "lcf/rpg/troopmember.h" #include "lcf/rpg/trooppage.h" #include @@ -28,7 +28,7 @@ namespace rpg { class Troop { public: int ID = 0; - std::string name; + DBString name; std::vector members; bool auto_alignment = false; std::vector terrain_set; diff --git a/src/generated/lcf/rpg/variable.h b/src/generated/lcf/rpg/variable.h index b2246509c..36de194ed 100644 --- a/src/generated/lcf/rpg/variable.h +++ b/src/generated/lcf/rpg/variable.h @@ -13,7 +13,7 @@ #define LCF_RPG_VARIABLE_H // Headers -#include +#include "lcf/dbstring.h" #include #include @@ -25,7 +25,7 @@ namespace rpg { class Variable { public: int ID = 0; - std::string name; + DBString name; }; inline bool operator==(const Variable& l, const Variable& r) { diff --git a/src/generated/ldb_actor.cpp b/src/generated/ldb_actor.cpp index 16d4f4e84..7f167322f 100644 --- a/src/generated/ldb_actor.cpp +++ b/src/generated/ldb_actor.cpp @@ -20,21 +20,21 @@ namespace lcf { template <> char const* const Struct::name = "Actor"; -static TypedField static_name( +static TypedField static_name( &rpg::Actor::name, LDB_Reader::ChunkActor::name, "name", 0, 0 ); -static TypedField static_title( +static TypedField static_title( &rpg::Actor::title, LDB_Reader::ChunkActor::title, "title", 0, 0 ); -static TypedField static_character_name( +static TypedField static_character_name( &rpg::Actor::character_name, LDB_Reader::ChunkActor::character_name, "character_name", @@ -83,7 +83,7 @@ static TypedField static_critical_hit_chance( 0, 0 ); -static TypedField static_face_name( +static TypedField static_face_name( &rpg::Actor::face_name, LDB_Reader::ChunkActor::face_name, "face_name", @@ -209,14 +209,14 @@ static TypedField static_rename_skill( 0, 0 ); -static TypedField static_skill_name( +static TypedField static_skill_name( &rpg::Actor::skill_name, LDB_Reader::ChunkActor::skill_name, "skill_name", 0, 0 ); -static SizeField static_size_state_ranks( +static SizeField> static_size_state_ranks( &rpg::Actor::state_ranks, LDB_Reader::ChunkActor::state_ranks_size, 0, @@ -229,7 +229,7 @@ static TypedField> static_state_ranks( 1, 0 ); -static SizeField static_size_attribute_ranks( +static SizeField> static_size_attribute_ranks( &rpg::Actor::attribute_ranks, LDB_Reader::ChunkActor::attribute_ranks_size, 0, diff --git a/src/generated/ldb_animation.cpp b/src/generated/ldb_animation.cpp index 584daa2ba..838afd667 100644 --- a/src/generated/ldb_animation.cpp +++ b/src/generated/ldb_animation.cpp @@ -20,14 +20,14 @@ namespace lcf { template <> char const* const Struct::name = "Animation"; -static TypedField static_name( +static TypedField static_name( &rpg::Animation::name, LDB_Reader::ChunkAnimation::name, "name", 0, 0 ); -static TypedField static_animation_name( +static TypedField static_animation_name( &rpg::Animation::animation_name, LDB_Reader::ChunkAnimation::animation_name, "animation_name", diff --git a/src/generated/ldb_attribute.cpp b/src/generated/ldb_attribute.cpp index 1f4b4fae8..b7d973d0d 100644 --- a/src/generated/ldb_attribute.cpp +++ b/src/generated/ldb_attribute.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Attribute"; -static TypedField static_name( +static TypedField static_name( &rpg::Attribute::name, LDB_Reader::ChunkAttribute::name, "name", diff --git a/src/generated/ldb_battlecommand.cpp b/src/generated/ldb_battlecommand.cpp index e95cef651..8b26ee820 100644 --- a/src/generated/ldb_battlecommand.cpp +++ b/src/generated/ldb_battlecommand.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "BattleCommand"; -static TypedField static_name( +static TypedField static_name( &rpg::BattleCommand::name, LDB_Reader::ChunkBattleCommand::name, "name", diff --git a/src/generated/ldb_battleranimation.cpp b/src/generated/ldb_battleranimation.cpp index f7c7ca7f5..76c31b003 100644 --- a/src/generated/ldb_battleranimation.cpp +++ b/src/generated/ldb_battleranimation.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "BattlerAnimation"; -static TypedField static_name( +static TypedField static_name( &rpg::BattlerAnimation::name, LDB_Reader::ChunkBattlerAnimation::name, "name", diff --git a/src/generated/ldb_battleranimationextension.cpp b/src/generated/ldb_battleranimationextension.cpp index 4f40b881a..a37ac1fb6 100644 --- a/src/generated/ldb_battleranimationextension.cpp +++ b/src/generated/ldb_battleranimationextension.cpp @@ -20,14 +20,14 @@ namespace lcf { template <> char const* const Struct::name = "BattlerAnimationExtension"; -static TypedField static_name( +static TypedField static_name( &rpg::BattlerAnimationExtension::name, LDB_Reader::ChunkBattlerAnimationExtension::name, "name", 0, 0 ); -static TypedField static_battler_name( +static TypedField static_battler_name( &rpg::BattlerAnimationExtension::battler_name, LDB_Reader::ChunkBattlerAnimationExtension::battler_name, "battler_name", diff --git a/src/generated/ldb_chipset.cpp b/src/generated/ldb_chipset.cpp index e065e64af..aa5cd65e6 100644 --- a/src/generated/ldb_chipset.cpp +++ b/src/generated/ldb_chipset.cpp @@ -20,14 +20,14 @@ namespace lcf { template <> char const* const Struct::name = "Chipset"; -static TypedField static_name( +static TypedField static_name( &rpg::Chipset::name, LDB_Reader::ChunkChipset::name, "name", 0, 0 ); -static TypedField static_chipset_name( +static TypedField static_chipset_name( &rpg::Chipset::chipset_name, LDB_Reader::ChunkChipset::chipset_name, "chipset_name", diff --git a/src/generated/ldb_class.cpp b/src/generated/ldb_class.cpp index dfa0e5ee6..358d99b18 100644 --- a/src/generated/ldb_class.cpp +++ b/src/generated/ldb_class.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Class"; -static TypedField static_name( +static TypedField static_name( &rpg::Class::name, LDB_Reader::ChunkClass::name, "name", @@ -97,7 +97,7 @@ static TypedField> static_skills( 1, 0 ); -static SizeField static_size_state_ranks( +static SizeField> static_size_state_ranks( &rpg::Class::state_ranks, LDB_Reader::ChunkClass::state_ranks_size, 0, @@ -110,7 +110,7 @@ static TypedField> static_state_ranks( 1, 0 ); -static SizeField static_size_attribute_ranks( +static SizeField> static_size_attribute_ranks( &rpg::Class::attribute_ranks, LDB_Reader::ChunkClass::attribute_ranks_size, 0, diff --git a/src/generated/ldb_commonevent.cpp b/src/generated/ldb_commonevent.cpp index a2e9e3842..9b468662a 100644 --- a/src/generated/ldb_commonevent.cpp +++ b/src/generated/ldb_commonevent.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "CommonEvent"; -static TypedField static_name( +static TypedField static_name( &rpg::CommonEvent::name, LDB_Reader::ChunkCommonEvent::name, "name", @@ -48,7 +48,7 @@ static TypedField static_switch_id( 0, 0 ); -static SizeField static_size_event_commands( +static SizeField> static_size_event_commands( &rpg::CommonEvent::event_commands, LDB_Reader::ChunkCommonEvent::event_commands_size, 1, diff --git a/src/generated/ldb_enemy.cpp b/src/generated/ldb_enemy.cpp index 3c4f74c14..adb393a86 100644 --- a/src/generated/ldb_enemy.cpp +++ b/src/generated/ldb_enemy.cpp @@ -20,14 +20,14 @@ namespace lcf { template <> char const* const Struct::name = "Enemy"; -static TypedField static_name( +static TypedField static_name( &rpg::Enemy::name, LDB_Reader::ChunkEnemy::name, "name", 0, 0 ); -static TypedField static_battler_name( +static TypedField static_battler_name( &rpg::Enemy::battler_name, LDB_Reader::ChunkEnemy::battler_name, "battler_name", @@ -146,7 +146,7 @@ static TypedField static_levitate( 0, 0 ); -static SizeField static_size_state_ranks( +static SizeField> static_size_state_ranks( &rpg::Enemy::state_ranks, LDB_Reader::ChunkEnemy::state_ranks_size, 0, @@ -159,7 +159,7 @@ static TypedField> static_state_ranks( 1, 0 ); -static SizeField static_size_attribute_ranks( +static SizeField> static_size_attribute_ranks( &rpg::Enemy::attribute_ranks, LDB_Reader::ChunkEnemy::attribute_ranks_size, 0, diff --git a/src/generated/ldb_item.cpp b/src/generated/ldb_item.cpp index f2e7e2c5c..892c206b9 100644 --- a/src/generated/ldb_item.cpp +++ b/src/generated/ldb_item.cpp @@ -20,14 +20,14 @@ namespace lcf { template <> char const* const Struct::name = "Item"; -static TypedField static_name( +static TypedField static_name( &rpg::Item::name, LDB_Reader::ChunkItem::name, "name", 0, 0 ); -static TypedField static_description( +static TypedField static_description( &rpg::Item::description, LDB_Reader::ChunkItem::description, "description", @@ -307,7 +307,7 @@ static TypedField static_occasion_battle( 0, 0 ); -static SizeField static_size_actor_set( +static SizeField> static_size_actor_set( &rpg::Item::actor_set, LDB_Reader::ChunkItem::actor_set_size, 0, @@ -320,7 +320,7 @@ static TypedField> static_actor_set( 1, 0 ); -static SizeField static_size_state_set( +static SizeField> static_size_state_set( &rpg::Item::state_set, LDB_Reader::ChunkItem::state_set_size, 0, @@ -333,7 +333,7 @@ static TypedField> static_state_set( 1, 0 ); -static SizeField static_size_attribute_set( +static SizeField> static_size_attribute_set( &rpg::Item::attribute_set, LDB_Reader::ChunkItem::attribute_set_size, 0, @@ -381,7 +381,7 @@ static TypedField static_use_skill( 0, 1 ); -static SizeField static_size_class_set( +static SizeField> static_size_class_set( &rpg::Item::class_set, LDB_Reader::ChunkItem::class_set_size, 0, diff --git a/src/generated/ldb_skill.cpp b/src/generated/ldb_skill.cpp index 1e27bc173..06b41defa 100644 --- a/src/generated/ldb_skill.cpp +++ b/src/generated/ldb_skill.cpp @@ -20,28 +20,28 @@ namespace lcf { template <> char const* const Struct::name = "Skill"; -static TypedField static_name( +static TypedField static_name( &rpg::Skill::name, LDB_Reader::ChunkSkill::name, "name", 0, 0 ); -static TypedField static_description( +static TypedField static_description( &rpg::Skill::description, LDB_Reader::ChunkSkill::description, "description", 0, 0 ); -static TypedField static_using_message1( +static TypedField static_using_message1( &rpg::Skill::using_message1, LDB_Reader::ChunkSkill::using_message1, "using_message1", 0, 0 ); -static TypedField static_using_message2( +static TypedField static_using_message2( &rpg::Skill::using_message2, LDB_Reader::ChunkSkill::using_message2, "using_message2", @@ -223,7 +223,7 @@ static TypedField static_ignore_defense( 0, 0 ); -static SizeField static_size_state_effects( +static SizeField> static_size_state_effects( &rpg::Skill::state_effects, LDB_Reader::ChunkSkill::state_effects_size, 0, @@ -236,7 +236,7 @@ static TypedField> static_state_effects( 1, 0 ); -static SizeField static_size_attribute_effects( +static SizeField> static_size_attribute_effects( &rpg::Skill::attribute_effects, LDB_Reader::ChunkSkill::attribute_effects_size, 0, diff --git a/src/generated/ldb_state.cpp b/src/generated/ldb_state.cpp index 5c72fe7ba..c87f1567d 100644 --- a/src/generated/ldb_state.cpp +++ b/src/generated/ldb_state.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "State"; -static TypedField static_name( +static TypedField static_name( &rpg::State::name, LDB_Reader::ChunkState::name, "name", @@ -223,35 +223,35 @@ static TypedField static_sp_change_type( 0, 0 ); -static TypedField static_message_actor( +static TypedField static_message_actor( &rpg::State::message_actor, LDB_Reader::ChunkState::message_actor, "message_actor", 0, 0 ); -static TypedField static_message_enemy( +static TypedField static_message_enemy( &rpg::State::message_enemy, LDB_Reader::ChunkState::message_enemy, "message_enemy", 0, 0 ); -static TypedField static_message_already( +static TypedField static_message_already( &rpg::State::message_already, LDB_Reader::ChunkState::message_already, "message_already", 0, 0 ); -static TypedField static_message_affected( +static TypedField static_message_affected( &rpg::State::message_affected, LDB_Reader::ChunkState::message_affected, "message_affected", 0, 0 ); -static TypedField static_message_recovery( +static TypedField static_message_recovery( &rpg::State::message_recovery, LDB_Reader::ChunkState::message_recovery, "message_recovery", diff --git a/src/generated/ldb_switch.cpp b/src/generated/ldb_switch.cpp index f10b35083..37e1e1a46 100644 --- a/src/generated/ldb_switch.cpp +++ b/src/generated/ldb_switch.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Switch"; -static TypedField static_name( +static TypedField static_name( &rpg::Switch::name, LDB_Reader::ChunkSwitch::name, "name", diff --git a/src/generated/ldb_system.cpp b/src/generated/ldb_system.cpp index 6017b2ba0..cc8e41038 100644 --- a/src/generated/ldb_system.cpp +++ b/src/generated/ldb_system.cpp @@ -27,21 +27,21 @@ static TypedField static_ldb_id( 0, 0 ); -static TypedField static_boat_name( +static TypedField static_boat_name( &rpg::System::boat_name, LDB_Reader::ChunkSystem::boat_name, "boat_name", 0, 0 ); -static TypedField static_ship_name( +static TypedField static_ship_name( &rpg::System::ship_name, LDB_Reader::ChunkSystem::ship_name, "ship_name", 0, 0 ); -static TypedField static_airship_name( +static TypedField static_airship_name( &rpg::System::airship_name, LDB_Reader::ChunkSystem::airship_name, "airship_name", @@ -69,35 +69,35 @@ static TypedField static_airship_index( 0, 0 ); -static TypedField static_title_name( +static TypedField static_title_name( &rpg::System::title_name, LDB_Reader::ChunkSystem::title_name, "title_name", 0, 0 ); -static TypedField static_gameover_name( +static TypedField static_gameover_name( &rpg::System::gameover_name, LDB_Reader::ChunkSystem::gameover_name, "gameover_name", 0, 0 ); -static TypedField static_system_name( +static TypedField static_system_name( &rpg::System::system_name, LDB_Reader::ChunkSystem::system_name, "system_name", 0, 0 ); -static TypedField static_system2_name( +static TypedField static_system2_name( &rpg::System::system2_name, LDB_Reader::ChunkSystem::system2_name, "system2_name", 0, 1 ); -static CountField static_size_party( +static CountField> static_size_party( &rpg::System::party, LDB_Reader::ChunkSystem::party_size, 0, @@ -110,7 +110,7 @@ static TypedField> static_party( 1, 0 ); -static CountField static_size_menu_commands( +static CountField> static_size_menu_commands( &rpg::System::menu_commands, LDB_Reader::ChunkSystem::menu_commands_size, 0, @@ -333,7 +333,7 @@ static TypedField static_selected_hero( 1, 0 ); -static TypedField static_battletest_background( +static TypedField static_battletest_background( &rpg::System::battletest_background, LDB_Reader::ChunkSystem::battletest_background, "battletest_background", @@ -396,7 +396,7 @@ static TypedField static_show_frame( 0, 1 ); -static TypedField static_frame_name( +static TypedField static_frame_name( &rpg::System::frame_name, LDB_Reader::ChunkSystem::frame_name, "frame_name", diff --git a/src/generated/ldb_terms.cpp b/src/generated/ldb_terms.cpp index 71aecbee9..8ec48aa79 100644 --- a/src/generated/ldb_terms.cpp +++ b/src/generated/ldb_terms.cpp @@ -20,889 +20,889 @@ namespace lcf { template <> char const* const Struct::name = "Terms"; -static TypedField static_encounter( +static TypedField static_encounter( &rpg::Terms::encounter, LDB_Reader::ChunkTerms::encounter, "encounter", 1, 0 ); -static TypedField static_special_combat( +static TypedField static_special_combat( &rpg::Terms::special_combat, LDB_Reader::ChunkTerms::special_combat, "special_combat", 1, 0 ); -static TypedField static_escape_success( +static TypedField static_escape_success( &rpg::Terms::escape_success, LDB_Reader::ChunkTerms::escape_success, "escape_success", 1, 0 ); -static TypedField static_escape_failure( +static TypedField static_escape_failure( &rpg::Terms::escape_failure, LDB_Reader::ChunkTerms::escape_failure, "escape_failure", 1, 0 ); -static TypedField static_victory( +static TypedField static_victory( &rpg::Terms::victory, LDB_Reader::ChunkTerms::victory, "victory", 1, 0 ); -static TypedField static_defeat( +static TypedField static_defeat( &rpg::Terms::defeat, LDB_Reader::ChunkTerms::defeat, "defeat", 1, 0 ); -static TypedField static_exp_received( +static TypedField static_exp_received( &rpg::Terms::exp_received, LDB_Reader::ChunkTerms::exp_received, "exp_received", 1, 0 ); -static TypedField static_gold_recieved_a( +static TypedField static_gold_recieved_a( &rpg::Terms::gold_recieved_a, LDB_Reader::ChunkTerms::gold_recieved_a, "gold_recieved_a", 1, 0 ); -static TypedField static_gold_recieved_b( +static TypedField static_gold_recieved_b( &rpg::Terms::gold_recieved_b, LDB_Reader::ChunkTerms::gold_recieved_b, "gold_recieved_b", 1, 0 ); -static TypedField static_item_recieved( +static TypedField static_item_recieved( &rpg::Terms::item_recieved, LDB_Reader::ChunkTerms::item_recieved, "item_recieved", 1, 0 ); -static TypedField static_attacking( +static TypedField static_attacking( &rpg::Terms::attacking, LDB_Reader::ChunkTerms::attacking, "attacking", 1, 0 ); -static TypedField static_enemy_critical( +static TypedField static_enemy_critical( &rpg::Terms::enemy_critical, LDB_Reader::ChunkTerms::enemy_critical, "enemy_critical", 1, 0 ); -static TypedField static_actor_critical( +static TypedField static_actor_critical( &rpg::Terms::actor_critical, LDB_Reader::ChunkTerms::actor_critical, "actor_critical", 1, 0 ); -static TypedField static_defending( +static TypedField static_defending( &rpg::Terms::defending, LDB_Reader::ChunkTerms::defending, "defending", 1, 0 ); -static TypedField static_observing( +static TypedField static_observing( &rpg::Terms::observing, LDB_Reader::ChunkTerms::observing, "observing", 1, 0 ); -static TypedField static_focus( +static TypedField static_focus( &rpg::Terms::focus, LDB_Reader::ChunkTerms::focus, "focus", 1, 0 ); -static TypedField static_autodestruction( +static TypedField static_autodestruction( &rpg::Terms::autodestruction, LDB_Reader::ChunkTerms::autodestruction, "autodestruction", 1, 0 ); -static TypedField static_enemy_escape( +static TypedField static_enemy_escape( &rpg::Terms::enemy_escape, LDB_Reader::ChunkTerms::enemy_escape, "enemy_escape", 1, 0 ); -static TypedField static_enemy_transform( +static TypedField static_enemy_transform( &rpg::Terms::enemy_transform, LDB_Reader::ChunkTerms::enemy_transform, "enemy_transform", 1, 0 ); -static TypedField static_enemy_damaged( +static TypedField static_enemy_damaged( &rpg::Terms::enemy_damaged, LDB_Reader::ChunkTerms::enemy_damaged, "enemy_damaged", 1, 0 ); -static TypedField static_enemy_undamaged( +static TypedField static_enemy_undamaged( &rpg::Terms::enemy_undamaged, LDB_Reader::ChunkTerms::enemy_undamaged, "enemy_undamaged", 1, 0 ); -static TypedField static_actor_damaged( +static TypedField static_actor_damaged( &rpg::Terms::actor_damaged, LDB_Reader::ChunkTerms::actor_damaged, "actor_damaged", 1, 0 ); -static TypedField static_actor_undamaged( +static TypedField static_actor_undamaged( &rpg::Terms::actor_undamaged, LDB_Reader::ChunkTerms::actor_undamaged, "actor_undamaged", 1, 0 ); -static TypedField static_skill_failure_a( +static TypedField static_skill_failure_a( &rpg::Terms::skill_failure_a, LDB_Reader::ChunkTerms::skill_failure_a, "skill_failure_a", 1, 0 ); -static TypedField static_skill_failure_b( +static TypedField static_skill_failure_b( &rpg::Terms::skill_failure_b, LDB_Reader::ChunkTerms::skill_failure_b, "skill_failure_b", 1, 0 ); -static TypedField static_skill_failure_c( +static TypedField static_skill_failure_c( &rpg::Terms::skill_failure_c, LDB_Reader::ChunkTerms::skill_failure_c, "skill_failure_c", 1, 0 ); -static TypedField static_dodge( +static TypedField static_dodge( &rpg::Terms::dodge, LDB_Reader::ChunkTerms::dodge, "dodge", 1, 0 ); -static TypedField static_use_item( +static TypedField static_use_item( &rpg::Terms::use_item, LDB_Reader::ChunkTerms::use_item, "use_item", 1, 0 ); -static TypedField static_hp_recovery( +static TypedField static_hp_recovery( &rpg::Terms::hp_recovery, LDB_Reader::ChunkTerms::hp_recovery, "hp_recovery", 1, 0 ); -static TypedField static_parameter_increase( +static TypedField static_parameter_increase( &rpg::Terms::parameter_increase, LDB_Reader::ChunkTerms::parameter_increase, "parameter_increase", 1, 0 ); -static TypedField static_parameter_decrease( +static TypedField static_parameter_decrease( &rpg::Terms::parameter_decrease, LDB_Reader::ChunkTerms::parameter_decrease, "parameter_decrease", 1, 0 ); -static TypedField static_enemy_hp_absorbed( +static TypedField static_enemy_hp_absorbed( &rpg::Terms::enemy_hp_absorbed, LDB_Reader::ChunkTerms::enemy_hp_absorbed, "enemy_hp_absorbed", 1, 0 ); -static TypedField static_actor_hp_absorbed( +static TypedField static_actor_hp_absorbed( &rpg::Terms::actor_hp_absorbed, LDB_Reader::ChunkTerms::actor_hp_absorbed, "actor_hp_absorbed", 1, 0 ); -static TypedField static_resistance_increase( +static TypedField static_resistance_increase( &rpg::Terms::resistance_increase, LDB_Reader::ChunkTerms::resistance_increase, "resistance_increase", 1, 0 ); -static TypedField static_resistance_decrease( +static TypedField static_resistance_decrease( &rpg::Terms::resistance_decrease, LDB_Reader::ChunkTerms::resistance_decrease, "resistance_decrease", 1, 0 ); -static TypedField static_level_up( +static TypedField static_level_up( &rpg::Terms::level_up, LDB_Reader::ChunkTerms::level_up, "level_up", 1, 0 ); -static TypedField static_skill_learned( +static TypedField static_skill_learned( &rpg::Terms::skill_learned, LDB_Reader::ChunkTerms::skill_learned, "skill_learned", 1, 0 ); -static TypedField static_battle_start( +static TypedField static_battle_start( &rpg::Terms::battle_start, LDB_Reader::ChunkTerms::battle_start, "battle_start", 1, 1 ); -static TypedField static_miss( +static TypedField static_miss( &rpg::Terms::miss, LDB_Reader::ChunkTerms::miss, "miss", 1, 1 ); -static TypedField static_shop_greeting1( +static TypedField static_shop_greeting1( &rpg::Terms::shop_greeting1, LDB_Reader::ChunkTerms::shop_greeting1, "shop_greeting1", 1, 0 ); -static TypedField static_shop_regreeting1( +static TypedField static_shop_regreeting1( &rpg::Terms::shop_regreeting1, LDB_Reader::ChunkTerms::shop_regreeting1, "shop_regreeting1", 1, 0 ); -static TypedField static_shop_buy1( +static TypedField static_shop_buy1( &rpg::Terms::shop_buy1, LDB_Reader::ChunkTerms::shop_buy1, "shop_buy1", 1, 0 ); -static TypedField static_shop_sell1( +static TypedField static_shop_sell1( &rpg::Terms::shop_sell1, LDB_Reader::ChunkTerms::shop_sell1, "shop_sell1", 1, 0 ); -static TypedField static_shop_leave1( +static TypedField static_shop_leave1( &rpg::Terms::shop_leave1, LDB_Reader::ChunkTerms::shop_leave1, "shop_leave1", 1, 0 ); -static TypedField static_shop_buy_select1( +static TypedField static_shop_buy_select1( &rpg::Terms::shop_buy_select1, LDB_Reader::ChunkTerms::shop_buy_select1, "shop_buy_select1", 1, 0 ); -static TypedField static_shop_buy_number1( +static TypedField static_shop_buy_number1( &rpg::Terms::shop_buy_number1, LDB_Reader::ChunkTerms::shop_buy_number1, "shop_buy_number1", 1, 0 ); -static TypedField static_shop_purchased1( +static TypedField static_shop_purchased1( &rpg::Terms::shop_purchased1, LDB_Reader::ChunkTerms::shop_purchased1, "shop_purchased1", 1, 0 ); -static TypedField static_shop_sell_select1( +static TypedField static_shop_sell_select1( &rpg::Terms::shop_sell_select1, LDB_Reader::ChunkTerms::shop_sell_select1, "shop_sell_select1", 1, 0 ); -static TypedField static_shop_sell_number1( +static TypedField static_shop_sell_number1( &rpg::Terms::shop_sell_number1, LDB_Reader::ChunkTerms::shop_sell_number1, "shop_sell_number1", 1, 0 ); -static TypedField static_shop_sold1( +static TypedField static_shop_sold1( &rpg::Terms::shop_sold1, LDB_Reader::ChunkTerms::shop_sold1, "shop_sold1", 1, 0 ); -static TypedField static_shop_greeting2( +static TypedField static_shop_greeting2( &rpg::Terms::shop_greeting2, LDB_Reader::ChunkTerms::shop_greeting2, "shop_greeting2", 1, 0 ); -static TypedField static_shop_regreeting2( +static TypedField static_shop_regreeting2( &rpg::Terms::shop_regreeting2, LDB_Reader::ChunkTerms::shop_regreeting2, "shop_regreeting2", 1, 0 ); -static TypedField static_shop_buy2( +static TypedField static_shop_buy2( &rpg::Terms::shop_buy2, LDB_Reader::ChunkTerms::shop_buy2, "shop_buy2", 1, 0 ); -static TypedField static_shop_sell2( +static TypedField static_shop_sell2( &rpg::Terms::shop_sell2, LDB_Reader::ChunkTerms::shop_sell2, "shop_sell2", 1, 0 ); -static TypedField static_shop_leave2( +static TypedField static_shop_leave2( &rpg::Terms::shop_leave2, LDB_Reader::ChunkTerms::shop_leave2, "shop_leave2", 1, 0 ); -static TypedField static_shop_buy_select2( +static TypedField static_shop_buy_select2( &rpg::Terms::shop_buy_select2, LDB_Reader::ChunkTerms::shop_buy_select2, "shop_buy_select2", 1, 0 ); -static TypedField static_shop_buy_number2( +static TypedField static_shop_buy_number2( &rpg::Terms::shop_buy_number2, LDB_Reader::ChunkTerms::shop_buy_number2, "shop_buy_number2", 1, 0 ); -static TypedField static_shop_purchased2( +static TypedField static_shop_purchased2( &rpg::Terms::shop_purchased2, LDB_Reader::ChunkTerms::shop_purchased2, "shop_purchased2", 1, 0 ); -static TypedField static_shop_sell_select2( +static TypedField static_shop_sell_select2( &rpg::Terms::shop_sell_select2, LDB_Reader::ChunkTerms::shop_sell_select2, "shop_sell_select2", 1, 0 ); -static TypedField static_shop_sell_number2( +static TypedField static_shop_sell_number2( &rpg::Terms::shop_sell_number2, LDB_Reader::ChunkTerms::shop_sell_number2, "shop_sell_number2", 1, 0 ); -static TypedField static_shop_sold2( +static TypedField static_shop_sold2( &rpg::Terms::shop_sold2, LDB_Reader::ChunkTerms::shop_sold2, "shop_sold2", 1, 0 ); -static TypedField static_shop_greeting3( +static TypedField static_shop_greeting3( &rpg::Terms::shop_greeting3, LDB_Reader::ChunkTerms::shop_greeting3, "shop_greeting3", 1, 0 ); -static TypedField static_shop_regreeting3( +static TypedField static_shop_regreeting3( &rpg::Terms::shop_regreeting3, LDB_Reader::ChunkTerms::shop_regreeting3, "shop_regreeting3", 1, 0 ); -static TypedField static_shop_buy3( +static TypedField static_shop_buy3( &rpg::Terms::shop_buy3, LDB_Reader::ChunkTerms::shop_buy3, "shop_buy3", 1, 0 ); -static TypedField static_shop_sell3( +static TypedField static_shop_sell3( &rpg::Terms::shop_sell3, LDB_Reader::ChunkTerms::shop_sell3, "shop_sell3", 1, 0 ); -static TypedField static_shop_leave3( +static TypedField static_shop_leave3( &rpg::Terms::shop_leave3, LDB_Reader::ChunkTerms::shop_leave3, "shop_leave3", 1, 0 ); -static TypedField static_shop_buy_select3( +static TypedField static_shop_buy_select3( &rpg::Terms::shop_buy_select3, LDB_Reader::ChunkTerms::shop_buy_select3, "shop_buy_select3", 1, 0 ); -static TypedField static_shop_buy_number3( +static TypedField static_shop_buy_number3( &rpg::Terms::shop_buy_number3, LDB_Reader::ChunkTerms::shop_buy_number3, "shop_buy_number3", 1, 0 ); -static TypedField static_shop_purchased3( +static TypedField static_shop_purchased3( &rpg::Terms::shop_purchased3, LDB_Reader::ChunkTerms::shop_purchased3, "shop_purchased3", 1, 0 ); -static TypedField static_shop_sell_select3( +static TypedField static_shop_sell_select3( &rpg::Terms::shop_sell_select3, LDB_Reader::ChunkTerms::shop_sell_select3, "shop_sell_select3", 1, 0 ); -static TypedField static_shop_sell_number3( +static TypedField static_shop_sell_number3( &rpg::Terms::shop_sell_number3, LDB_Reader::ChunkTerms::shop_sell_number3, "shop_sell_number3", 1, 0 ); -static TypedField static_shop_sold3( +static TypedField static_shop_sold3( &rpg::Terms::shop_sold3, LDB_Reader::ChunkTerms::shop_sold3, "shop_sold3", 1, 0 ); -static TypedField static_inn_a_greeting_1( +static TypedField static_inn_a_greeting_1( &rpg::Terms::inn_a_greeting_1, LDB_Reader::ChunkTerms::inn_a_greeting_1, "inn_a_greeting_1", 1, 0 ); -static TypedField static_inn_a_greeting_2( +static TypedField static_inn_a_greeting_2( &rpg::Terms::inn_a_greeting_2, LDB_Reader::ChunkTerms::inn_a_greeting_2, "inn_a_greeting_2", 1, 0 ); -static TypedField static_inn_a_greeting_3( +static TypedField static_inn_a_greeting_3( &rpg::Terms::inn_a_greeting_3, LDB_Reader::ChunkTerms::inn_a_greeting_3, "inn_a_greeting_3", 1, 0 ); -static TypedField static_inn_a_accept( +static TypedField static_inn_a_accept( &rpg::Terms::inn_a_accept, LDB_Reader::ChunkTerms::inn_a_accept, "inn_a_accept", 1, 0 ); -static TypedField static_inn_a_cancel( +static TypedField static_inn_a_cancel( &rpg::Terms::inn_a_cancel, LDB_Reader::ChunkTerms::inn_a_cancel, "inn_a_cancel", 1, 0 ); -static TypedField static_inn_b_greeting_1( +static TypedField static_inn_b_greeting_1( &rpg::Terms::inn_b_greeting_1, LDB_Reader::ChunkTerms::inn_b_greeting_1, "inn_b_greeting_1", 1, 0 ); -static TypedField static_inn_b_greeting_2( +static TypedField static_inn_b_greeting_2( &rpg::Terms::inn_b_greeting_2, LDB_Reader::ChunkTerms::inn_b_greeting_2, "inn_b_greeting_2", 1, 0 ); -static TypedField static_inn_b_greeting_3( +static TypedField static_inn_b_greeting_3( &rpg::Terms::inn_b_greeting_3, LDB_Reader::ChunkTerms::inn_b_greeting_3, "inn_b_greeting_3", 1, 0 ); -static TypedField static_inn_b_accept( +static TypedField static_inn_b_accept( &rpg::Terms::inn_b_accept, LDB_Reader::ChunkTerms::inn_b_accept, "inn_b_accept", 1, 0 ); -static TypedField static_inn_b_cancel( +static TypedField static_inn_b_cancel( &rpg::Terms::inn_b_cancel, LDB_Reader::ChunkTerms::inn_b_cancel, "inn_b_cancel", 1, 0 ); -static TypedField static_possessed_items( +static TypedField static_possessed_items( &rpg::Terms::possessed_items, LDB_Reader::ChunkTerms::possessed_items, "possessed_items", 1, 0 ); -static TypedField static_equipped_items( +static TypedField static_equipped_items( &rpg::Terms::equipped_items, LDB_Reader::ChunkTerms::equipped_items, "equipped_items", 1, 0 ); -static TypedField static_gold( +static TypedField static_gold( &rpg::Terms::gold, LDB_Reader::ChunkTerms::gold, "gold", 1, 0 ); -static TypedField static_battle_fight( +static TypedField static_battle_fight( &rpg::Terms::battle_fight, LDB_Reader::ChunkTerms::battle_fight, "battle_fight", 1, 0 ); -static TypedField static_battle_auto( +static TypedField static_battle_auto( &rpg::Terms::battle_auto, LDB_Reader::ChunkTerms::battle_auto, "battle_auto", 1, 0 ); -static TypedField static_battle_escape( +static TypedField static_battle_escape( &rpg::Terms::battle_escape, LDB_Reader::ChunkTerms::battle_escape, "battle_escape", 1, 0 ); -static TypedField static_command_attack( +static TypedField static_command_attack( &rpg::Terms::command_attack, LDB_Reader::ChunkTerms::command_attack, "command_attack", 1, 0 ); -static TypedField static_command_defend( +static TypedField static_command_defend( &rpg::Terms::command_defend, LDB_Reader::ChunkTerms::command_defend, "command_defend", 1, 0 ); -static TypedField static_command_item( +static TypedField static_command_item( &rpg::Terms::command_item, LDB_Reader::ChunkTerms::command_item, "command_item", 1, 0 ); -static TypedField static_command_skill( +static TypedField static_command_skill( &rpg::Terms::command_skill, LDB_Reader::ChunkTerms::command_skill, "command_skill", 1, 0 ); -static TypedField static_menu_equipment( +static TypedField static_menu_equipment( &rpg::Terms::menu_equipment, LDB_Reader::ChunkTerms::menu_equipment, "menu_equipment", 1, 0 ); -static TypedField static_menu_save( +static TypedField static_menu_save( &rpg::Terms::menu_save, LDB_Reader::ChunkTerms::menu_save, "menu_save", 1, 0 ); -static TypedField static_menu_quit( +static TypedField static_menu_quit( &rpg::Terms::menu_quit, LDB_Reader::ChunkTerms::menu_quit, "menu_quit", 1, 0 ); -static TypedField static_new_game( +static TypedField static_new_game( &rpg::Terms::new_game, LDB_Reader::ChunkTerms::new_game, "new_game", 1, 0 ); -static TypedField static_load_game( +static TypedField static_load_game( &rpg::Terms::load_game, LDB_Reader::ChunkTerms::load_game, "load_game", 1, 0 ); -static TypedField static_exit_game( +static TypedField static_exit_game( &rpg::Terms::exit_game, LDB_Reader::ChunkTerms::exit_game, "exit_game", 1, 0 ); -static TypedField static_status( +static TypedField static_status( &rpg::Terms::status, LDB_Reader::ChunkTerms::status, "status", 1, 1 ); -static TypedField static_row( +static TypedField static_row( &rpg::Terms::row, LDB_Reader::ChunkTerms::row, "row", 1, 1 ); -static TypedField static_order( +static TypedField static_order( &rpg::Terms::order, LDB_Reader::ChunkTerms::order, "order", 1, 1 ); -static TypedField static_wait_on( +static TypedField static_wait_on( &rpg::Terms::wait_on, LDB_Reader::ChunkTerms::wait_on, "wait_on", 1, 1 ); -static TypedField static_wait_off( +static TypedField static_wait_off( &rpg::Terms::wait_off, LDB_Reader::ChunkTerms::wait_off, "wait_off", 1, 1 ); -static TypedField static_level( +static TypedField static_level( &rpg::Terms::level, LDB_Reader::ChunkTerms::level, "level", 1, 0 ); -static TypedField static_health_points( +static TypedField static_health_points( &rpg::Terms::health_points, LDB_Reader::ChunkTerms::health_points, "health_points", 1, 0 ); -static TypedField static_spirit_points( +static TypedField static_spirit_points( &rpg::Terms::spirit_points, LDB_Reader::ChunkTerms::spirit_points, "spirit_points", 1, 0 ); -static TypedField static_normal_status( +static TypedField static_normal_status( &rpg::Terms::normal_status, LDB_Reader::ChunkTerms::normal_status, "normal_status", 1, 0 ); -static TypedField static_exp_short( +static TypedField static_exp_short( &rpg::Terms::exp_short, LDB_Reader::ChunkTerms::exp_short, "exp_short", 1, 0 ); -static TypedField static_lvl_short( +static TypedField static_lvl_short( &rpg::Terms::lvl_short, LDB_Reader::ChunkTerms::lvl_short, "lvl_short", 1, 0 ); -static TypedField static_hp_short( +static TypedField static_hp_short( &rpg::Terms::hp_short, LDB_Reader::ChunkTerms::hp_short, "hp_short", 1, 0 ); -static TypedField static_sp_short( +static TypedField static_sp_short( &rpg::Terms::sp_short, LDB_Reader::ChunkTerms::sp_short, "sp_short", 1, 0 ); -static TypedField static_sp_cost( +static TypedField static_sp_cost( &rpg::Terms::sp_cost, LDB_Reader::ChunkTerms::sp_cost, "sp_cost", 1, 0 ); -static TypedField static_attack( +static TypedField static_attack( &rpg::Terms::attack, LDB_Reader::ChunkTerms::attack, "attack", 1, 0 ); -static TypedField static_defense( +static TypedField static_defense( &rpg::Terms::defense, LDB_Reader::ChunkTerms::defense, "defense", 1, 0 ); -static TypedField static_spirit( +static TypedField static_spirit( &rpg::Terms::spirit, LDB_Reader::ChunkTerms::spirit, "spirit", 1, 0 ); -static TypedField static_agility( +static TypedField static_agility( &rpg::Terms::agility, LDB_Reader::ChunkTerms::agility, "agility", 1, 0 ); -static TypedField static_weapon( +static TypedField static_weapon( &rpg::Terms::weapon, LDB_Reader::ChunkTerms::weapon, "weapon", 1, 0 ); -static TypedField static_shield( +static TypedField static_shield( &rpg::Terms::shield, LDB_Reader::ChunkTerms::shield, "shield", 1, 0 ); -static TypedField static_armor( +static TypedField static_armor( &rpg::Terms::armor, LDB_Reader::ChunkTerms::armor, "armor", 1, 0 ); -static TypedField static_helmet( +static TypedField static_helmet( &rpg::Terms::helmet, LDB_Reader::ChunkTerms::helmet, "helmet", 1, 0 ); -static TypedField static_accessory( +static TypedField static_accessory( &rpg::Terms::accessory, LDB_Reader::ChunkTerms::accessory, "accessory", 1, 0 ); -static TypedField static_save_game_message( +static TypedField static_save_game_message( &rpg::Terms::save_game_message, LDB_Reader::ChunkTerms::save_game_message, "save_game_message", 1, 0 ); -static TypedField static_load_game_message( +static TypedField static_load_game_message( &rpg::Terms::load_game_message, LDB_Reader::ChunkTerms::load_game_message, "load_game_message", 1, 0 ); -static TypedField static_file( +static TypedField static_file( &rpg::Terms::file, LDB_Reader::ChunkTerms::file, "file", 1, 0 ); -static TypedField static_exit_game_message( +static TypedField static_exit_game_message( &rpg::Terms::exit_game_message, LDB_Reader::ChunkTerms::exit_game_message, "exit_game_message", 1, 0 ); -static TypedField static_yes( +static TypedField static_yes( &rpg::Terms::yes, LDB_Reader::ChunkTerms::yes, "yes", 1, 0 ); -static TypedField static_no( +static TypedField static_no( &rpg::Terms::no, LDB_Reader::ChunkTerms::no, "no", diff --git a/src/generated/ldb_terrain.cpp b/src/generated/ldb_terrain.cpp index e9db887e1..64f0cc0c4 100644 --- a/src/generated/ldb_terrain.cpp +++ b/src/generated/ldb_terrain.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Terrain"; -static TypedField static_name( +static TypedField static_name( &rpg::Terrain::name, LDB_Reader::ChunkTerrain::name, "name", @@ -41,7 +41,7 @@ static TypedField static_encounter_rate( 0, 0 ); -static TypedField static_background_name( +static TypedField static_background_name( &rpg::Terrain::background_name, LDB_Reader::ChunkTerrain::background_name, "background_name", @@ -104,7 +104,7 @@ static TypedField static_background_type( 0, 1 ); -static TypedField static_background_a_name( +static TypedField static_background_a_name( &rpg::Terrain::background_a_name, LDB_Reader::ChunkTerrain::background_a_name, "background_a_name", @@ -146,7 +146,7 @@ static TypedField static_background_b( 0, 1 ); -static TypedField static_background_b_name( +static TypedField static_background_b_name( &rpg::Terrain::background_b_name, LDB_Reader::ChunkTerrain::background_b_name, "background_b_name", diff --git a/src/generated/ldb_troop.cpp b/src/generated/ldb_troop.cpp index 46a4ddc46..363080929 100644 --- a/src/generated/ldb_troop.cpp +++ b/src/generated/ldb_troop.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Troop"; -static TypedField static_name( +static TypedField static_name( &rpg::Troop::name, LDB_Reader::ChunkTroop::name, "name", @@ -41,7 +41,7 @@ static TypedField static_auto_alignment( 0, 1 ); -static SizeField static_size_terrain_set( +static SizeField> static_size_terrain_set( &rpg::Troop::terrain_set, LDB_Reader::ChunkTroop::terrain_set_size, 0, diff --git a/src/generated/ldb_trooppage.cpp b/src/generated/ldb_trooppage.cpp index c1d3a1081..966dab4cb 100644 --- a/src/generated/ldb_trooppage.cpp +++ b/src/generated/ldb_trooppage.cpp @@ -27,7 +27,7 @@ static TypedField static_condition( 1, 0 ); -static SizeField static_size_event_commands( +static SizeField> static_size_event_commands( &rpg::TroopPage::event_commands, LDB_Reader::ChunkTroopPage::event_commands_size, 1, diff --git a/src/generated/ldb_variable.cpp b/src/generated/ldb_variable.cpp index 7b15524fc..0e4204ca4 100644 --- a/src/generated/ldb_variable.cpp +++ b/src/generated/ldb_variable.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Variable"; -static TypedField static_name( +static TypedField static_name( &rpg::Variable::name, LDB_Reader::ChunkVariable::name, "name", diff --git a/src/generated/lmt_mapinfo.cpp b/src/generated/lmt_mapinfo.cpp index 8ad6c1ca4..0e6202e7b 100644 --- a/src/generated/lmt_mapinfo.cpp +++ b/src/generated/lmt_mapinfo.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "MapInfo"; -static TypedField static_name( +static TypedField static_name( &rpg::MapInfo::name, LMT_Reader::ChunkMapInfo::name, "name", @@ -90,7 +90,7 @@ static TypedField static_background_type( 1, 0 ); -static TypedField static_background_name( +static TypedField static_background_name( &rpg::MapInfo::background_name, LMT_Reader::ChunkMapInfo::background_name, "background_name", diff --git a/src/generated/lmu_event.cpp b/src/generated/lmu_event.cpp index 3cef1d040..3d63fa2cf 100644 --- a/src/generated/lmu_event.cpp +++ b/src/generated/lmu_event.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "Event"; -static TypedField static_name( +static TypedField static_name( &rpg::Event::name, LMU_Reader::ChunkEvent::name, "name", diff --git a/src/generated/lmu_eventpage.cpp b/src/generated/lmu_eventpage.cpp index 519b37ac2..73967a556 100644 --- a/src/generated/lmu_eventpage.cpp +++ b/src/generated/lmu_eventpage.cpp @@ -27,7 +27,7 @@ static TypedField static_condition( 1, 0 ); -static TypedField static_character_name( +static TypedField static_character_name( &rpg::EventPage::character_name, LMU_Reader::ChunkEventPage::character_name, "character_name", @@ -118,7 +118,7 @@ static TypedField static_move_route( 1, 0 ); -static SizeField static_size_event_commands( +static SizeField> static_size_event_commands( &rpg::EventPage::event_commands, LMU_Reader::ChunkEventPage::event_commands_size, 1, diff --git a/src/generated/lmu_map.cpp b/src/generated/lmu_map.cpp index 7cae4c7a2..19562434d 100644 --- a/src/generated/lmu_map.cpp +++ b/src/generated/lmu_map.cpp @@ -55,7 +55,7 @@ static TypedField static_parallax_flag( 0, 0 ); -static TypedField static_parallax_name( +static TypedField static_parallax_name( &rpg::Map::parallax_name, LMU_Reader::ChunkMap::parallax_name, "parallax_name", diff --git a/src/generated/lmu_moveroute.cpp b/src/generated/lmu_moveroute.cpp index f6779e9f8..6dfc7563e 100644 --- a/src/generated/lmu_moveroute.cpp +++ b/src/generated/lmu_moveroute.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "MoveRoute"; -static SizeField static_size_move_commands( +static SizeField> static_size_move_commands( &rpg::MoveRoute::move_commands, LMU_Reader::ChunkMoveRoute::move_commands_size, 0, diff --git a/src/generated/lsd_saveactor.cpp b/src/generated/lsd_saveactor.cpp index 6e6905a1b..a9a362d32 100644 --- a/src/generated/lsd_saveactor.cpp +++ b/src/generated/lsd_saveactor.cpp @@ -125,7 +125,7 @@ static TypedField static_agility_mod( 0, 0 ); -static CountField static_size_skills( +static CountField> static_size_skills( &rpg::SaveActor::skills, LSD_Reader::ChunkSaveActor::skills_size, 0, @@ -166,7 +166,7 @@ static TypedField> static_battle_commands( 0, 1 ); -static CountField static_size_status( +static CountField> static_size_status( &rpg::SaveActor::status, LSD_Reader::ChunkSaveActor::status_size, 0, diff --git a/src/generated/lsd_saveeventexecframe.cpp b/src/generated/lsd_saveeventexecframe.cpp index 76211b376..0f952a21c 100644 --- a/src/generated/lsd_saveeventexecframe.cpp +++ b/src/generated/lsd_saveeventexecframe.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "SaveEventExecFrame"; -static SizeField static_size_commands( +static SizeField> static_size_commands( &rpg::SaveEventExecFrame::commands, LSD_Reader::ChunkSaveEventExecFrame::commands_size, 1, @@ -54,7 +54,7 @@ static TypedField static_triggered_by_decision_ke 0, 0 ); -static SizeField static_size_subcommand_path( +static SizeField> static_size_subcommand_path( &rpg::SaveEventExecFrame::subcommand_path, LSD_Reader::ChunkSaveEventExecFrame::subcommand_path_size, 0, diff --git a/src/generated/lsd_saveinventory.cpp b/src/generated/lsd_saveinventory.cpp index 82eaf0fbd..1514306f7 100644 --- a/src/generated/lsd_saveinventory.cpp +++ b/src/generated/lsd_saveinventory.cpp @@ -20,7 +20,7 @@ namespace lcf { template <> char const* const Struct::name = "SaveInventory"; -static CountField static_size_party( +static CountField> static_size_party( &rpg::SaveInventory::party, LSD_Reader::ChunkSaveInventory::party_size, 1, @@ -33,7 +33,7 @@ static TypedField> static_party( 1, 0 ); -static CountField static_size_item_ids( +static CountField> static_size_item_ids( &rpg::SaveInventory::item_ids, LSD_Reader::ChunkSaveInventory::item_ids_size, 1, diff --git a/src/generated/lsd_savesystem.cpp b/src/generated/lsd_savesystem.cpp index ab9294f54..029175f24 100644 --- a/src/generated/lsd_savesystem.cpp +++ b/src/generated/lsd_savesystem.cpp @@ -55,7 +55,7 @@ static TypedField static_font_id( 0, 0 ); -static CountField static_size_switches( +static CountField> static_size_switches( &rpg::SaveSystem::switches, LSD_Reader::ChunkSaveSystem::switches_size, 0, @@ -68,7 +68,7 @@ static TypedField> static_switches( 1, 0 ); -static CountField static_size_variables( +static CountField> static_size_variables( &rpg::SaveSystem::variables, LSD_Reader::ChunkSaveSystem::variables_size, 0, diff --git a/src/lcf/dbarray.h b/src/lcf/dbarray.h new file mode 100644 index 000000000..6415c510f --- /dev/null +++ b/src/lcf/dbarray.h @@ -0,0 +1,191 @@ +/* + * This file is part of liblcf. Copyright (c) 2020 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#ifndef LCF_DBARRAY_H +#define LCF_DBARRAY_H +#include +#include +#include +#include +#include +#include +#include + +#include "lcf/dbarrayalloc.h" +#include "lcf/scope_guard.h" + +namespace lcf { + +// An array data structure optimized for database storage. +// Low memory footprint and not dynamically resizable. +template +class DBArray { + public: + using value_type = T; + using size_type = DBArrayAlloc::size_type; + + using iterator = T*; + using const_iterator = const T*; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + constexpr DBArray() = default; + explicit DBArray(size_type count) { + construct(count, [](void* p) { new (p) T(); }); + } + + explicit DBArray(size_type count, const T& value) { + construct(count, [&](void* p) { new (p) T(value); }); + } + + template ::iterator_category>::value, int>::type = 0 + > + DBArray(Iter first, Iter last) { + construct(std::distance(first, last), [&](void* p) { new (p) T(*first); ++first; }); + } + + DBArray(std::initializer_list ilist) + : DBArray(ilist.begin(), ilist.end()) {} + + DBArray(const DBArray& o) : DBArray(o.begin(), o.end()) {} + DBArray(DBArray&& o) noexcept { swap(o); } + + DBArray& operator=(const DBArray&); + DBArray& operator=(DBArray&& o) noexcept; + + void swap(DBArray& o) noexcept { + std::swap(_storage, o._storage); + } + + ~DBArray() { destroy(); } + + T& operator[](size_type i) { return data()[i]; } + const T& operator[](size_type i) const { return data()[i]; } + + T& front() { return (*this)[0]; } + const T& front() const { return (*this)[0]; } + + T& back() { return (*this)[size()-1]; } + const T& back() const { return (*this)[size()-1]; } + + T* data() { return reinterpret_cast(_storage); } + const T* data() const { return reinterpret_cast(_storage); } + + iterator begin() { return data(); } + iterator end() { return data() + size(); } + + const_iterator begin() const { return data(); } + const_iterator end() const { return data() + size(); } + + const_iterator cbegin() const { return begin(); } + const_iterator cend() const { return end(); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + const_reverse_iterator crbegin() const { return rbegin(); } + const_reverse_iterator crend() const { return rend(); } + + bool empty() const { return size() == 0; } + size_type size() const { return *DBArrayAlloc::get_size_ptr(_storage); } + + private: + T* alloc(size_t count) { + return reinterpret_cast(DBArrayAlloc::alloc(count * sizeof(T), count, alignof(T))); + } + + void free(void* p) { + DBArrayAlloc::free(p, alignof(T)); + } + + template + void construct(size_type count, const F& make); + + void destroy() noexcept; + void destroy_impl(size_type n) noexcept; + private: + void* _storage = DBArrayAlloc::empty_buf(); +}; + +template +inline bool operator==(const DBArray& l, const DBArray& r) { return std::equal(l.begin(), l.end(), r.begin(), r.end()); } +template +inline bool operator!=(const DBArray& l, const DBArray& r) { return !(l == r); } +template +inline bool operator<(const DBArray& l, const DBArray& r) { return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end()); } +template +inline bool operator>(const DBArray& l, const DBArray& r) { return r < l; } +template +inline bool operator<=(const DBArray& l, const DBArray& r) { return !(l > r); } +template +inline bool operator>=(const DBArray& l, const DBArray& r) { return !(l < r); } + +} // namespace lcf + +namespace lcf { + +template +inline DBArray& DBArray::operator=(const DBArray& o) { + if (this != &o) { + destroy(); + if (!o.empty()) { + auto iter = o.begin(); + construct(o.size(), [&](void* p) { new (p) T(*(iter++)); }); + } + } + return *this; +} + +template +inline DBArray& DBArray::operator=(DBArray&& o) noexcept { + if (this != &o) { + destroy(); + swap(o); + } + return *this; +} + +template +template +void DBArray::construct(size_type count, const F& make) { + auto* p = alloc(count); + + size_type i = 0; + auto rollback = makeScopeGuard([&]() { destroy_impl(i); }); + for (size_type i = 0; i < count; ++i) { + make(p + i); + } + rollback.Dismiss(); + _storage = p; +} + +template +void DBArray::destroy() noexcept { + if (_storage != DBArrayAlloc::empty_buf()) { + destroy_impl(size()); + _storage = DBArrayAlloc::empty_buf(); + } +} + +template +void DBArray::destroy_impl(size_type n) noexcept { + while (n > 0) { + data()[--n].~T(); + } + free(_storage); +} + +} // namespace lcf + +#endif diff --git a/src/lcf/dbarrayalloc.h b/src/lcf/dbarrayalloc.h new file mode 100644 index 000000000..6cb6e8709 --- /dev/null +++ b/src/lcf/dbarrayalloc.h @@ -0,0 +1,46 @@ +/* + * This file is part of liblcf. Copyright (c) 2020 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#ifndef LCF_DBARRAYALLOC_H +#define LCF_DBARRAYALLOC_H +#include +#include +#include +#include +#include +#include +#include + +namespace lcf { + +struct DBArrayAlloc { + using size_type = uint32_t; + + static void* alloc(size_type size, size_type field_size, size_type align); + static void free(void* p, size_type align) noexcept; + + static constexpr void* empty_buf() { + return const_cast(&_empty_buf + 1); + } + + static constexpr size_type* get_size_ptr(void* p) { + return static_cast(p) - 1; + } + + static constexpr const size_type* get_size_ptr(const void* p) { + return static_cast(p) - 1; + } + + private: + static constexpr const size_type _empty_buf = 0; +}; + +} // namespace lcf + +#endif diff --git a/src/lcf/dbstring.h b/src/lcf/dbstring.h new file mode 100644 index 000000000..686aeb3cd --- /dev/null +++ b/src/lcf/dbstring.h @@ -0,0 +1,174 @@ +/* + * This file is part of liblcf. Copyright (c) 2020 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#ifndef LCF_DBSTRING_H +#define LCF_DBSTRING_H +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lcf/string_view.h" +#include "lcf/dbarrayalloc.h" + +namespace lcf { + +// A custom string class optimized for database storage. +// This string type is good for storing and retrieving values. +// It is not good for string manipulation like insertion or concatenation. +class DBString { + public: + using value_type = char; + using size_type = uint32_t; + + using char_type = value_type; // <- FIXME: HACK to workaround bug in older versions of fmtlib for Player: https://github.com/fmtlib/fmt/issues/1539 + using traits_type = std::char_traits; + + using iterator = char*; + using const_iterator = const char*; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + static constexpr size_type npos = size_type(-1); + + constexpr DBString() = default; + explicit DBString(StringView s) : _storage(construct_sv(s.data(), s.size())) {} + explicit DBString(const std::string& s) : _storage(construct_z(s.c_str(), s.size())) {} + + // Explicit construct for general const char* + explicit DBString(const char* s) : DBString(StringView(s)) {} + // Implicit constructor to capture string literals + template + DBString(const char(&literal)[N]) : _storage(construct_z(literal, N - 1)) {} + DBString(const char* s, size_t len) : DBString(StringView(s, len)) {} + + DBString(const DBString& o) : DBString(StringView(o)) {} + DBString(DBString&& o) noexcept { swap(o); } + + DBString& operator=(const DBString&); + DBString& operator=(DBString&&) noexcept; + + void swap(DBString& o) noexcept { + std::swap(_storage, o._storage); + } + + ~DBString() { destroy(); } + + explicit operator std::string() const { return std::string(data(), size()); } + operator StringView() const { return StringView(data(), size()); } + + char& operator[](size_type i) { return data()[i]; } + char operator[](size_type i) const { return data()[i]; } + + char& front() { return (*this)[0]; } + char front() const { return (*this)[0]; } + + char& back() { return (*this)[size()-1]; } + char back() const { return (*this)[size()-1]; } + + char* data() { return static_cast(_storage); } + const char* data() const { return static_cast(_storage); } + + const char* c_str() const { return data(); } + + iterator begin() { return data(); } + iterator end() { return data() + size(); } + + const_iterator begin() const { return data(); } + const_iterator end() const { return data() + size(); } + + const_iterator cbegin() const { return begin(); } + const_iterator cend() const { return end(); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + const_reverse_iterator crbegin() const { return rbegin(); } + const_reverse_iterator crend() const { return rend(); } + + bool empty() const { return size() == 0; } + size_type size() const { return *DBArrayAlloc::get_size_ptr(_storage); } + + private: + char* alloc(size_t count) { + return reinterpret_cast(DBArrayAlloc::alloc(count + 1, count, 1)); + } + void free(void* p) { + DBArrayAlloc::free(p, 1); + } + void destroy() noexcept; + char* construct_z(const char* s, size_t len); + char* construct_sv(const char* s, size_t len); + private: + void* _storage = DBArrayAlloc::empty_buf(); +}; + +// This should be used over the conversion operator, so we can track all dbstr -> str instances +inline std::string ToString(const DBString& s) { + return std::string(s); +} + +#define LCF_DBSTRING_MAKE_CMP_OPS(LTYPE, RTYPE) \ +inline bool operator==(LTYPE l, RTYPE r) { return StringView(l) == StringView(r); }\ +inline bool operator!=(LTYPE l, RTYPE r) { return StringView(l) != StringView(r); }\ +inline bool operator<(LTYPE l, RTYPE r) { return StringView(l) < StringView(r); }\ +inline bool operator>(LTYPE l, RTYPE r) { return StringView(l) > StringView(r); }\ +inline bool operator<=(LTYPE l, RTYPE r) { return StringView(l) <= StringView(r); }\ +inline bool operator>=(LTYPE l, RTYPE r) { return StringView(l) >= StringView(r); }\ + +LCF_DBSTRING_MAKE_CMP_OPS(const DBString&, const DBString&); +LCF_DBSTRING_MAKE_CMP_OPS(StringView, const DBString&); +LCF_DBSTRING_MAKE_CMP_OPS(const DBString&, StringView); +LCF_DBSTRING_MAKE_CMP_OPS(const char*, const DBString&); +LCF_DBSTRING_MAKE_CMP_OPS(const DBString&, const char*); + +inline std::ostream& operator<<(std::ostream& os, const DBString& s) { + os << StringView(s); + return os; +} + +} // namespace lcf + +namespace std { + +template <> struct hash { + size_t operator()(const lcf::DBString& s) const { + return std::hash()(lcf::StringView(s)); + } +}; + +} // namespace std + +namespace lcf { + +inline DBString& DBString::operator=(DBString&& o) noexcept { + if (this != &o) { + destroy(); + swap(o); + } + return *this; +} + +inline void DBString::destroy() noexcept { + if (_storage != DBArrayAlloc::empty_buf()) { + free(_storage); + _storage = DBArrayAlloc::empty_buf(); + } +} + +} // namespace lcf + +#endif diff --git a/src/lcf/reader_lcf.h b/src/lcf/reader_lcf.h index 80a5cd985..89578fa36 100644 --- a/src/lcf/reader_lcf.h +++ b/src/lcf/reader_lcf.h @@ -11,6 +11,7 @@ #define LCF_READER_LCF_H #include "lcf/config.h" +#include "lcf/dbstring.h" #include #include @@ -139,6 +140,7 @@ class LcfReader { * Note: The string is converted to UTF-8. */ void ReadString(std::string& ref, size_t size); + void ReadString(DBString& ref, size_t size); /** * Checks if the file is readable and if no error occured. @@ -219,6 +221,9 @@ class LcfReader { /** @return a buffer which can be reused for parsing */ std::vector& IntBuffer(); + /** @return a buffer which can be reused for parsing */ + std::string& StrBuffer(); + private: /** File-stream managed by this Reader. */ std::istream& stream; @@ -230,6 +235,8 @@ class LcfReader { Encoder encoder; /** A temporary buffer to be used in parsing */ std::vector buffer; + /** A temporary buffer to be used in parsing */ + std::string str_buffer; /** * Converts a 16bit signed integer to/from little-endian. @@ -271,6 +278,10 @@ inline std::vector& LcfReader::IntBuffer() { return buffer; } +inline std::string& LcfReader::StrBuffer() { + return str_buffer; +} + } //namespace lcf #endif diff --git a/src/lcf/reader_util.h b/src/lcf/reader_util.h index 0ba4dedc7..2b68d4d34 100644 --- a/src/lcf/reader_util.h +++ b/src/lcf/reader_util.h @@ -12,6 +12,7 @@ #include #include +#include "lcf/string_view.h" namespace lcf { @@ -43,7 +44,7 @@ namespace ReaderUtil { * * @return encoding or empty string if not detected. */ - std::string DetectEncoding(const std::string& data); + std::string DetectEncoding(StringView data); /** * Detects the encoding based on text analysis and returns a vector with @@ -63,7 +64,7 @@ namespace ReaderUtil { * * @return list of encodings or empty if not detected */ - std::vector DetectEncodings(const std::string& data); + std::vector DetectEncodings(StringView data); /** * Returns the encoding set in the ini file. @@ -98,7 +99,7 @@ namespace ReaderUtil { * * @return the recoded string. */ - std::string Recode(const std::string& str_to_encode, const std::string& source_encoding); + std::string Recode(StringView str_to_encode, StringView source_encoding); /** * Converts a string between encodings. @@ -108,9 +109,9 @@ namespace ReaderUtil { * @param dst_enc the destination encoding. * @return the recoded string. */ - std::string Recode(const std::string& str_to_encode, - const std::string& src_enc, - const std::string& dst_enc); + std::string Recode(StringView str_to_encode, + StringView src_enc, + StringView dst_enc); /** * Converts a UTF-8 string to lowercase and then decomposes it. @@ -118,7 +119,7 @@ namespace ReaderUtil { * @param str the string to normalize. * @return the normalized string. */ - std::string Normalize(const std::string &str); + std::string Normalize(StringView str); /** diff --git a/src/lcf/reader_xml.h b/src/lcf/reader_xml.h index ce2638ca1..f8e4fc9a2 100644 --- a/src/lcf/reader_xml.h +++ b/src/lcf/reader_xml.h @@ -11,6 +11,7 @@ #define LCF_READER_XML_H #include "lcf/config.h" +#include "lcf/dbarray.h" #include #include @@ -80,6 +81,12 @@ class XmlReader { template static void ReadVector(std::vector& ref, const std::string& data); + /** + * Parses a vector of primitive type. + */ + template + static void ReadVector(DBArray& ref, const std::string& data); + /** * Start element callback. */ diff --git a/src/lcf/writer_lcf.h b/src/lcf/writer_lcf.h index 59969a515..96a8f9d41 100644 --- a/src/lcf/writer_lcf.h +++ b/src/lcf/writer_lcf.h @@ -11,6 +11,7 @@ #define LCF_WRITER_LCF_H #include "lcf/config.h" +#include "lcf/dbstring.h" #include #include @@ -67,6 +68,7 @@ class LcfWriter { * Note: the string is converted to the native encoding. */ void Write(const std::string& str); + void Write(const DBString& str); /** * Writes a compressed integer to the stream. @@ -105,7 +107,7 @@ class LcfWriter { * @param str_to_encode UTF-8 string to encode. * @return native version of string. */ - std::string Decode(const std::string& str_to_encode); + std::string Decode(StringView str_to_encode); private: /** File-stream managed by this Writer. */ diff --git a/src/lcf/writer_xml.h b/src/lcf/writer_xml.h index 7c123c504..d0766a6b8 100644 --- a/src/lcf/writer_xml.h +++ b/src/lcf/writer_xml.h @@ -15,6 +15,8 @@ #include #include #include +#include "lcf/string_view.h" +#include "lcf/span.h" namespace lcf { @@ -119,9 +121,10 @@ class XmlWriter { * * @param val vector to write. */ - template - void WriteVector(const std::vector& val); + template + void WriteVector(const ArrayType& val); + void WriteString(StringView s); }; } //namespace lcf diff --git a/src/ldb_eventcommand.cpp b/src/ldb_eventcommand.cpp index 70884951e..dfa5797f2 100644 --- a/src/ldb_eventcommand.cpp +++ b/src/ldb_eventcommand.cpp @@ -48,8 +48,7 @@ void RawStruct::ReadLcf(rpg::EventCommand& event_command, Lcf param_buf.push_back(stream.ReadInt()); } if (!param_buf.empty()) { - event_command.parameters.reserve(param_buf.size()); - event_command.parameters.assign(param_buf.begin(), param_buf.end()); + event_command.parameters = DBArray(param_buf.begin(), param_buf.end()); } } } @@ -80,10 +79,10 @@ int RawStruct::LcfSize(const rpg::EventCommand& event_command void RawStruct::WriteXml(const rpg::EventCommand& event_command, XmlWriter& stream) { stream.BeginElement("EventCommand"); - stream.WriteNode("code", event_command.code); - stream.WriteNode("indent", event_command.indent); - stream.WriteNode("string", event_command.string); - stream.WriteNode>("parameters", event_command.parameters); + stream.WriteNode("code", event_command.code); + stream.WriteNode("indent", event_command.indent); + stream.WriteNode("string", event_command.string); + stream.WriteNode("parameters", event_command.parameters); stream.EndElement("EventCommand"); } @@ -121,16 +120,16 @@ class EventCommandXmlHandler : public XmlHandler { case None: break; case Code: - XmlReader::Read(ref.code, data); + XmlReader::Read(ref.code, data); break; case Indent: - XmlReader::Read(ref.indent, data); + XmlReader::Read(ref.indent, data); break; case String: - XmlReader::Read(ref.string, data); + XmlReader::Read(ref.string, data); break; case Parameters: - XmlReader::Read>(ref.parameters, data); + XmlReader::Read(ref.parameters, data); break; } } diff --git a/src/lmu_movecommand.cpp b/src/lmu_movecommand.cpp index 95afa44ce..78d4956f8 100644 --- a/src/lmu_movecommand.cpp +++ b/src/lmu_movecommand.cpp @@ -114,24 +114,24 @@ int RawStruct::LcfSize(const rpg::MoveCommand& ref, LcfWriter& void RawStruct::WriteXml(const rpg::MoveCommand& ref, XmlWriter& stream) { stream.BeginElement("MoveCommand"); - stream.WriteNode("command_id", ref.command_id); + stream.WriteNode("command_id", ref.command_id); const auto cmd = static_cast(ref.command_id); switch (cmd) { case rpg::MoveCommand::Code::switch_on: - stream.WriteNode("parameter_a", ref.parameter_a); + stream.WriteNode("parameter_a", ref.parameter_a); break; case rpg::MoveCommand::Code::switch_off: - stream.WriteNode("parameter_a", ref.parameter_a); + stream.WriteNode("parameter_a", ref.parameter_a); break; case rpg::MoveCommand::Code::change_graphic: - stream.WriteNode("parameter_string", ref.parameter_string); - stream.WriteNode("parameter_a", ref.parameter_a); + stream.WriteNode("parameter_string", ref.parameter_string); + stream.WriteNode("parameter_a", ref.parameter_a); break; case rpg::MoveCommand::Code::play_sound_effect: - stream.WriteNode("parameter_string", ref.parameter_string); - stream.WriteNode("parameter_a", ref.parameter_a); - stream.WriteNode("parameter_b", ref.parameter_b); - stream.WriteNode("parameter_c", ref.parameter_c); + stream.WriteNode("parameter_string", ref.parameter_string); + stream.WriteNode("parameter_a", ref.parameter_a); + stream.WriteNode("parameter_b", ref.parameter_b); + stream.WriteNode("parameter_c", ref.parameter_c); break; default: break; } @@ -169,9 +169,9 @@ class MoveCommandXmlHandler : public XmlHandler { } void CharacterData(XmlReader& /* stream */, const std::string& data) { if (field != NULL) - XmlReader::Read(*field, data); + XmlReader::Read(*field, data); else if (parameter_string) - XmlReader::Read(ref.parameter_string, data); + XmlReader::Read(ref.parameter_string, data); } }; diff --git a/src/reader_lcf.cpp b/src/reader_lcf.cpp index 98459547b..8d4a564bd 100644 --- a/src/reader_lcf.cpp +++ b/src/reader_lcf.cpp @@ -190,6 +190,12 @@ void LcfReader::ReadString(std::string& ref, size_t size) { Encode(ref); } +void LcfReader::ReadString(DBString& ref, size_t size) { + auto& tmp = StrBuffer(); + ReadString(tmp, size); + ref = DBString(tmp); +} + bool LcfReader::IsOk() const { return stream.good() && encoder.IsOk(); } diff --git a/src/reader_struct.h b/src/reader_struct.h index 8dc3f61ba..a71bcf901 100644 --- a/src/reader_struct.h +++ b/src/reader_struct.h @@ -20,6 +20,7 @@ #include #include #include +#include "lcf/dbstring.h" #include "lcf/reader_lcf.h" #include "lcf/writer_lcf.h" #include "lcf/reader_xml.h" @@ -51,7 +52,8 @@ struct Category { Primitive, Struct, Flags, - RawStruct + RawStruct, + Void }; }; @@ -80,6 +82,7 @@ template <> struct TypeCategory { static const Category::Index val template <> struct TypeCategory { static const Category::Index value = Category::Primitive; }; template <> struct TypeCategory { static const Category::Index value = Category::Primitive; }; template <> struct TypeCategory { static const Category::Index value = Category::Primitive; }; +template <> struct TypeCategory { static const Category::Index value = Category::Primitive; }; template struct TypeCategory> { @@ -92,6 +95,30 @@ struct TypeCategory> { template ::value> struct TypeReader {}; + +/** + * Void reader template. + */ + +template +struct TypeReader { + static void ReadLcf(T& ref, LcfReader& stream, uint32_t length) { + stream.Seek(length, LcfReader::FromCurrent); + } + static void WriteLcf(const T& ref, LcfWriter& stream) { + } + static int LcfSize(const T& ref, LcfWriter& stream) { + return 0; + } + static void WriteXml(const T& ref, XmlWriter& stream) { + } + static void BeginXml(T& ref, XmlReader& stream) { + } + static void ParseXml(T& /* ref */, const std::string& /* data */) { + //no-op + } +}; + /** * Raw structure reader template. */ @@ -285,6 +312,31 @@ struct Primitive { } }; +/** + * DBString specialization. + */ +template <> +struct Primitive { + static void ReadLcf(DBString& ref, LcfReader& stream, uint32_t length) { + stream.ReadString(ref, length); +#ifdef LCF_DEBUG_TRACE + printf(" %s\n", ref.c_str()); +#endif + } + static void WriteLcf(const DBString& ref, LcfWriter& stream) { + stream.Write(ref); + } + static int LcfSize(const DBString& ref, LcfWriter& stream) { + return stream.Decode(ref).size(); + } + static void WriteXml(const DBString& ref, XmlWriter& stream) { + stream.Write(ref); + } + static void ParseXml(DBString& ref, const std::string& data) { + XmlReader::Read(ref, data); + } +}; + /** * Primitive Reader. */ @@ -436,18 +488,18 @@ struct EmptyField : public Field { */ template struct SizeField : public Field { - const std::vector S::*ref; + const T S::*ref; void ReadLcf(S& /* obj */, LcfReader& stream, uint32_t length) const { int32_t dummy; TypeReader::ReadLcf(dummy, stream, length); } void WriteLcf(const S& obj, LcfWriter& stream) const { - int size = TypeReader>::LcfSize(obj.*ref, stream); + int size = TypeReader::LcfSize(obj.*ref, stream); TypeReader::WriteLcf(size, stream); } int LcfSize(const S& obj, LcfWriter& stream) const { - int size = TypeReader>::LcfSize(obj.*ref, stream); + int size = TypeReader::LcfSize(obj.*ref, stream); return LcfReader::IntSize(size); } void WriteXml(const S& /* obj */, XmlWriter& /* stream */) const { @@ -463,7 +515,7 @@ struct SizeField : public Field { return (a.*ref).size() == (b.*ref).size(); } - SizeField(const std::vector S::*ref, int id, bool present_if_default, bool is2k3) : + SizeField(const T S::*ref, int id, bool present_if_default, bool is2k3) : Field(id, "", present_if_default, is2k3), ref(ref) {} }; diff --git a/src/reader_util.cpp b/src/reader_util.cpp index 4baca993e..f71dbe0f7 100644 --- a/src/reader_util.cpp +++ b/src/reader_util.cpp @@ -86,7 +86,7 @@ std::string ReaderUtil::DetectEncoding(std::istream& filestream) { return encodings.front(); } -std::string ReaderUtil::DetectEncoding(std::string const & data) { +std::string ReaderUtil::DetectEncoding(StringView data) { std::vector encodings = DetectEncodings(data); if (encodings.empty()) { @@ -154,14 +154,14 @@ std::vector ReaderUtil::DetectEncodings(std::istream& filestream) { #endif } -std::vector ReaderUtil::DetectEncodings(std::string const & data) { +std::vector ReaderUtil::DetectEncodings(StringView data) { std::vector encodings; #if LCF_SUPPORT_ICU if (!data.empty()) { UErrorCode status = U_ZERO_ERROR; UCharsetDetector* detector = ucsdet_open(&status); - std::string s = data; + auto s = std::string(data); ucsdet_setText(detector, s.c_str(), s.length(), &status); int32_t matches_count; @@ -282,27 +282,27 @@ std::string ReaderUtil::GetLocaleEncoding() { return CodepageToEncoding(codepage); } -std::string ReaderUtil::Recode(const std::string& str_to_encode, const std::string& source_encoding) { +std::string ReaderUtil::Recode(StringView str_to_encode, StringView source_encoding) { return ReaderUtil::Recode(str_to_encode, source_encoding, "UTF-8"); } -std::string ReaderUtil::Recode(const std::string& str_to_encode, - const std::string& src_enc, - const std::string& dst_enc) { +std::string ReaderUtil::Recode(StringView str_to_encode, + StringView src_enc, + StringView dst_enc) { if (src_enc.empty() || dst_enc.empty() || str_to_encode.empty()) { - return str_to_encode; + return ToString(str_to_encode); } - auto src_cp = atoi(src_enc.c_str()); + auto src_cp = SvAtoi(src_enc); const auto& src_enc_str = src_cp > 0 ? ReaderUtil::CodepageToEncoding(src_cp) - : src_enc; + : ToString(src_enc); - auto dst_cp = atoi(dst_enc.c_str()); + auto dst_cp = SvAtoi(dst_enc); const auto& dst_enc_str = dst_cp > 0 ? ReaderUtil::CodepageToEncoding(dst_cp) - : dst_enc; + : ToString(dst_enc); #if LCF_SUPPORT_ICU auto status = U_ZERO_ERROR; @@ -325,7 +325,7 @@ std::string ReaderUtil::Recode(const std::string& str_to_encode, status = U_ZERO_ERROR; std::string result(str_to_encode.size() * 4, '\0'); - auto* src = &str_to_encode.front(); + auto* src = str_to_encode.data(); auto* dst = &result.front(); ucnv_convertEx(conv_to, conv_from, @@ -336,7 +336,7 @@ std::string ReaderUtil::Recode(const std::string& str_to_encode, &status); if (U_FAILURE(status)) { - fprintf(stderr, "liblcf: ucnv_convertEx() error when encoding \"%s\": %s\n", str_to_encode.c_str(), u_errorName(status)); + fprintf(stderr, "liblcf: ucnv_convertEx() error when encoding \"%.*s\": %s\n", (int)str_to_encode.length(), str_to_encode.data(), u_errorName(status)); return std::string(); } @@ -347,8 +347,8 @@ std::string ReaderUtil::Recode(const std::string& str_to_encode, #else iconv_t cd = iconv_open(dst_enc_str.c_str(), src_enc_str.c_str()); if (cd == (iconv_t)-1) - return str_to_encode; - char *src = const_cast(str_to_encode.c_str()); + return ToString(str_to_encode); + char *src = const_cast(str_to_encode.data()); size_t src_left = str_to_encode.size(); size_t dst_size = str_to_encode.size() * 5 + 10; char *dst = new char[dst_size]; @@ -372,9 +372,9 @@ std::string ReaderUtil::Recode(const std::string& str_to_encode, #endif } -std::string ReaderUtil::Normalize(const std::string &str) { +std::string ReaderUtil::Normalize(StringView str) { #if LCF_SUPPORT_ICU - icu::UnicodeString uni = icu::UnicodeString(str.c_str(), "utf-8").toLower(); + icu::UnicodeString uni = icu::UnicodeString(str.data(), str.length(), "utf-8").toLower(); UErrorCode err = U_ZERO_ERROR; std::string res; const icu::Normalizer2* norm = icu::Normalizer2::getNFKCInstance(err); @@ -395,7 +395,7 @@ std::string ReaderUtil::Normalize(const std::string &str) { } return res; #else - std::string result = str; + auto result = std::string(str); std::transform(result.begin(), result.end(), result.begin(), tolower); return result; #endif diff --git a/src/reader_xml.cpp b/src/reader_xml.cpp index 95176458f..cd63c33e8 100644 --- a/src/reader_xml.cpp +++ b/src/reader_xml.cpp @@ -11,6 +11,7 @@ #include #include "lcf/reader_lcf.h" #include "lcf/reader_xml.h" +#include "lcf/dbstring.h" // Expat callbacks #if LCF_SUPPORT_XML @@ -180,6 +181,13 @@ void XmlReader::Read(std::string& val, const std::string& data) { } } +template <> +void XmlReader::Read(DBString& val, const std::string& data) { + std::string sval; + Read(sval, data); + val = DBString(sval); +} + template void XmlReader::ReadVector(std::vector& val, const std::string& data) { val.clear(); @@ -197,34 +205,73 @@ void XmlReader::ReadVector(std::vector& val, const std::string& data) { } } +template +void XmlReader::ReadVector(DBArray& val, const std::string& data) { + // FIXME: Adds copies + std::vector tmp; + ReadVector(tmp, data); + val = DBArray(tmp.begin(), tmp.end()); +} + template <> void XmlReader::Read>(std::vector& val, const std::string& data) { - ReadVector(val, data); + ReadVector(val, data); } template <> void XmlReader::Read>(std::vector& val, const std::string& data) { - ReadVector(val, data); + ReadVector(val, data); } template <> void XmlReader::Read>(std::vector& val, const std::string& data) { - ReadVector(val, data); + ReadVector(val, data); } template <> void XmlReader::Read>(std::vector& val, const std::string& data) { - ReadVector(val, data); + ReadVector(val, data); } template <> void XmlReader::Read>(std::vector& val, const std::string& data) { - ReadVector(val, data); + ReadVector(val, data); } template <> void XmlReader::Read>(std::vector& val, const std::string& data) { - ReadVector(val, data); + ReadVector(val, data); } +template <> +void XmlReader::Read>(DBArray& val, const std::string& data) { + ReadVector(val, data); +} + +template <> +void XmlReader::Read>(DBArray& val, const std::string& data) { + ReadVector(val, data); +} + +template <> +void XmlReader::Read>(DBArray& val, const std::string& data) { + ReadVector(val, data); +} + +template <> +void XmlReader::Read>(DBArray& val, const std::string& data) { + ReadVector(val, data); +} + +template <> +void XmlReader::Read>(DBArray& val, const std::string& data) { + ReadVector(val, data); +} + +template <> +void XmlReader::Read>(DBArray& val, const std::string& data) { + ReadVector(val, data); +} + + } //namespace lcf diff --git a/src/rpg_fixup.cpp b/src/rpg_fixup.cpp index cb7164608..e9c7eb733 100644 --- a/src/rpg_fixup.cpp +++ b/src/rpg_fixup.cpp @@ -37,18 +37,18 @@ void rpg::SaveActor::Fixup(int actor_id) { const rpg::Actor& actor = lcf::Data::actors[actor_id - 1]; if (name == "\x1") { - name = actor.name; + name = ToString(actor.name); } if (title == "\x1") { - title = actor.title; + title = ToString(actor.title); } if (sprite_name.empty()) { - sprite_name = actor.character_name; + sprite_name = ToString(actor.character_name); sprite_id = actor.character_index; transparency = actor.transparent ? 3 : 0; } if (face_name.empty()) { - face_name = actor.face_name; + face_name = ToString(actor.face_name); face_id = actor.face_index; } diff --git a/src/rpg_setup.cpp b/src/rpg_setup.cpp index 6f60a8906..7cce53f5a 100644 --- a/src/rpg_setup.cpp +++ b/src/rpg_setup.cpp @@ -23,12 +23,12 @@ namespace lcf { void rpg::SaveActor::Setup(int actor_id) { const rpg::Actor& actor = lcf::Data::actors[actor_id - 1]; ID = actor.ID; - name = actor.name; - title = actor.title; - sprite_name = actor.character_name; + name = ToString(actor.name); + title = ToString(actor.title); + sprite_name = ToString(actor.character_name); sprite_id = actor.character_index; transparency = actor.transparent ? 3 : 0; - face_name = actor.face_name; + face_name = ToString(actor.face_name); face_id = actor.face_index; level = actor.initial_level; exp = 0; @@ -80,7 +80,7 @@ void rpg::SaveMapInfo::Setup() { void rpg::SaveMapInfo::Setup(const rpg::Map& map) { chipset_id = map.chipset_id; - parallax_name = map.parallax_name; + parallax_name = ToString(map.parallax_name); parallax_horz = map.parallax_loop_x; parallax_vert = map.parallax_loop_y; parallax_horz_auto = map.parallax_auto_loop_x; diff --git a/src/writer_lcf.cpp b/src/writer_lcf.cpp index 2b9bd9250..8ba4b3d7f 100644 --- a/src/writer_lcf.cpp +++ b/src/writer_lcf.cpp @@ -120,6 +120,13 @@ void LcfWriter::Write(const std::string& _str) { } } +void LcfWriter::Write(const DBString& _str) { + std::string str = Decode(_str); + if (!str.empty()) { + Write(&*str.begin(), 1, str.size()); + } +} + uint32_t LcfWriter::Tell() { return (uint32_t)stream.tellp(); } @@ -128,8 +135,8 @@ bool LcfWriter::IsOk() const { return stream.good() && encoder.IsOk(); } -std::string LcfWriter::Decode(const std::string& str) { - auto copy = str; +std::string LcfWriter::Decode(StringView str) { + auto copy = std::string(str); encoder.Decode(copy); return copy; } diff --git a/src/writer_xml.cpp b/src/writer_xml.cpp index 4e2072aec..72e034375 100644 --- a/src/writer_xml.cpp +++ b/src/writer_xml.cpp @@ -11,6 +11,8 @@ #include #include "lcf/writer_xml.h" +#include "lcf/dbstring.h" +#include "lcf/dbarray.h" namespace lcf { @@ -65,12 +67,9 @@ void XmlWriter::Write(const double& val) { stream << val; } -template <> -void XmlWriter::Write(const std::string& val) { +void XmlWriter::WriteString(StringView val) { Indent(); - std::string::const_iterator it; - for (it = val.begin(); it != val.end(); it++) { - int c = (int) *it; + for (auto c: val) { switch (c) { case '<': stream << "<"; @@ -103,50 +102,89 @@ void XmlWriter::Write(const std::string& val) { } } +template <> +void XmlWriter::Write(const std::string& val) { + WriteString(val); +} + +template <> +void XmlWriter::Write(const DBString& val) { + WriteString(val); +} + template <> void XmlWriter::Write>(const std::vector& val) { - WriteVector(val); + WriteVector(val); } template <> void XmlWriter::Write>(const std::vector& val) { - WriteVector(val); + WriteVector(val); } template <> void XmlWriter::Write>(const std::vector& val) { - WriteVector(val); + WriteVector(val); } template <> void XmlWriter::Write>(const std::vector& val) { - WriteVector(val); + WriteVector(val); } template <> void XmlWriter::Write>(const std::vector& val) { - WriteVector(val); + WriteVector(val); } template <> void XmlWriter::Write>(const std::vector& val) { - WriteVector(val); + WriteVector(val); +} + +template <> +void XmlWriter::Write>(const DBArray& val) { + WriteVector(val); +} + +template <> +void XmlWriter::Write>(const DBArray& val) { + WriteVector(val); +} + +template <> +void XmlWriter::Write>(const DBArray& val) { + WriteVector(val); +} + +template <> +void XmlWriter::Write>(const DBArray& val) { + WriteVector(val); +} + +template <> +void XmlWriter::Write>(const DBArray& val) { + WriteVector(val); +} + +template <> +void XmlWriter::Write>(const DBArray& val) { + WriteVector(val); } void XmlWriter::WriteInt(int val) { Write(val); } -template -void XmlWriter::WriteVector(const std::vector& val) { +template +void XmlWriter::WriteVector(const ArrayType& val) { Indent(); - typename std::vector::const_iterator it; bool first = true; - for (it = val.begin(); it != val.end(); it++) { + for (auto&& e: val) { if (!first) stream.put(' '); first = false; - Write(*it); + Write(e); } } @@ -206,6 +244,7 @@ template void XmlWriter::WriteNode(const std::string& name, const uint template void XmlWriter::WriteNode(const std::string& name, const int32_t& val); template void XmlWriter::WriteNode(const std::string& name, const double& val); template void XmlWriter::WriteNode(const std::string& name, const std::string& val); +template void XmlWriter::WriteNode(const std::string& name, const DBString& val); template void XmlWriter::WriteNode>(const std::string& name, const std::vector& val); template void XmlWriter::WriteNode>(const std::string& name, const std::vector& val); @@ -213,4 +252,10 @@ template void XmlWriter::WriteNode>(const std::string& name template void XmlWriter::WriteNode>(const std::string& name, const std::vector& val); template void XmlWriter::WriteNode>(const std::string& name, const std::vector& val); +template void XmlWriter::WriteNode>(const std::string& name, const DBArray& val); +template void XmlWriter::WriteNode>(const std::string& name, const DBArray& val); +template void XmlWriter::WriteNode>(const std::string& name, const DBArray& val); +template void XmlWriter::WriteNode>(const std::string& name, const DBArray& val); +template void XmlWriter::WriteNode>(const std::string& name, const DBArray& val); + } //namespace lcf diff --git a/tests/dbarray.cpp b/tests/dbarray.cpp new file mode 100644 index 000000000..0a82d2515 --- /dev/null +++ b/tests/dbarray.cpp @@ -0,0 +1,204 @@ +/* + * This file is part of liblcf. Copyright (c) 2020 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#include "lcf/dbarray.h" +#include "doctest.h" + +#include +#include +#include + +namespace lcf { +template class DBArray; +template class DBArray; +template class DBArray>; + +template +doctest::String toString(const DBArray& a) { + std::ostringstream ss; + ss << "{"; + auto iter = a.begin(); + if (iter != a.end()) { + ss << *iter; + ++iter; + } + while (iter != a.end()) { + ss << ", " << *iter; + } + ss << "}"; + return doctest::String(ss.str().c_str()); +} + +} + +using namespace lcf; + +TEST_SUITE_BEGIN("DBArray"); + +TEST_CASE_TEMPLATE("ConstructDef", T, int, bool, std::string) { + DBArray x; + + REQUIRE(x.empty()); + REQUIRE_EQ(x.size(), 0); +} + +TEST_CASE("Construct Ilist") { + DBArray x = {5}; + + REQUIRE(!x.empty()); + REQUIRE_EQ(x.size(), 1); + REQUIRE_EQ(x.front(), 5); + REQUIRE_EQ(x[0], 5); + REQUIRE_EQ(x.back(), 5); + + REQUIRE_EQ(x.data()[0], 5); + + auto iter = x.begin(); + REQUIRE_EQ(*iter, 5); + ++iter; + REQUIRE_EQ(iter, x.end()); +} + +TEST_CASE("Construct Ilist2") { + DBArray x = {5, 7}; + + REQUIRE(!x.empty()); + REQUIRE_EQ(x.size(), 2); + REQUIRE_EQ(x.front(), 5); + REQUIRE_EQ(x[0], 5); + REQUIRE_EQ(x[1], 7); + REQUIRE_EQ(x.back(), 7); + + REQUIRE_EQ(x.data()[0], 5); + REQUIRE_EQ(x.data()[1], 7); + + auto iter = x.begin(); + REQUIRE_EQ(*iter, 5); + ++iter; + REQUIRE_EQ(*iter, 7); + ++iter; + REQUIRE_EQ(iter, x.end()); +} + +TEST_CASE("Construct Count") { + DBArray x(3); + + REQUIRE(!x.empty()); + REQUIRE_EQ(x.size(), 3); + REQUIRE_EQ(x.front(), 0); + REQUIRE_EQ(x[0], 0); + REQUIRE_EQ(x[1], 0); + REQUIRE_EQ(x[2], 0); + REQUIRE_EQ(x.back(), 0); +} + +TEST_CASE("Construct Count T") { + DBArray x(3, 15); + + REQUIRE(!x.empty()); + REQUIRE_EQ(x.size(), 3); + REQUIRE_EQ(x.front(), 15); + REQUIRE_EQ(x[0], 15); + REQUIRE_EQ(x[1], 15); + REQUIRE_EQ(x[2], 15); + REQUIRE_EQ(x.back(), 15); +} + +TEST_CASE("Swap") { + const DBArray ca = {1}; + const DBArray cb = {2}; + + DBArray a = {1}; + DBArray b = {2}; + a.swap(b); + + REQUIRE_EQ(a, cb); + REQUIRE_EQ(b, ca); +} + +TEST_CASE("Cmp") { + const DBArray a = {1}; + const DBArray b = {2}; + + REQUIRE(a == a); + REQUIRE_FALSE(a != a); + REQUIRE_FALSE(a < a); + REQUIRE(a <= a); + REQUIRE_FALSE(a > a); + REQUIRE(a >= a); + + REQUIRE_FALSE(a == b); + REQUIRE(a != b); + REQUIRE(a < b); + REQUIRE(a <= b); + REQUIRE_FALSE(a > b); + REQUIRE_FALSE(a >= b); + + REQUIRE_FALSE(b == a); + REQUIRE(b != a); + REQUIRE_FALSE(b < a); + REQUIRE_FALSE(b <= a); + REQUIRE(b > a); + REQUIRE(b >= a); +} + + +TEST_CASE("Copy") { + const DBArray ca = {1}; + const DBArray cb = {2}; + + DBArray a = {1}; + DBArray b = {2}; + + b = a; + REQUIRE_EQ(a, ca); + REQUIRE_EQ(b, ca); + + b = a; + REQUIRE_EQ(a, ca); + REQUIRE_EQ(b, ca); + + b = b; + REQUIRE_EQ(a, ca); + REQUIRE_EQ(b, ca); + + DBArray c(b); + REQUIRE_EQ(a, ca); + REQUIRE_EQ(b, ca); + REQUIRE_EQ(c, ca); +} + +TEST_CASE("Move") { + const DBArray n = {}; + const DBArray ca = {1}; + const DBArray cb = {2}; + + DBArray a = {1}; + DBArray b = {2}; + + b = std::move(a); + REQUIRE_EQ(a, n); + REQUIRE_EQ(b, ca); + + b = std::move(b); + REQUIRE_EQ(a, n); + REQUIRE_EQ(b, ca); + + DBArray c(std::move(b)); + REQUIRE_EQ(a, n); + REQUIRE_EQ(b, n); + REQUIRE_EQ(c, ca); + + c = std::move(b); + REQUIRE_EQ(a, n); + REQUIRE_EQ(b, n); + REQUIRE_EQ(c, n); +} + +TEST_SUITE_END(); diff --git a/tests/dbstring.cpp b/tests/dbstring.cpp new file mode 100644 index 000000000..c5ccdf076 --- /dev/null +++ b/tests/dbstring.cpp @@ -0,0 +1,157 @@ +/* + * This file is part of liblcf. Copyright (c) 2020 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#include "lcf/dbstring.h" +#include "doctest.h" + +using namespace lcf; + +TEST_SUITE_BEGIN("DBString"); + +TEST_CASE("ConstructDef") { + DBString x; + + REQUIRE(x.empty()); + REQUIRE_EQ(x.size(), 0); + REQUIRE_EQ(x, ""); +} + +template +void testConstruct(const T& init) { +} + +TEST_CASE_TEMPLATE("Construct", T, StringView, std::string, char*, DBString) { + DBString x(T("abc")); + + REQUIRE_FALSE(x.empty()); + REQUIRE_EQ(x.size(), 3); + REQUIRE_EQ(x, "abc"); + + REQUIRE_EQ(x.front(), 'a'); + REQUIRE_EQ(x[0], 'a'); + REQUIRE_EQ(x[1], 'b'); + REQUIRE_EQ(x[2], 'c'); + REQUIRE_EQ(x.back(), 'c'); + + REQUIRE_EQ(x.data()[0], 'a'); + REQUIRE_EQ(x.data()[1], 'b'); + REQUIRE_EQ(x.data()[2], 'c'); + + REQUIRE_EQ(x.c_str()[0], 'a'); + REQUIRE_EQ(x.c_str()[1], 'b'); + REQUIRE_EQ(x.c_str()[2], 'c'); + REQUIRE_EQ(x.c_str()[3], '\0'); + + { + auto iter = x.begin(); + REQUIRE_EQ(*(iter++), 'a'); + REQUIRE_EQ(*(iter++), 'b'); + REQUIRE_EQ(*(iter++), 'c'); + REQUIRE_EQ(iter, x.end()); + } + + { + auto iter = x.rbegin(); + REQUIRE_EQ(*(iter++), 'c'); + REQUIRE_EQ(*(iter++), 'b'); + REQUIRE_EQ(*(iter++), 'a'); + REQUIRE_EQ(iter, x.rend()); + } +} + +TEST_CASE("Construct2") { + DBString x("abc", 2); + + REQUIRE_FALSE(x.empty()); + REQUIRE_EQ(x.size(), 2); + REQUIRE_EQ(x, "ab"); +} + +TEST_CASE("Swap") { + DBString a("a"); + DBString b("b"); + a.swap(b); + + REQUIRE_EQ(a, "b"); + REQUIRE_EQ(b, "a"); +} + +TEST_CASE("Cmp") { + DBString a("a"); + DBString b("b"); + + REQUIRE(a == a); + REQUIRE_FALSE(a != a); + REQUIRE_FALSE(a < a); + REQUIRE(a <= a); + REQUIRE_FALSE(a > a); + REQUIRE(a >= a); + + REQUIRE_FALSE(a == b); + REQUIRE(a != b); + REQUIRE(a < b); + REQUIRE(a <= b); + REQUIRE_FALSE(a > b); + REQUIRE_FALSE(a >= b); + + REQUIRE_FALSE(b == a); + REQUIRE(b != a); + REQUIRE_FALSE(b < a); + REQUIRE_FALSE(b <= a); + REQUIRE(b > a); + REQUIRE(b >= a); +} + + +TEST_CASE("Copy") { + DBString a("a"); + DBString b("b"); + + b = a; + REQUIRE_EQ(a, "a"); + REQUIRE_EQ(b, "a"); + + b = a; + REQUIRE_EQ(a, "a"); + REQUIRE_EQ(b, "a"); + + b = b; + REQUIRE_EQ(a, "a"); + REQUIRE_EQ(b, "a"); + + DBString c(b); + REQUIRE_EQ(a, "a"); + REQUIRE_EQ(b, "a"); + REQUIRE_EQ(c, "a"); +} + +TEST_CASE("Move") { + DBString a("a"); + DBString b("b"); + + b = std::move(a); + REQUIRE_EQ(a, ""); + REQUIRE_EQ(b, "a"); + + b = std::move(b); + REQUIRE_EQ(a, ""); + REQUIRE_EQ(b, "a"); + + DBString c(std::move(b)); + REQUIRE_EQ(a, ""); + REQUIRE_EQ(b, ""); + REQUIRE_EQ(c, "a"); + + c = std::move(b); + REQUIRE_EQ(a, ""); + REQUIRE_EQ(b, ""); + REQUIRE_EQ(c, ""); +} + +TEST_SUITE_END();