| 767 | DEF_RSB(church); |
| 768 | |
| 769 | Object* NewObject(LODShapeWithShadow* shape, int id) |
| 770 | { |
| 771 | const RStringB& className = shape->GetPropertyClass(); |
| 772 | if (className.GetLength() > 0) |
| 773 | { |
| 774 | if (className == RSB(forest)) |
| 775 | { |
| 776 | BuildingType* type = dynamic_cast<BuildingType*>(VehicleTypes.FindShape(shape->Name())); |
| 777 | if (type) |
| 778 | { |
| 779 | type->VehicleAddRef(); |
| 780 | Object* obj = new Forest(type, id); |
| 781 | type->VehicleRelease(); |
| 782 | return obj; |
| 783 | } |
| 784 | // RptF("%s: no forest in config",(const char *)shape->Name()); |
| 785 | return new ForestPlain(shape, id); |
| 786 | } |
| 787 | else if (className == RSB(road)) |
| 788 | { |
| 789 | return new Road(shape, id); |
| 790 | } |
| 791 | else if (className == RSB(streetlamp)) |
| 792 | { |
| 793 | // EntityType *vehType = VehicleTypes.New("StreetLamp"); |
| 794 | EntityType* vehType = VehicleTypes.FindShapeAndSimulation(shape->Name(), className); |
| 795 | if (!vehType) |
| 796 | { |
| 797 | vehType = VehicleTypes.FindShape(shape->Name()); |
| 798 | } |
| 799 | if (!vehType) |
| 800 | { |
| 801 | LOG_DEBUG(Graphics, "{}: {}, config class missing", shape->Name(), (const char*)className); |
| 802 | return new ObjectPlain(shape, id); |
| 803 | } |
| 804 | StreetLampType* type = dynamic_cast<StreetLampType*>(vehType); |
| 805 | if (!type) |
| 806 | { |
| 807 | LOG_DEBUG(Graphics, "{}: {}, config class not StreetLamp", shape->Name(), (const char*)className); |
| 808 | return new ObjectPlain(shape, id); |
| 809 | } |
| 810 | return new StreetLamp(shape, type, id); |
| 811 | } |
| 812 | else if (className == RSB(house) || className == RSB(vehicle) || className == RSB(church)) |
| 813 | { |
| 814 | // search vehicle type bank for given shape |
| 815 | // prefer type with the same simulation |
| 816 | EntityType* vType = VehicleTypes.FindShapeAndSimulation(shape->Name(), className); |
| 817 | if (!vType) |
| 818 | { |
| 819 | // if not found, resort to any type with this shape |
| 820 | vType = VehicleTypes.FindShape(shape->Name()); |
| 821 | } |
| 822 | if (!vType) |
| 823 | { |
| 824 | // it is not in config: ignore it |
| 825 | LOG_DEBUG(Graphics, "{}: {}, config class missing", shape->Name(), (const char*)className); |
| 826 | return new ObjectPlain(shape, id); |
no test coverage detected