diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-09-03 17:24:21 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-09-03 17:24:21 +0200 |
commit | a503d93dbc45062abaa27f8f5d394001dc2e25e2 (patch) | |
tree | a51c067f1a68bb5d1c71f5b1847c810ffb64af00 /lib/colonial_twilight/board.rb | |
parent | 75b0668650af1111a7de4b7420d2ae928595a23b (diff) | |
download | colonial-twilight-a503d93dbc45062abaa27f8f5d394001dc2e25e2.zip colonial-twilight-a503d93dbc45062abaa27f8f5d394001dc2e25e2.tar.gz |
Game : quick and dirty turn and actions save system
Diffstat (limited to 'lib/colonial_twilight/board.rb')
-rw-r--r-- | lib/colonial_twilight/board.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/colonial_twilight/board.rb b/lib/colonial_twilight/board.rb index c539dd2..f877f84 100644 --- a/lib/colonial_twilight/board.rb +++ b/lib/colonial_twilight/board.rb @@ -1,8 +1,6 @@ #! /usr/bin/env ruby # -*- coding: UTF-8 -*- -require 'json' - module ColonialTwilight class Forces @@ -43,7 +41,8 @@ module ColonialTwilight end unless rm.nil? end - def to_s + def to_s; inspect end + def inspect " #{gov_bases} GOV bases #{french_troops} french troops @@ -187,7 +186,8 @@ module ColonialTwilight @resettled = false end - def to_s + def to_s; @name end + def inspect "#@descr #@terrain control : #{@forces.control} alignment : #@alignment @@ -385,17 +385,6 @@ module ColonialTwilight h end - def to_json - # JSON.pretty_generate(data) - JSON.generate(data) - end - - def save - File.open('save.json','w') do |f| - f.write(JSON.generate(data)) - end - end - def load scenario case scenario when :short; short |