MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / setCollisionErrorMessage

Function setCollisionErrorMessage

src/OpenLoco/src/Map/TileClearance.cpp:35–140  ·  view source on GitHub ↗

0x00462C8E

Source from the content-addressed store, hash-verified

33
34 // 0x00462C8E
35 void setCollisionErrorMessage(const World::TileElement& el)
36 {
37 switch (el.type())
38 {
39 case ElementType::surface:
40 {
41 GameCommands::setErrorText(StringIds::raise_or_lower_land_first);
42 break;
43 }
44 case ElementType::track:
45 {
46 auto* elTrack = el.as<TrackElement>();
47 if (elTrack == nullptr)
48 {
49 return;
50 }
51 auto* trackObj = ObjectManager::get<TrackObject>(elTrack->trackObjectId());
52 FormatArguments::common(trackObj->name);
53
54 GameCommands::setErrorText(StringIds::string_id_in_the_way);
55 break;
56 }
57 case ElementType::station:
58 {
59 auto* elStation = el.as<StationElement>();
60 if (elStation == nullptr)
61 {
62 return;
63 }
64 constexpr std::array<StringId, 4> kStationTypeNames = {
65 StringIds::capt_station,
66 StringIds::capt_station,
67 StringIds::capt_airport,
68 StringIds::capt_ship_port,
69 };
70 FormatArguments::common(kStationTypeNames[enumValue(elStation->stationType())]);
71
72 GameCommands::setErrorText(StringIds::string_id_in_the_way);
73 break;
74 }
75
76 case ElementType::signal:
77 {
78 FormatArguments::common(StringIds::capt_signal);
79 GameCommands::setErrorText(StringIds::string_id_in_the_way);
80 break;
81 }
82 case ElementType::building:
83 {
84 auto* elBuidling = el.as<BuildingElement>();
85 if (elBuidling == nullptr)
86 {
87 return;
88 }
89 auto* buildingObj = elBuidling->getObject();
90 FormatArguments::common(buildingObj->name);
91
92 GameCommands::setErrorText(StringIds::string_id_in_the_way);

Callers 2

canConstructAtWithClearFunction · 0.85
canConstructWallFunction · 0.85

Calls 10

setErrorTextFunction · 0.85
commonFunction · 0.85
enumValueFunction · 0.85
typeMethod · 0.80
trackObjectIdMethod · 0.80
stationTypeMethod · 0.80
treeObjectIdMethod · 0.80
roadObjectIdMethod · 0.80
industryMethod · 0.80
getObjectMethod · 0.45

Tested by

no test coverage detected