summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-08-01 14:43:39 +0000
committeralberth <alberth@openttd.org>2010-08-01 14:43:39 +0000
commit9f8d730cc4e332973c2fc8e2d07c70ecad91deb0 (patch)
treeb5a9dd9db75090e4666aa1db9f76f75652d4b6ce /src/company_cmd.cpp
parentaa8ac7885af7523809715797318a25a24e12041e (diff)
downloadopenttd-9f8d730cc4e332973c2fc8e2d07c70ecad91deb0.tar.xz
(svn r20277) -Codechange: Move CmdSetAutoReplace() from company_cmd.cpp to autoreplace_cmd.cpp.
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 414363aed..4c3449a28 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -11,6 +11,7 @@
#include "stdafx.h"
#include "engine_base.h"
+#include "company_base.h"
#include "company_func.h"
#include "company_gui.h"
#include "town.h"
@@ -22,14 +23,11 @@
#include "network/network_base.h"
#include "ai/ai.hpp"
#include "company_manager_face.h"
-#include "group.h"
#include "window_func.h"
#include "strings_func.h"
#include "gfx_func.h"
#include "date_func.h"
#include "sound_func.h"
-#include "autoreplace_func.h"
-#include "autoreplace_gui.h"
#include "rail.h"
#include "core/pool_func.hpp"
#include "settings_func.h"
@@ -649,44 +647,6 @@ void CompaniesYearlyLoop()
}
}
-/** Change engine renewal parameters
- * @param tile unused
- * @param flags operation to perform
- * @param p1 packed data
- * - bits 16-31 = engine group
- * @param p2 packed data
- * - bits 0-15 = old engine type
- * - bits 16-31 = new engine type
- * @param text unused
- * @return the cost of this operation or an error
- */
-CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
-{
- Company *c = Company::GetIfValid(_current_company);
- if (c == NULL) return CMD_ERROR;
-
- EngineID old_engine_type = GB(p2, 0, 16);
- EngineID new_engine_type = GB(p2, 16, 16);
- GroupID id_g = GB(p1, 16, 16);
- CommandCost cost;
-
- if (!Group::IsValidID(id_g) && !IsAllGroupID(id_g) && !IsDefaultGroupID(id_g)) return CMD_ERROR;
- if (!Engine::IsValidID(old_engine_type)) return CMD_ERROR;
-
- if (new_engine_type != INVALID_ENGINE) {
- if (!Engine::IsValidID(new_engine_type)) return CMD_ERROR;
- if (!CheckAutoreplaceValidity(old_engine_type, new_engine_type, _current_company)) return CMD_ERROR;
-
- cost = AddEngineReplacementForCompany(c, old_engine_type, new_engine_type, id_g, flags);
- } else {
- cost = RemoveEngineReplacementForCompany(c, old_engine_type, id_g, flags);
- }
-
- if ((flags & DC_EXEC) && IsLocalCompany()) InvalidateAutoreplaceWindow(old_engine_type, id_g);
-
- return cost;
-}
-
/**
* Fill the CompanyNewsInformation struct with the required data.
* @param c the current company.