Old revision #prdtzhh24 | New revision #p0xhrtwrn | ||
---|---|---|---|
1 | diff --git doc/data_format.rst doc/data_format.rst | 1 | diff --git doc/data_format.rst doc/data_format.rst |
2 | index 1595824.. | 2 | index 1595824..57d1faf 100644 |
3 | --- doc/data_format.rst | 3 | --- doc/data_format.rst |
4 | +++ doc/data_format.rst | 4 | +++ doc/data_format.rst |
5 | @@ -1442,7 +1442,7 @@ Persons | 5 | @@ -1442,7 +1442,7 @@ Persons | … | … |
11 | 11 | ||
12 | ====== ====== ========================================================== | 12 | ====== ====== ========================================================== |
13 | Offset Length Description | 13 | Offset Length Description |
14 | @@ -1472,8 +1472,11 @@ Offset Length Description | 14 | @@ -1471,9 +1471,18 @@ Offset Length Description |
15 | |||
15 | A person type defines the kind of persons: | 16 | A person type defines the kind of persons: |
16 | 17 | ||
17 | 17 | -- *Any* (0) Any kind of person (eg persons are not shown). | |
18 | -- *Pillar* (8) Guests from the Pillar Planet (test graphics). | 19 | -- *Pillar* (8) Guests from the Pillar Planet (test graphics). |
19 | -- *Earth* (16) Earth-bound persons. | 20 | -- *Earth* (16) Earth-bound persons. |
20 | +- *Guest* (8) Guests. | 21 | +============ ===== ======= ============================================ |
21 | +- *Handyman* (17) Handymen. | 22 | +Name Value Version Description |
22 | +- *Mechanic* (18) Mechanics. | 23 | +============ ===== ======= ============================================ |
23 | +- *Guard* (19) Security guards. | 24 | +Any 0 1- Any kind of person (persons are not shown). |
24 | +- *Entertainer* (20) Entertainers. | 25 | +Pillar 8 1 Guests from the Pillar planet (testing). |
26 | +Guest 8 2- Guests. | ||
27 | +Earth 16 1 Earth-bound persons. | ||
28 | +Handyman 17 2- Handymen. | ||
29 | +Mechanic 18 2- Mechanics. | ||
30 | +Guard 19 2- Security guards. | ||
31 | +Entertainer 20 2- Entertainers. | ||
32 | +============ ===== ======= ============================================ | ||
25 | 33 | ||
26 | The *any* kind is used as fall back. | 34 | The *any* kind is used as fall back. |
27 | 35 | ||
28 | @@ -1490,6 +149 | 28 | @@ -1490,6 +1499,8 @@ Version history |
29 | ............... | 37 | ............... |
30 | 38 | ||
31 | - 1 (20120708) Initial version. | 39 | - 1 (20120708) Initial version. | … | … |
448 | 456 | ||
449 | sprite { | 457 | sprite { |
450 | diff --git src/people.cpp src/people.cpp | 458 | diff --git src/people.cpp src/people.cpp |
451 | index 7696121.. | 451 | index 7696121..f798c08 100644 |
452 | --- src/people.cpp | 460 | --- src/people.cpp |
453 | +++ src/people.cpp | 461 | +++ src/people.cpp |
454 | @@ -86, | 454 | @@ -86,16 +86,16 @@ Guests::~Guests() |
455 | void Guests::Initialize() | 463 | void Guests::Initialize() |
456 | { | 464 | { |
457 | this->valid_ptypes = 0; | 465 | this->valid_ptypes = 0; |
458 | - for (PersonType pertype = PERSON_MIN_GUEST; pertype <= PERSON_MAX_GUEST; pertype++) { | 466 | - for (PersonType pertype = PERSON_MIN_GUEST; pertype <= PERSON_MAX_GUEST; pertype++) { |
459 | + for (PersonType pertype = PERSON_GUEST; pertype <= PERSON_GUEST; pertype++) { | 467 | - bool usable = true; |
460 | bool usable = true; | 468 | - for (AnimationType antype = ANIM_BEGIN; antype <= ANIM_LAST; antype++) { |
461 | for (AnimationType antype = ANIM_BEGIN; antype <= ANIM_LAST; antype++) { | 469 | - if (_sprite_manager.GetAnimation(antype, pertype) == nullptr) { |
462 | if (_sprite_manager.GetAnimation(antype, pertype) == nullptr) { | 470 | - usable = false; |
463 | @@ -94,7 +94,7 @@ void Guests::Initialize() | 471 | - break; |
464 | break; | 472 | - } |
465 | } | 473 | + PersonType pertype = PERSON_GUEST; |
474 | + bool usable = true; | ||
475 | + | ||
476 | + for (AnimationType antype = ANIM_BEGIN; antype <= ANIM_LAST; antype++) { | ||
477 | + if (_sprite_manager.GetAnimation(antype, pertype) == nullptr) { | ||
478 | + usable = false; | ||
479 | + break; | ||
466 | } | 480 | } |
467 | - if (usable) this->valid_ptypes |= 1u << (pertype - PERSON_MIN_GUEST); | 481 | - if (usable) this->valid_ptypes |= 1u << (pertype - PERSON_MIN_GUEST); |
468 | |||
469 | } | 482 | } |
483 | + if (usable) this->valid_ptypes |= 1u << (pertype - PERSON_ANY); | ||
470 | } | 484 | } |
471 | 485 | ||
486 | /** | ||
472 | @@ -105,8 +105,8 @@ void Guests::Initialize() | 487 | @@ -105,8 +105,8 @@ void Guests::Initialize() |
473 | */ | 488 | */ |
474 | bool Guests::CanUsePersonType(PersonType ptype) | 489 | bool Guests::CanUsePersonType(PersonType ptype) |
475 | { | 490 | { |
476 | - if (ptype < PERSON_MIN_GUEST || ptype > PERSON_MAX_GUEST) return false; | 491 | - if (ptype < PERSON_MIN_GUEST || ptype > PERSON_MAX_GUEST) return false; |
477 | - return (this->valid_ptypes & (1 << (ptype - PERSON_MIN_GUEST))) != 0; | 492 | - return (this->valid_ptypes & (1 << (ptype - PERSON_MIN_GUEST))) != 0; |
478 | + if (ptype | 478 | + if (ptype != PERSON_GUEST) return false; |
479 | + return (this->valid_ptypes & (1 << (ptype - PERSON_ANY))) != 0; | 494 | + return (this->valid_ptypes & (1 << (ptype - PERSON_ANY))) != 0; |
480 | } | 495 | } |
481 | 496 | … | … |
490 | if (this->CountActiveGuests() >= _scenario.max_guests) return; | 505 | if (this->CountActiveGuests() >= _scenario.max_guests) return; |
491 | if (!this->rnd.Success1024(_scenario.GetSpawnProbability(512))) return; | 506 | if (!this->rnd.Success1024(_scenario.GetSpawnProbability(512))) return; |
492 | diff --git src/people.h src/people.h | 507 | diff --git src/people.h src/people.h |
493 | index de3fa27.. | 493 | index de3fa27..0895d12 100644 |
494 | --- src/people.h | 509 | --- src/people.h |
495 | +++ src/people.h | 510 | +++ src/people.h |
496 | @@ -113,7 +113,7 @@ private: | 511 | @@ -60,6 +60,7 @@ protected: |
512 | /** | ||
513 | * All our guests. | ||
514 | * @todo Allow to have several blocks of guests. | ||
515 | + * @todo valid_ptypes should be removed. | ||
516 | */ | ||
517 | class Guests { | ||
518 | public: | ||
519 | @@ -113,7 +114,7 @@ private: | ||
497 | void AddFree(Guest *g); | 520 | void AddFree(Guest *g); |
498 | Guest *GetFree(); | 521 | Guest *GetFree(); |
499 | }; | 522 | }; | … | … |
503 | extern Guests _guests; | 526 | extern Guests _guests; |
504 | 527 | ||
505 | diff --git src/person.cpp src/person.cpp | 528 | diff --git src/person.cpp src/person.cpp |
506 | index d19d514.. | 506 | index d19d514..5d92f68 100644 |
507 | --- src/person.cpp | 530 | --- src/person.cpp |
508 | +++ src/person.cpp | 531 | +++ src/person.cpp |
509 | @@ -58,7 +58,7 @@ PersonTypeData &ModifyPersonTypeData(PersonType pt) | 532 | @@ -58,7 +58,7 @@ PersonTypeData &ModifyPersonTypeData(PersonType pt) | … | … |
511 | { | 534 | { |
512 | uint32 length = rcd_file->size; | 535 | uint32 length = rcd_file->size; |
513 | - if (rcd_file->version != 1 || length < 1) return false; | 536 | - if (rcd_file->version != 1 || length < 1) return false; |
514 | + if (rcd_file->version < 1 || | 514 | + if (rcd_file->version < 1 || rcd_file->version > 2 || length < 1) return false; |
515 | uint8 count = rcd_file->GetUInt8(); | 538 | uint8 count = rcd_file->GetUInt8(); |
516 | length--; | 539 | length--; |
517 | 540 | ||
518 | @@ -71,8 +71,1 | 518 | @@ -71,8 +71,12 @@ bool LoadPRSG(RcdFileReader *rcd_file) |
519 | 542 | ||
520 | PersonType pt; | 543 | PersonType pt; |
521 | switch (ps) { | 544 | switch (ps) { |
522 | - case 8: pt = PERSON_PILLAR; break; | 545 | - case 8: pt = PERSON_PILLAR; break; |
523 | - case 16: pt = PERSON_EARTH; break; | 546 | - case 16: pt = PERSON_EARTH; break; |
524 | + case 8: | 547 | + case 8: |
525 | + case 16: | 525 | + case 16: pt = PERSON_GUEST; break; |
526 | + pt = PERSON_GUEST; | ||
527 | + break; | ||
528 | + case 17: pt = PERSON_HANDYMAN; break; | 549 | + case 17: pt = PERSON_HANDYMAN; break; |
529 | + case 18: pt = PERSON_MECHANIC; break; | 550 | + case 18: pt = PERSON_MECHANIC; break; |
530 | + case 19: pt = PERSON_GUARD; break; | 551 | + case 19: pt = PERSON_GUARD; break; | … | … |
546 | 567 | ||
547 | void SetName(const char *name); | 568 | void SetName(const char *name); |
548 | diff --git src/person_type.h src/person_type.h | 569 | diff --git src/person_type.h src/person_type.h |
549 | index 20d25d2.. | 549 | index 20d25d2..47be967 100644 |
550 | --- src/person_type.h | 571 | --- src/person_type.h |
551 | +++ src/person_type.h | 572 | +++ src/person_type.h |
552 | @@ -19,15 +19,1 | 552 | @@ -19,15 +19,15 @@ class RcdFileReader; |
553 | 574 | ||
554 | /** Types of persons. */ | 575 | /** Types of persons. */ |
555 | enum PersonType { | 576 | enum PersonType { |
556 | - PERSON_ANY = 0, ///< No people displayed in the animation. | 577 | - PERSON_ANY = 0, ///< No people displayed in the animation. |
557 | - PERSON_PILLAR = 1, ///< %Guests from the planet of Pillars (test graphics). | 578 | - PERSON_PILLAR = 1, ///< %Guests from the planet of Pillars (test graphics). |
558 | - PERSON_EARTH = 2, ///< Earth-bound guests. | 579 | - PERSON_EARTH = 2, ///< Earth-bound guests. |
559 | + PERSON_ANY = 0, ///< No people displayed in the animation. | 580 | - PERSON_TYPE_COUNT, ///< Number of known types of persons. |
560 | + PERSON_GUEST = 1, ///< %Guests. | 581 | + PERSON_ANY, ///< No people displayed in the animation. |
561 | + PERSON_HANDYMAN = 2, ///< %Staff handymen. | 582 | + PERSON_GUEST, ///< %Guests. |
562 | + PERSON_MECHANIC = 3, ///< %Staff mechanics. | 583 | + PERSON_HANDYMAN, ///< %Staff handymen. |
563 | + PERSON_GUARD = 4, ///< %Staff security guards. | 584 | + PERSON_MECHANIC, ///< %Staff mechanics. |
564 | + PERSON_ENTERTAINER = 5, ///< %Staff entertainers. | 585 | + PERSON_GUARD, ///< %Staff security guards. |
565 | PERSON_TYPE_COUNT, ///< Number of known types of persons. | 586 | + PERSON_ENTERTAINER, ///< %Staff entertainers. |
587 | + PERSON_TYPE_COUNT, ///< Number of known types of persons. | ||
566 | 588 | ||
567 | PERSON_INVALID = 0xFF, ///< Invalid person type. | 589 | PERSON_INVALID = 0xFF, ///< Invalid person type. |
568 | 568 | - | |
569 | - PERSON_MIN_GUEST = PERSON_ANY, ///< First value of a guest. | 591 | - PERSON_MIN_GUEST = PERSON_ANY, ///< First value of a guest. |
570 | - PERSON_MAX_GUEST = PERSON_EARTH, ///< Last value of a guest. | 592 | - PERSON_MAX_GUEST = PERSON_EARTH, ///< Last value of a guest. |
571 | |||
572 | |||
573 | }; | 593 | }; |
574 | DECLARE_POSTFIX_INCREMENT(PersonType) | 594 | DECLARE_POSTFIX_INCREMENT(PersonType) |
575 | 595 | ||
576 | diff --git src/rcdgen/check_data.cpp src/rcdgen/check_data.cpp | 596 | diff --git src/rcdgen/check_data.cpp src/rcdgen/check_data.cpp |
577 | index 260441c.. | 577 | index 260441c..72f59b8 100644 |
578 | --- src/rcdgen/check_data.cpp | 598 | --- src/rcdgen/check_data.cpp |
579 | +++ src/rcdgen/check_data.cpp | 599 | +++ src/rcdgen/check_data.cpp |
580 | @@ -1071,12 +1071,15 @@ static std::shared_ptr<PRSGBlock> ConvertPRSGNode(std::shared_ptr<NodeGroup> ng) | 600 | @@ -1071,12 +1071,15 @@ static std::shared_ptr<PRSGBlock> ConvertPRSGNode(std::shared_ptr<NodeGroup> ng) | … | … |
588 | - {"walk_sw", 3}, // Walk in south-west direction. | 608 | - {"walk_sw", 3}, // Walk in south-west direction. |
589 | - {"walk_nw", 4}, // Walk in north-west direction. | 609 | - {"walk_nw", 4}, // Walk in north-west direction. |
590 | + {"guest", 8}, | 610 | + {"guest", 8}, |
591 | + {"handyman", | 591 | + {"handyman", 17}, |
592 | + {"mechanic", | 592 | + {"mechanic", 18}, |
593 | + {"guard", | 593 | + {"guard", 19}, |
594 | + {"entertainer", | 594 | + {"entertainer", 20}, |
595 | + {"walk_ne", 1}, // Walk in north-east direction. | 615 | + {"walk_ne", 1}, // Walk in north-east direction. |
596 | + {"walk_se", 2}, // Walk in south-east direction. | 616 | + {"walk_se", 2}, // Walk in south-east direction. |
597 | + {"walk_sw", 3}, // Walk in south-west direction. | 617 | + {"walk_sw", 3}, // Walk in south-west direction. | … | … |
606 | - {"pillar", 8}, | 626 | - {"pillar", 8}, |
607 | - {"earth", 16}, | 627 | - {"earth", 16}, |
608 | + {"guest", 8}, | 628 | + {"guest", 8}, |
609 | + {"handyman", | 609 | + {"handyman", 17}, |
610 | + {"mechanic", | 610 | + {"mechanic", 18}, |
611 | + {"guard", | 611 | + {"guard", 19}, |
612 | + {"entertainer", | 612 | + {"entertainer", 20}, |
613 | {"grey", COL_GREY}, | 633 | {"grey", COL_GREY}, |
614 | {"green_brown", COL_GREEN_BROWN}, | 634 | {"green_brown", COL_GREEN_BROWN}, |
615 | {"orange_brown", COL_ORANGE_BROWN}, | 635 | {"orange_brown", COL_ORANGE_BROWN}, | … | … |
627 | } | 647 | } |
628 | 648 | ||
629 | diff --git src/sprite_store.cpp src/sprite_store.cpp | 649 | diff --git src/sprite_store.cpp src/sprite_store.cpp |
630 | index cea7fd4.. | 630 | index cea7fd4..92ebc45 100644 |
631 | --- src/sprite_store.cpp | 651 | --- src/sprite_store.cpp |
632 | +++ src/sprite_store.cpp | 652 | +++ src/sprite_store.cpp |
633 | @@ -605,8 +605,1 | 633 | @@ -605,8 +605,12 @@ static PersonType DecodePersonType(uint8 pt) |
634 | { | 654 | { |
635 | switch (pt) { | 655 | switch (pt) { |
636 | case 0: return PERSON_ANY; | 656 | case 0: return PERSON_ANY; |
637 | - case 8: return PERSON_PILLAR; | 657 | - case 8: return PERSON_PILLAR; |
638 | - case 16: return PERSON_EARTH; | 658 | - case 16: return PERSON_EARTH; |
639 | + case 8: | 659 | + case 8: |
640 | + case 16: | 640 | + case 16: return PERSON_GUEST; |
641 | + return PERSON_GUEST; | ||
642 | + case 17: return PERSON_HANDYMAN; | 661 | + case 17: return PERSON_HANDYMAN; |
643 | + case 18: return PERSON_MECHANIC; | 662 | + case 18: return PERSON_MECHANIC; |
644 | + case 19: return PERSON_GUARD; | 663 | + case 19: return PERSON_GUARD; |
645 | + case 20: return PERSON_ENTERTAINER; | 664 | + case 20: return PERSON_ENTERTAINER; |
646 | default: return PERSON_INVALID; | 665 | default: return PERSON_INVALID; |
647 | } | 666 | } |
648 | |||
649 | |||
650 | |||
651 | |||
652 | |||
653 | |||
654 | |||
655 | |||
656 | |||
657 | } | 667 | } |