summaryrefslogtreecommitdiff
path: root/src/saveload/ai_sl.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-01 12:03:34 +0000
committertruebrain <truebrain@openttd.org>2011-12-01 12:03:34 +0000
commitcc12942d70fa2a672c59e848c196c6647f8f1129 (patch)
tree3543911ce7080ad03897907e5e192d7697bc954e /src/saveload/ai_sl.cpp
parent0c2bbdde5c0f9577cff72af5b34c10777c6bebd0 (diff)
downloadopenttd-cc12942d70fa2a672c59e848c196c6647f8f1129.tar.xz
(svn r23384) -Remove: no longer allow a binary to be without AI support; the parts some compilers failed at, are integrated in other parts of the code now too
Diffstat (limited to 'src/saveload/ai_sl.cpp')
-rw-r--r--src/saveload/ai_sl.cpp88
1 files changed, 5 insertions, 83 deletions
diff --git a/src/saveload/ai_sl.cpp b/src/saveload/ai_sl.cpp
index cfb90c34c..31828be24 100644
--- a/src/saveload/ai_sl.cpp
+++ b/src/saveload/ai_sl.cpp
@@ -15,6 +15,11 @@
#include "saveload.h"
#include "../string_func.h"
+#include "../ai/ai.hpp"
+#include "../ai/ai_config.hpp"
+#include "../network/network.h"
+#include "../ai/ai_instance.hpp"
+
static char _ai_saveload_name[64];
static int _ai_saveload_version;
static char _ai_saveload_settings[1024];
@@ -28,12 +33,6 @@ static const SaveLoad _ai_company[] = {
SLE_END()
};
-#ifdef ENABLE_AI
-#include "../ai/ai.hpp"
-#include "../ai/ai_config.hpp"
-#include "../network/network.h"
-#include "../ai/ai_instance.hpp"
-
static void SaveReal_AIPL(int *index_ptr)
{
CompanyID index = (CompanyID)*index_ptr;
@@ -125,80 +124,3 @@ static void Save_AIPL()
extern const ChunkHandler _ai_chunk_handlers[] = {
{ 'AIPL', Save_AIPL, Load_AIPL, NULL, NULL, CH_ARRAY | CH_LAST},
};
-#else
-
-/** The type of the data that follows in the savegame. */
-enum SQSaveLoadType {
- SQSL_INT = 0x00, ///< The following data is an integer.
- SQSL_STRING = 0x01, ///< The following data is an string.
- SQSL_ARRAY = 0x02, ///< The following data is an array.
- SQSL_TABLE = 0x03, ///< The following data is an table.
- SQSL_BOOL = 0x04, ///< The following data is a boolean.
- SQSL_NULL = 0x05, ///< A null variable.
- SQSL_ARRAY_TABLE_END = 0xFF, ///< Marks the end of an array or table, no data follows.
-};
-
-static byte _ai_sl_byte;
-
-static const SaveLoad _ai_byte[] = {
- SLEG_VAR(_ai_sl_byte, SLE_UINT8),
- SLE_END()
-};
-
-static bool LoadObjects()
-{
- SlObject(NULL, _ai_byte);
- switch (_ai_sl_byte) {
- case SQSL_INT: {
- int value;
- SlArray(&value, 1, SLE_INT32);
- return true;
- }
-
- case SQSL_STRING: {
- SlObject(NULL, _ai_byte);
- static char buf[256];
- SlArray(buf, _ai_sl_byte, SLE_CHAR);
- return true;
- }
-
- case SQSL_ARRAY:
- while (LoadObjects()) { }
- return true;
-
- case SQSL_TABLE:
- while (LoadObjects()) { LoadObjects(); }
- return true;
-
- case SQSL_BOOL:
- SlObject(NULL, _ai_byte);
- return true;
-
- case SQSL_NULL:
- return true;
-
- case SQSL_ARRAY_TABLE_END:
- return false;
-
- default: SlErrorCorrupt("Invalid AI data type");
- }
-}
-
-static void Load_AIPL()
-{
- CompanyID index;
- while ((index = (CompanyID)SlIterateArray()) != (CompanyID)-1) {
- SlObject(NULL, _ai_company);
-
- if (!Company::IsValidAiID(index)) continue;
- SlObject(NULL, _ai_byte);
- /* Check if there was anything saved at all. */
- if (_ai_sl_byte == 0) continue;
- LoadObjects();
- }
-}
-
-extern const ChunkHandler _ai_chunk_handlers[] = {
- { 'AIPL', NULL, Load_AIPL, NULL, NULL, CH_ARRAY | CH_LAST},
-};
-#endif /* ENABLE_AI */