Skip to content

Commit

Permalink
including module for serializing and deserializing
Browse files Browse the repository at this point in the history
  • Loading branch information
tGitzHub committed Jan 17, 2024
1 parent 79b692f commit 94a5c3e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/game_version.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde_derive::{Serialize, Deserialize};
use serde_json::{json, to_string_pretty, Result};

#[derive(Serialize, Deserialize)]
pub struct FactorioVersion{
Expand All @@ -8,6 +7,7 @@ pub struct FactorioVersion{
game_version_number: &'static str,
modded_factorio: bool,

module: Module,
/*
building_list: BuildingList,
beacon_list: BeaconList,
Expand All @@ -22,6 +22,8 @@ impl FactorioVersion{
game_version_name: "Factorio",
game_version_number: "1.1",
modded_factorio: false,
module: Module::new(ModuleKind::Efficiency, ModulePower::One),

/*
building_list: BuildingList::new(),
beacon_list: BeaconList::new(),
Expand All @@ -33,22 +35,25 @@ impl FactorioVersion{
}


#[derive(Serialize, Deserialize)]
enum ModuleKind{
Efficiency,
Productivity,
Speed,
}
#[derive(Serialize, Deserialize)]
enum ModulePower{
One,
Two,
Three,
}

#[derive(Serialize, Deserialize)]
struct Module{
module_kind: ModuleKind,
module_power: ModulePower,
}
/*

impl Module{
fn new(module_kind: ModuleKind, module_power: ModulePower) -> Module{
Module{
Expand All @@ -57,7 +62,7 @@ impl Module{
}
}
}
/*
struct BuildingList{
assembler: [Assembler; N],
furnace: Furnace,
Expand Down

0 comments on commit 94a5c3e

Please sign in to comment.