MCPcopy Create free account
hub / github.com/SimHacker/micropolis / buildBuilding

Method buildBuilding

MicropolisCore/src/MicropolisEngine/src/tool.cpp:703–729  ·  view source on GitHub ↗

* Build a building. * @param mapH Horizontal position of the 'center' tile in the world. * @param mapV Vertical position of the 'center' tile in the world. * @param buildingProps Building properties of the building being constructed. * @param effects Storage of effects of putting down the building. * @return Tool result. * * @todo Give #putBuilding a #BuildingPropert

Source from the content-addressed store, hash-verified

701 * @todo Move cost into building properties?
702 */
703ToolResult Micropolis::buildBuilding(int mapH, int mapV,
704 const BuildingProperties *buildingProps,
705 ToolEffects *effects)
706{
707 mapH--; mapV--; // Move position to top-left
708
709 ToolResult prepareResult = prepareBuildingSite(mapH, mapV,
710 buildingProps->sizeX,
711 buildingProps->sizeY,
712 effects);
713 if (prepareResult != TOOLRESULT_OK) {
714 return prepareResult;
715 }
716
717 /* Preparation was ok, put down the building. */
718 effects->addCost(gCostOf[buildingProps->tool]);
719
720 putBuilding(mapH, mapV, buildingProps->sizeX, buildingProps->sizeY,
721 buildingProps->baseTile, buildingProps->buildingIsAnimated,
722 effects);
723
724 checkBorder(mapH, mapV,
725 buildingProps->sizeX, buildingProps->sizeY,
726 effects);
727
728 return TOOLRESULT_OK;
729}
730
731
732/* Query */

Callers

nothing calls this directly

Calls 1

addCostMethod · 0.80

Tested by

no test coverage detected