Mercurial > repos > IBBoard.WarFoundry.API
comparison api/Objects/GameSystem.cs @ 309:7e1b27843b0d
Fixes #99: Define "points" values in GameSystem
* Implement fall-back in case only one value has been set
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 20 Feb 2011 16:00:11 +0000 |
parents | e1438fb9024c |
children | e09a8d9c95f6 |
comparison
equal
deleted
inserted
replaced
308:e1438fb9024c | 309:7e1b27843b0d |
---|---|
322 return ability; | 322 return ability; |
323 } | 323 } |
324 | 324 |
325 public string GetPointsAbbrev(double pointTemp) | 325 public string GetPointsAbbrev(double pointTemp) |
326 { | 326 { |
327 string str = (pointTemp == 1 ? SystemPtsAbbrevSingle : SystemPtsAbbrevPlural); | 327 string abbrev = (pointTemp == 1 ? GetPreferredString(SystemPtsAbbrevSingle, SystemPtsAbbrevPlural) : GetPreferredString(SystemPtsAbbrevPlural, SystemPtsAbbrevSingle)); |
328 return (str == null ? "" : str); | 328 return abbrev; |
329 } | 329 } |
330 | 330 |
331 public string GetPointsName(double pointTemp) | 331 public string GetPointsName(double pointTemp) |
332 { | 332 { |
333 string str = (pointTemp == 1 ? SystemPtsNameSingle : SystemPtsNamePlural); | 333 string ptsName = (pointTemp == 1 ? GetPreferredString(SystemPtsNameSingle, SystemPtsNamePlural) : GetPreferredString(SystemPtsNamePlural, SystemPtsNameSingle)); |
334 return (str == null ? "" : str); | 334 return ptsName; |
335 } | |
336 | |
337 private string GetPreferredString(string str1, string str2) | |
338 { | |
339 string preferred = ""; | |
340 | |
341 if (str1 != null) | |
342 { | |
343 preferred = str1; | |
344 } | |
345 else if (str2 != null) | |
346 { | |
347 preferred = str2; | |
348 } | |
349 | |
350 return preferred; | |
335 } | 351 } |
336 } | 352 } |
337 } | 353 } |