File diff r26193:4bc7915a2156 → r26194:f7347205838e
src/object_cmd.cpp
Show inline comments
 
@@ -202,13 +202,13 @@ static CommandCost ClearTile_Object(Tile
 
 * @param type the object type to build
 
 * @param view the view for the object
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type, uint8 view)
 
{
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 
	CommandCost cost(EXPENSES_T_SCENERY_CON);
 

	
 
	if (type >= NUM_OBJECTS) return CMD_ERROR;
 
	const ObjectSpec *spec = ObjectSpec::Get(type);
 
	if (_game_mode == GM_NORMAL && !spec->IsAvailable() && !_generating_world) return CMD_ERROR;
 
	if ((_game_mode == GM_EDITOR || _generating_world) && !spec->WasEverAvailable()) return CMD_ERROR;
 

	
 
@@ -475,13 +475,13 @@ static CommandCost ClearTile_Object(Tile
 
	Object *o = Object::GetByTile(tile);
 
	TileArea ta = o->location;
 

	
 
	ObjectType type = o->type;
 
	const ObjectSpec *spec = ObjectSpec::Get(type);
 

	
 
	CommandCost cost(EXPENSES_CONSTRUCTION, spec->GetClearCost() * ta.w * ta.h / 5);
 
	CommandCost cost(EXPENSES_T_DEMOLITION, spec->GetClearCost() * ta.w * ta.h / 5);
 
	if (spec->flags & OBJECT_FLAG_CLEAR_INCOME) cost.MultiplyCost(-1); // They get an income!
 

	
 
	/* Towns can't remove any objects. */
 
	if (_current_company == OWNER_TOWN) return CMD_ERROR;
 

	
 
	/* Water can remove everything! */
 
@@ -522,13 +522,13 @@ static CommandCost ClearTile_Object(Tile
 
				c->location_of_HQ = INVALID_TILE; // reset HQ position
 
				SetWindowDirty(WC_COMPANY, c->index);
 
				CargoPacket::InvalidateAllFrom(ST_HEADQUARTERS, c->index);
 
			}
 

	
 
			/* cost of relocating company is 1% of company value */
 
			cost = CommandCost(EXPENSES_CONSTRUCTION, CalculateCompanyValue(c) / 100);
 
			cost = CommandCost(EXPENSES_T_SCENERY_CON, CalculateCompanyValue(c) / 100);
 
			break;
 
		}
 

	
 
		case OBJECT_STATUE:
 
			if (flags & DC_EXEC) {
 
				Town *town = o->town;