MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / addSeat

Method addSeat

source/gamemap/GameMap.cpp:2065–2092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2063}
2064
2065bool GameMap::addSeat(Seat *s)
2066{
2067 if(s == nullptr)
2068 {
2069 OD_LOG_ERR("unexpected null seat");
2070 return false;
2071 }
2072
2073 for(Seat* seat : mSeats)
2074 {
2075 if(seat->getId() == s->getId())
2076 {
2077 OD_LOG_ERR("Duplicated seat id=" + Helper::toString(seat->getId()));
2078 return false;
2079 }
2080 }
2081 mSeats.push_back(s);
2082 // We set the Seat color value
2083 const Ogre::ColourValue& colorValue = ConfigManager::getSingleton().getColorFromId(s->getColorId());
2084 s->setColorValue(colorValue);
2085
2086 // Add the goals for all seats to this seat.
2087 for (auto& goal : mGoalsForAllSeats)
2088 {
2089 s->addGoal(goal.get());
2090 }
2091 return true;
2092}
2093
2094Seat* GameMap::getSeatById(int id) const
2095{

Callers 3

processMessageMethod · 0.80
readGameMapFromFileFunction · 0.80

Calls 4

setColorValueMethod · 0.80
addGoalMethod · 0.80
toStringFunction · 0.50
getIdMethod · 0.45

Tested by

no test coverage detected