~ubuntu-branches/ubuntu/saucy/cuyo/saucy

« back to all changes in this revision

Viewing changes to src/version.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2010-07-19 09:54:44 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100719095444-ecoegzo1vvvdwra9
Tags: 2.~-1.1.brl3-1ubuntu1
* Merge from debian unstable (LP: #607106). Remaining changes:
  - Don't register MimeType=application/x-executable in
    the .desktop file.
  - Remove UTF-8 in the .desktop file
  - 

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "fehler.h"
21
21
#include "version.h"
 
22
#include "cuyointl.h"
22
23
 
23
24
 
24
25
#define anz_packs 7
25
26
const char * packs_merkmale[anz_packs+1] = {
26
27
  "main", "all", "game", "extreme", "nofx", "weird", "unfinished", 0};
27
28
const char * packs_namen[anz_packs] = {
28
 
  _("Standard"),_("All levels"),_("Games"),_("Extremes"),_("No FX"),
29
 
  _("Weird"),_("Unfinished")};
 
29
  // TRANSLATORS: Name of a level track
 
30
  N_("Standard"),
 
31
  // TRANSLATORS: Name of a level track
 
32
  N_("All levels"),
 
33
  // TRANSLATORS: Name of a level track
 
34
  N_("Games"),
 
35
  // TRANSLATORS: Name of a level track
 
36
  N_("Extremes"),
 
37
  // TRANSLATORS: Name of a level track
 
38
  N_("No FX"),
 
39
  // TRANSLATORS: Name of a level track
 
40
  N_("Weird"),
 
41
  // TRANSLATORS: Name of a level track
 
42
  N_("Unfinished")};
30
43
const char * packs_infos[anz_packs] = {
31
 
  _("A selection of levels for the common taste"),
32
 
  _("All levels except the unfinished ones"),
33
 
  _("Levels simulating board games or other computer games"),
34
 
  _("Levels setting records such as `fastest dropping ceiling'"),
35
 
  _("Plain levels without any disturbing tweaks to the rules"),
36
 
  _("Levels interpreting the general theme of cuyo more broadly"),
37
 
  _("Works in progress")
 
44
  N_("A selection of levels for the common taste"),
 
45
  N_("All levels except the unfinished ones"),
 
46
  N_("Levels simulating board games or other computer games"),
 
47
  N_("Levels setting records such as `fastest dropping ceiling'"),
 
48
  N_("Plain levels without any disturbing tweaks to the rules"),
 
49
  N_("Levels interpreting the general theme of cuyo more broadly"),
 
50
  N_("Works in progress")
38
51
};
39
 
Dimension Version::gLevelpack =
40
 
  Dimension(anz_packs,packs_merkmale,packs_namen,packs_infos);
 
52
Dimension Version::gLevelpack = Dimension();
41
53
 
42
54
 
43
55
 
44
56
#define anz_schwer 3
45
57
const char * schwer_merkmale[anz_schwer+1] = {"easy", "", "hard"};
46
 
const char * schwer_namen[anz_schwer+1] = {_("Easy"),_("Normal"),_("Hard")};
 
58
const char * schwer_namen[anz_schwer+1] = {
 
59
  // TRANSLATORS: Name of a difficulty setting
 
60
  N_("Easy"),
 
61
  // TRANSLATORS: Name of a difficulty setting
 
62
  N_("Normal"),
 
63
  // TRANSLATORS: Name of a difficulty setting
 
64
  N_("Hard")};
47
65
const char * schwer_infos[anz_schwer+1] = {
48
66
  "",
49
67
  "",
50
68
  ""
51
69
};
52
 
Dimension Version::gSchwierig =
53
 
  Dimension(anz_schwer,schwer_merkmale,schwer_namen,schwer_infos);
 
70
Dimension Version::gSchwierig = Dimension();
54
71
 
55
72
 
56
73
 
184
201
    for (; !gefunden && i!=e; ++i)
185
202
      gefunden = differenz(*i,version).size()==0;    /* Teilmengentest */
186
203
    if (!gefunden)
 
204
      /* TRANSLATORS: The composition "%s%s" is programming specific and
 
205
         should not be translated. */
187
206
      throw Fehler(_("%s lacks version %s%s"), schluessel.data(),
188
207
                   schluessel.data(), setToString(version).data());
189
208
  }
246
265
 
247
266
 
248
267
 
249
 
Dimension::Dimension(int g,
 
268
Dimension::Dimension() : mInitialized(false) {
 
269
}
 
270
 
 
271
void Dimension::init(int g,
250
272
                     const char * const * const m,
251
273
                     const char * const * const n,
252
 
                     const char * const * const i) : mGroesse(g) {
 
274
                     const char * const * const i) {
 
275
  mGroesse=g;
253
276
  for (int j=0; j<mGroesse; j++) {
254
277
    mMerkmale.push_back(m[j]);
255
 
    mProsaNamen.push_back(n[j]);
256
 
    mErklaerungen.push_back(i[j]);
 
278
    mProsaNamen.push_back(_(n[j]));
 
279
    mErklaerungen.push_back(_(i[j]));
257
280
  }
 
281
  mInitialized=true;
258
282
}
259
283
 
260
284
int Dimension::suchMerkmal(const Str & merkmal) {
 
285
  if (!mInitialized)
 
286
    throw(iFehler(_("Uninitialized dimension")));
261
287
  for (int i=0; i<mGroesse; i++)
262
288
    if (mMerkmale[i]==merkmal)
263
289
      return i;
343
369
}
344
370
 
345
371
 
 
372
void Version::init() {
 
373
  gLevelpack.init(anz_packs,packs_merkmale,packs_namen,packs_infos);
 
374
  gSchwierig.init(anz_schwer,schwer_merkmale,schwer_namen,schwer_infos);
 
375
}
 
376
 
346
377
const set<Str> Version::auspraegungen(int dim) {
347
378
  set<Str> ret = set<Str>();
348
379
  CASSERT((dim>=0) && (dim<anzahl_dim));
436
467
 
437
468
 
438
469
 
439
 
VersionMapIntern::VersionMapIntern() : mGeprueft(), mVerzeichnis() {}
 
470
VersionMapIntern::VersionMapIntern() : mGeprueft(), mGut(), mVerzeichnis() {}
440
471
 
441
472
void VersionMapIntern::neuerEintragIntern(const Str & schluessel,
442
473
                                          const Version & version,
443
474
                                          void* inhalt) {
444
475
  if (geprueft(schluessel))
 
476
    /* TRANSLATORS: The composition "%s%s" is programming specific and
 
477
       should not be translated. */
445
478
    throw Fehler(_("%s was already accessed, new version %s%s is not allowed"),
446
479
                 schluessel.data(),
447
480
                 schluessel.data(), version.toString().data());
478
511
 
479
512
void* VersionMapIntern::BestapproximierendeIntern
480
513
     (const Str & schluessel, const Version & version,
481
 
      bool defaultVorhanden) {
 
514
      bool defaultVorhanden) const {
482
515
 
483
516
  assertWohlgeformt(schluessel, defaultVorhanden);
484
517
 
513
546
}
514
547
 
515
548
void VersionMapIntern::assertWohlgeformt(const Str & schluessel,
516
 
                                   bool defaultVorhanden) {
517
 
  if (geprueft(schluessel))
 
549
                                   bool defaultVorhanden) const {
 
550
  if (geprueft(schluessel)) {
 
551
    if (mGut.find(schluessel)==mGut.end())
 
552
      throw Fehler(_("Previous problem with %s still persists"),
 
553
                   schluessel.data());
518
554
    return;
 
555
  }
519
556
 
520
557
  /* Schonmal den Pr�fstempel verteilen, vielleicht vergessen wir's sonst.
521
558
     Insbesondere, wenn die Pr�fung nicht bestanden wird (Der Stempel sagt
533
570
                                       e = i0->second.end();
534
571
    for (; i!=e; ++i) {
535
572
      if (!legal(i->first.mMerkmale))
 
573
        /* TRANSLATORS: The composition "%s%s" is programming specific and
 
574
           should not be translated. */
536
575
        throw Fehler(_("Illegal version %s%s"),
537
576
                     schluessel.data(), i->first.toString().data());
538
577
      versionen.insert(i->first.mMerkmale);
551
590
      set<Str> v = vereinigung(*i1,*i2);
552
591
      if (legal(v))
553
592
        if (versionen.find(v)==e)
 
593
          /* TRANSLATORS: The composition "%s%s" is programming specific and
 
594
             should not be translated. */
554
595
          throw Fehler(_("%s%s not uniquely defined"),
555
596
                       schluessel.data(), setToString(v).data());
556
597
    }
561
602
    set<Str> version = *i1;
562
603
    if (testeAusschoepfendRedundant(*i1,versionen,leer,
563
604
                                    Version::gAusschoepfend.begin()))
 
605
      /* TRANSLATORS: The composition "%s%s" is programming specific and
 
606
         should not be translated. */
564
607
      throw Fehler(_("%s%s eclipsed by more specialized versions"),
565
608
                   schluessel.data(), setToString(version).data());
566
609
  }
570
613
    versionen.insert(set<Str>());
571
614
  testeAusschoepfend(schluessel, versionen, leer,
572
615
                     Version::gAusschoepfend.begin());
 
616
 
 
617
  mGut.insert(schluessel);
573
618
}
574
619