TABLE OF CONTENTS
- 1. Game/Game
- 1.1. Game/GSaveLoad
- 1.1.1. GSaveLoad/GSaveLoad.Save_Game_Invalid_Data
- 1.1.2. GSaveLoad/GSaveLoad.Load_Game
- 1.1.3. GSaveLoad/GSaveLoad.Save_Game
- 1.2. Game/Game.Attributes_Amount_Range
- 1.3. Game/Game.Attributes_Array
- 1.4. Game/Game.AttributesData_Container
- 1.5. Game/Game.Bases_Range
- 1.6. Game/Game.Damage_Factor
- 1.7. Game/Game.Data_Action
- 1.8. Game/Game.Extended_Base_Range
- 1.9. Game/Game.Integer_Array
- 1.10. Game/Game.Map_X_Range
- 1.11. Game/Game.Map_Y_Range
- 1.12. Game/Game.Natural_Array
- 1.13. Game/Game.Natural_Container
- 1.14. Game/Game.Positive_Container
- 1.15. Game/Game.Positive_Formal_Container
- 1.16. Game/Game.Reputation_Range
- 1.17. Game/Game.Short_String
- 1.18. Game/Game.Skill_Range
- 1.19. Game/Game.Skills_Amount_Range
- 1.20. Game/Game.SkillsData_Container
- 1.21. Game/Game.Tiny_String
- 1.22. Game/Game.TinyString_Container
- 1.23. Game/Game.TinyString_Formal_Container
- 1.24. Game/Game.Tool_Quality_Array
- 1.25. Game/Game.Tools_Quality_Range
- 1.26. Game/Game.UnboundedString_Container
- 1.27. Game/Game.Attribute_Record
- 1.28. Game/Game.Date_Record
- 1.29. Game/Game.Reputation_Data
- 1.30. Game/Game.Skill_Record
- 1.31. Game/Tool_Quality_Record
- 1.32. Game/Default_Tools_Quality
- 1.33. Game/Game.Default_Attributes_Amount
- 1.34. Game/Game.Default_Data_Action
- 1.35. Game/Game.Default_Reputation
- 1.36. Game/Game.Default_Skills_Amount
- 1.37. Game/Game.Empty_Atribute_Record
- 1.38. Game/Game.Empty_Attributes_Array
- 1.39. Game/Game.Empty_Skill
- 1.40. Game/Game.Empty_Tool_Quality_Array
- 1.41. Game/Game.Game_Version
- 1.42. Game/Game.No_Damage
- 1.43. Game/Game.Alchemy_Tools
- 1.44. Game/Game.Arms_Armor
- 1.45. Game/Game.Attributes_Amount
- 1.46. Game/Game.Attributes_List
- 1.47. Game/Game.Chest_Armor
- 1.48. Game/Game.Cleaning_Tools
- 1.49. Game/Game.Data_Directory
- 1.50. Game/Game.Doc_Directory
- 1.51. Game/Game.Fuel_Type
- 1.52. Game/Game.Game_Date
- 1.53. Game/Game.Head_Armor
- 1.54. Game/Game.Legs_Armor
- 1.55. Game/Game.Mission_Items_Type
- 1.56. Game/Game.Mods_Directory
- 1.57. Game/Game.Money_Index
- 1.58. Game/Game.Money_Name
- 1.59. Game/Game.Repair_Tools
- 1.60. Game/Game.Save_Directory
- 1.61. Game/Game.Shield_Type
- 1.62. Game/Game.Skills_Amount
- 1.63. Game/Game.Skills_List
- 1.64. Game/Game.Talking_Skill
- 1.65. Game/Game.Themes_Directory
- 1.66. Game/Game.Weapon_Type
- 1.67. Game/Game.Data_Loading_Error
- 1.68. Game/Game.End_Game
- 1.69. Game/Game.Find_Skill_Index
- 1.70. Game/Game.Load_Game_Data
- 1.71. Game/Game.New_Game
- 1.72. Game/Game.Tiny_String_Hash
- 1.73. Game/Game.Update_Game
Game/Game [ Packages ]
FUNCTION
Main the game structures and data
SOURCE
package Game is
Game/Game.Attributes_Amount_Range [ Types ]
FUNCTION
Used to set the amount of available characters attributes
SOURCE
subtype Attributes_Amount_Range is Positive range 1 .. 16;
HISTORY
6.6 - Added
Game/Game.Attributes_Array [ Types ]
FUNCTION
Data structure for attributes: 1 - Attribute level, 2 - current experience in attribute
SOURCE
type Attributes_Array is array(1 .. 2) of Natural with Default_Component_Value => 0;
Game/Game.AttributesData_Container [ Types ]
FUNCTION
Used to store attributes data
SOURCE
package AttributesData_Container is new Formal_Vectors (Index_Type => Attributes_Amount_Range, Element_Type => Attribute_Record);
Game/Game.Bases_Range [ Types ]
FUNCTION
Amount of sky bases
SOURCE
subtype Bases_Range is Positive range 1 .. 1_024;
Game/Game.Damage_Factor [ Types ]
FUNCTION
Used mostly for count percentage of damage of modules
SOURCE
type Damage_Factor is digits 2 range 0.0 .. 1.0 with Default_Value => 0.0;
Game/Game.Data_Action [ Types ]
FUNCTION
Possible actions to do when loading game data
SOURCE
type Data_Action is (ADD, UPDATE, REMOVE) with Default_Value => ADD;
Game/Game.Extended_Base_Range [ Types ]
FUNCTION
Amount of sky bases starting from 0
SOURCE
subtype Extended_Base_Range is Natural range 0 .. 1_024;
Game/Game.Integer_Array [ Types ]
FUNCTION
General purpose array of Integer
SOURCE
type Integer_Array is array(Positive range <>) of Integer with Default_Component_Value => 0;
HISTORY
7.4 - Added
Game/Game.Map_X_Range [ Types ]
FUNCTION
X axis size of the game map
SOURCE
subtype Map_X_Range is Positive range 1 .. 1_024;
Game/Game.Map_Y_Range [ Types ]
FUNCTION
Y axis size of the game map
SOURCE
subtype Map_Y_Range is Positive range 1 .. 1_024;
Game/Game.Natural_Array [ Types ]
FUNCTION
General purpose array of Natural
SOURCE
type Natural_Array is array(Positive range <>) of Natural with Default_Component_Value => 0;
Game/Game.Natural_Container [ Types ]
FUNCTION
Used to store Natural values as list
SOURCE
package Natural_Container is new Vectors (Index_Type => Positive, Element_Type => Natural);
Game/Game.Positive_Container [ Types ]
FUNCTION
Used to store Positive values as list
SOURCE
package Positive_Container is new Vectors (Index_Type => Positive, Element_Type => Positive);
Game/Game.Positive_Formal_Container [ Types ]
FUNCTION
Used to store Positive values as list
SOURCE
package Positive_Formal_Container is new Formal_Vectors (Index_Type => Positive, Element_Type => Positive);
HISTORY
7.4 - Added
Game/Game.Reputation_Range [ Types ]
FUNCTION
Range of the player's reputation level in bases
SOURCE
subtype Reputation_Range is Integer range -100 .. 100;
Game/Game.Short_String [ Types ]
FUNCTION
Used to store various texts, max length 512
SOURCE
package Short_String is new Generic_Bounded_Length(Max => 512);
HISTORY
6.5 - Added
Game/Game.Skill_Range [ Types ]
FUNCTION
Range used for skills but also for health, tiredness, hunger, thirst and loyalty
SOURCE
subtype Skill_Range is Natural range 0 .. 100;
Game/Game.Skills_Amount_Range [ Types ]
FUNCTION
Used to set the amount of available characters skills
SOURCE
subtype Skills_Amount_Range is Count_Type range 1 .. 64;
HISTORY
6.6 - Added
Game/Game.SkillsData_Container [ Types ]
FUNCTION
Used to store skills data
SOURCE
package SkillsData_Container is new Formal_Indefinite_Vectors (Index_Type => Skills_Amount_Range, Element_Type => Skill_Record, Max_Size_In_Storage_Elements => Skill_Record'Size, Bounded => False);
Game/Game.Tiny_String [ Types ]
FUNCTION
Used to store various texts, max length 64
SOURCE
package Tiny_String is new Generic_Bounded_Length(Max => 64);
HISTORY
6.5 - Added
Game/Game.TinyString_Container [ Types ]
FUNCTION
Used to store Tiny_String values as list
SOURCE
package TinyString_Container is new Vectors (Index_Type => Positive, Element_Type => Tiny_String.Bounded_String, "=" => Tiny_String."=");
Game/Game.TinyString_Formal_Container [ Types ]
FUNCTION
Used to store Tiny_String values as list
SOURCE
package TinyString_Formal_Container is new Formal_Vectors (Index_Type => Positive, Element_Type => Tiny_String.Bounded_String, "=" => Tiny_String."=");
HISTORY
7.1 - Added
Game/Game.Tool_Quality_Array [ Types ]
FUNCTION
Used to store information about tools needed for training skills
SOURCE
type Tool_Quality_Array is array(Tools_Quality_Range range <>) of Tool_Quality_Record;
HISTORY
6.5 - Added
Game/Game.Tools_Quality_Range [ Types ]
FUNCTION
Used to set amount of tools qualities for skills
SOURCE
subtype Tools_Quality_Range is Positive range 1 .. 16;
Game/Game.UnboundedString_Container [ Types ]
FUNCTION
Used to store Unbounded_String values as list
SOURCE
package UnboundedString_Container is new Vectors (Index_Type => Positive, Element_Type => Unbounded_String);
Game/Game.Attribute_Record [ Records ]
FUNCTION
Data for attributes
SOURCE
type Attribute_Record is record Name: Tiny_String.Bounded_String; Description: Short_String.Bounded_String; end record;
PARAMETERS
Name - Name of attribute Description - Description of attribute
Game/Game.Date_Record [ Records ]
FUNCTION
Data for game date/time Year - Current in game year Month - Current in game month Day - Current in game day Hour - Current in game hour Minutes - Current in game minutes
SOURCE
type Date_Record is record Year: Natural range 0 .. 4_000_000; Month: Natural range 0 .. 24; Day: Natural range 0 .. 62; Hour: Natural range 0 .. 48; Minutes: Natural range 0 .. 120; end record;
Game/Game.Reputation_Data [ Records ]
FUNCTION
Data for reputation
SOURCE
type Reputation_Data is record Level: Reputation_Range := 0; Experience: Natural := 0; end record;
PARAMETERS
Level - The level of the reputation Experience - The current experience in the reputation
HISTORY
7.1 - Added
Game/Game.Skill_Record [ Records ]
FUNCTION
Data for skills
SOURCE
type Skill_Record(Quality_Amount: Tools_Quality_Range) is record Name: Tiny_String.Bounded_String; Attribute: Attributes_Amount_Range; Description: Short_String.Bounded_String; Tool: Tiny_String.Bounded_String; Tools_Quality: Tool_Quality_Array(1 .. Quality_Amount); end record;
PARAMETERS
Quality_Amount - The length of the array with information about tools required to train the skill Name - Name of skill Attribute - Attribute used with that skill Description - Description of skill Tool - Item type used as tool for training that skill Tools_Quality - Required tools quality for training that skill at the selected level. First value minimal level of skill, second minimum quality of tool
Game/Tool_Quality_Record [ Records ]
FUNCTION
Used to store information about required by skill training tool
SOURCE
type Tool_Quality_Record is record Level: Skill_Range := 100; Quality: Skill_Range := 100; end record;
PARAMETERS
Level - The minimal level of the skill which requires that tool Quality - The minimal quality of the tool for use it for training
HISTORY
6.6 - Added
Game/Default_Tools_Quality [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Default values for tools qualities for skills
SOURCE
Default_Tools_Quality: constant Tool_Quality_Record := Tool_Quality_Record'(others => <>);
Game/Game.Default_Attributes_Amount [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
The default amount of the attributes available in the game
SOURCE
Default_Attributes_Amount: constant Attributes_Amount_Range := 16;
HISTORY
6.6 - Added
Game/Game.Default_Data_Action [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Default data action when loading the game data
SOURCE
Default_Data_Action: constant Data_Action := ADD;
Game/Game.Default_Reputation [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Default reputation values
SOURCE
Default_Reputation: constant Reputation_Data := (Level => 0, Experience => 0);
Game/Game.Default_Skills_Amount [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
The default amount of the skills available in the game
SOURCE
Default_Skills_Amount: constant Skills_Amount_Range := 26;
HISTORY
6.6 - Added
Game/Game.Empty_Atribute_Record [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Empty attributes record constant
SOURCE
Empty_Atribute_Record: constant Attribute_Record := Attribute_Record'(others => <>);
Game/Game.Empty_Attributes_Array [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Empty attributes array constant
SOURCE
Empty_Attributes_Array: constant Attributes_Array := (others => 0);
Game/Game.Empty_Skill [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Empty skill data constant
SOURCE
Empty_Skill: constant Skill_Record := (Quality_Amount => 1, Name => Tiny_String.Null_Bounded_String, Attribute => 1, Description => Short_String.Null_Bounded_String, Tool => Tiny_String.Null_Bounded_String, Tools_Quality => Empty_Tool_Quality_Array);
Game/Game.Empty_Tool_Quality_Array [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Default value for tools used to train the selected skill if nothig is set in the game data files
SOURCE
Empty_Tool_Quality_Array: constant Tool_Quality_Array(1 .. 1) := (1 => Default_Tools_Quality);
HISTORY
6.5 -Added
Game/Game.Game_Version [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Current the game version
SOURCE
Game_Version: constant String := "Version: 9.9";
Game/Game.No_Damage [ Constants ]
[ Top ] [ Game ] [ Constants ]
FUNCTION
Constant for no damage for Damage_Factor type
SOURCE
No_Damage: constant Damage_Factor := 0.0;
Game/Game.Alchemy_Tools [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as alchemy tools (mainly in deconstructing orders)
SOURCE
Alchemy_Tools: Tiny_String.Bounded_String;
Game/Game.Arms_Armor [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as characters arms armor
SOURCE
Arms_Armor: Tiny_String.Bounded_String;
Game/Game.Attributes_Amount [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
The amount of attributes in the game
SOURCE
Attributes_Amount: Natural := 0;
HISTORY
6.6 - Added
Game/Game.Attributes_List [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Contains data for all characters attributes
SOURCE
Attributes_List: AttributesData_Container.Vector (Capacity => Count_Type(Default_Attributes_Amount));
Game/Game.Chest_Armor [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as characters torso armor
SOURCE
Chest_Armor: Tiny_String.Bounded_String;
Game/Game.Cleaning_Tools [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as tool in cleaning ship
SOURCE
Cleaning_Tools: Tiny_String.Bounded_String;
Game/Game.Data_Directory [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Path to directory where are game data files
SOURCE
Data_Directory: Unbounded_String := To_Unbounded_String(Source => "data" & Dir_Separator);
Game/Game.Doc_Directory [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Path to directory where documentation is
SOURCE
Doc_Directory: Unbounded_String := To_Unbounded_String(Source => "doc" & Dir_Separator);
Game/Game.Fuel_Type [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as fuel for ships
SOURCE
Fuel_Type: Tiny_String.Bounded_String;
Game/Game.Game_Date [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Current in game date
SOURCE
Game_Date: Date_Record;
Game/Game.Head_Armor [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as characters head armor
SOURCE
Head_Armor: Tiny_String.Bounded_String;
Game/Game.Legs_Armor [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as characters legs armor
SOURCE
Legs_Armor: Tiny_String.Bounded_String;
Game/Game.Mission_Items_Type [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used for delivery missions
SOURCE
Mission_Items_Type: Unbounded_String;
Game/Game.Mods_Directory [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Path to directory where are game modifications
SOURCE
Mods_Directory: Unbounded_String := To_Unbounded_String (Source => "data" & Dir_Separator & "mods" & Dir_Separator);
Game/Game.Money_Index [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Index of item used as money
SOURCE
Money_Index: Positive;
Game/Game.Money_Name [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of money (taken from MoneyIndex)
SOURCE
Money_Name: Unbounded_String;
Game/Game.Repair_Tools [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as tool in repairing/upgrading ship
SOURCE
Repair_Tools: Tiny_String.Bounded_String;
Game/Game.Save_Directory [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Path to directory where are savegame and logs
SOURCE
Save_Directory: Unbounded_String := To_Unbounded_String (Source => "data" & Dir_Separator & "saves" & Dir_Separator);
Game/Game.Shield_Type [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as characters shield
SOURCE
Shield_Type: Tiny_String.Bounded_String;
Game/Game.Skills_Amount [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
The amount of skills in the game
SOURCE
Skills_Amount: SkillsData_Container.Extended_Index := 0;
HISTORY
6.6 - Added
Game/Game.Skills_List [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Contains data for all skills
SOURCE
Skills_List: SkillsData_Container.Vector (Capacity => Default_Skills_Amount);
Game/Game.Talking_Skill [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Index of skill used for talk in bases or with other ships
SOURCE
Talking_Skill: Skills_Amount_Range;
Game/Game.Themes_Directory [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Path to directory where are ui themes
SOURCE
Themes_Directory: Unbounded_String := To_Unbounded_String (Source => "data" & Dir_Separator & "themes" & Dir_Separator);
Game/Game.Weapon_Type [ Variables ]
[ Top ] [ Game ] [ Variables ]
FUNCTION
Name of item type used as characters weapon
SOURCE
Weapon_Type: Tiny_String.Bounded_String;
Game/Game.Data_Loading_Error [ Exceptions ]
[ Top ] [ Game ] [ Exceptions ]
FUNCTION
Raised when error occurs during loading any game data
SOURCE
Data_Loading_Error: exception;
Game/Game.End_Game [ Subprograms ]
[ Top ] [ Game ] [ Subprograms ]
FUNCTION
Save (or not) game and clear all temporary data
SOURCE
procedure End_Game(Save: Boolean);
PARAMETERS
Save - Did game should be saved to file or not
Game/Game.Find_Skill_Index [ Subprograms ]
[ Top ] [ Game ] [ Subprograms ]
FUNCTION
Find index of selected skill
SOURCE
function Find_Skill_Index (Skill_Name: String) return SkillsData_Container.Extended_Index with Pre => Skill_Name'Length > 0, Post => Find_Skill_Index'Result <= SkillsData_Container.Length(Container => Skills_List);
PARAMETERS
SkillName - Name of the skill to search
RESULT
Index of selected skill or 0 if skill was not found
Game/Game.Load_Game_Data [ Subprograms ]
[ Top ] [ Game ] [ Subprograms ]
FUNCTION
Load game data from files
SOURCE
function Load_Game_Data return String;
RESULT
Empty string if everything was ok, otherwise message with info what goes wrong
Game/Game.New_Game [ Subprograms ]
[ Top ] [ Game ] [ Subprograms ]
FUNCTION
Start new game: create map, place ship, crew, etc
SOURCE
procedure New_Game;
Game/Game.Tiny_String_Hash [ Subprograms ]
[ Top ] [ Game ] [ Subprograms ]
FUNCTION
Compute the hash of the selected Tiny_String
SOURCE
function Tiny_String_Hash is new Ada.Strings.Bounded.Hash(Tiny_String);
PARAMETERS
Key - The Tiny_String which hash will be computed
RESULT
The String with hash of the selected Tiny_String
HISTORY
6.8 - Added
Game/Game.Update_Game [ Subprograms ]
[ Top ] [ Game ] [ Subprograms ]
FUNCTION
Game ticks (update time, crew, ship, etc)
SOURCE
procedure Update_Game(Minutes: Positive; In_Combat: Boolean := False);
PARAMETERS
Minutes - Amount of in-game minutes passed InCombat - Did player is in combat currently. Default false