Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#97 closed enhancement (fixed)

Add default points for an army to the GameSystem

Reported by: ibboard Owned by: Henri
Priority: major Milestone: WarFoundry API 0.2
Component: WarFoundry-API Version: Unknown or N/A
Keywords: papercut Cc:
Blocked By: Blocking: #98

Description

As discussed here it might be useful to have GameSystems defining a default army size as different systems have different norms. This should default to a sensible value (e.g. 1000) if the value isn't specified in the file.

Change History (16)

comment:1 Changed 10 years ago by ibboard

Blocking: 98 added

comment:2 Changed 10 years ago by ibboard

Milestone: WarFoundry 0.1WarFoundry 0.2

Move some tickets to v0.2 milestone

comment:3 Changed 10 years ago by ibboard

Blocking: 57 added

comment:4 Changed 10 years ago by ibboard

Status: newconfirmed

Move tickets to new "confirmed" status to show that they've been checked

comment:5 Changed 10 years ago by ibboard

Keywords: papercut added
released: no
Version: Unknown or N/A

comment:6 Changed 9 years ago by Henri

Owner: set to Henri
Status: confirmedaccepted

comment:7 Changed 9 years ago by Henri

I have sort of (again) figured this out. It basically works,trying to hash out a few things with some funny crashes and stuff.
Having a rather interesting snafu as a string can be tested for null but a int can not?
If I do the defaultArmySize as a string it will load the game systems even without the attribute but crashes if picking anything else than the default sample system. Odd.

comment:8 Changed 9 years ago by ibboard

Sorry, was ill on Thursday and Friday then busy Christmas shopping yesterday - I didn't mean to leave you hanging :)

"int" can't be tested for null because it can't be null. int (like float, double, boolean, byte and some others) are what are called "primative" types and have to have a value. "string" looks like a primitive (it is lower-case and is normally coloured the same) but is really an alias for String and so is a complex object that can be null.

I'd recommend adding a DefaultSize (or DefaultArmySize or similar) property to the Race class that is of type "int" (or possibly double - are we likely to encounter systems with total values that need to work to halves?) and a matching defaultSize attribute to the <race> tag in the XML schema and define its type as "xs:positiveInteger" with a sensible default for all of the data files that don't define it.

If you need any pointers then just drop me an email or post on the forums. The default names and existing properties that have numeric values might also help as reference.

comment:9 Changed 9 years ago by Henri

I was putting the defaultArmySize in the system file actually. That made sense to me it being a system default after all. Or do you mean in addition to that?

Everything is working pretty ok but it won't load system files that lack the defaultArmySize attribute.

I must admit I wasn't thinking we'd need halfsies, but to be honest you never know.

comment:10 Changed 9 years ago by ibboard

Ah, good point. You're correct. We could do per-race as an override as well, but that'd be more code.

In terms of it not loading old files then you need a "default" attribute in the schema so that it sets a default value when accessed correctly (e.g. basePoints uses a default value of 0 and the XMLTools call uses the default in the schema if no value is set/the attribute is missing)

comment:11 Changed 9 years ago by Henri

In [722]:

Re #97: Default army size papercut.
Updated GameSystem.cs, system.xsd and Factories to accommodate default system size.

comment:12 Changed 9 years ago by Henri

Status: acceptedneedinfo

Commit went to default army size branch. Can you merge it IBBoard? I didn't dare to, since there were apparently "issues" with merging branches and whatnot.

comment:13 Changed 9 years ago by ibboard

In [725]:

Re #97: Default army size

  • Merge accidental commit into "default name" branch into "default size" branch

comment:14 Changed 9 years ago by ibboard

Resolution: fixed
Status: needinfoclosed

In [726]:

Fixes #97: Default army size

  • Merge default army size branch with trunk code
  • Fix issues with UTF-8 encoding and new line characters

comment:15 Changed 9 years ago by ibboard

Milestone: WarFoundry 0.2WarFoundry API 0.2

Separate API milestone from UI milestone

comment:16 Changed 9 years ago by ibboard

Blocking: 57 removed

(In #57) Ticket doesn't make sense any more - we're defining the spec as we go and relying on backward/forward compatibility so there is no "complete" to load.

Note: See TracTickets for help on using tickets.