Changeset - r2696:2c5f2d1dbfe3
[Not reviewed]
master
0 4 0
truelight - 19 years ago 2005-11-26 16:18:15
truelight@openttd.org
(svn r3238) -Fix: always save if you want GPMI-based AIs, this on request by
Darkvater, so we can, in the future, save patch options in savegames
without any problems.
4 files changed with 0 insertions and 14 deletions:
0 comments (0 inline, 0 general)
ai/ai.c
Show inline comments
 
@@ -235,37 +235,33 @@ void AI_PlayerDied(PlayerID player)
 

	
 
#ifdef GPMI
 
	gpmi_mod_unload(_ai_player[player].module);
 
#endif /* GPMI */
 
}
 

	
 
/**
 
 * Initialize some AI-related stuff.
 
 */
 
void AI_Initialize(void)
 
{
 
	bool tmp_ai_network_client = _ai.network_client;
 
#ifdef GPMI
 
	bool tmp_ai_gpmi = _ai.gpmi;
 
#endif /* GPMI */
 

	
 
	memset(&_ai, 0, sizeof(_ai));
 
	memset(&_ai_player, 0, sizeof(_ai_player));
 

	
 
	_ai.network_client = tmp_ai_network_client;
 
	_ai.network_playas = OWNER_SPECTATOR;
 
	_ai.enabled = true;
 
#ifdef GPMI
 
	_ai.gpmi = tmp_ai_gpmi;
 
#endif /* GPMI */
 
}
 

	
 
/**
 
 * Deinitializer for AI-related stuff.
 
 */
 
void AI_Uninitialize(void)
 
{
 
	Player* p;
 

	
 
	FOR_ALL_PLAYERS(p) {
 
		if (p->is_active && p->is_ai && _ai_player[p->index].active) AI_PlayerDied(p->index);
 
	}
ai/ai.h
Show inline comments
 
@@ -30,27 +30,25 @@ typedef struct AIPlayer {
 
} AIPlayer;
 

	
 
/* The struct to keep some data about the AI in general */
 
typedef struct AIStruct {
 
	/* General */
 
	bool enabled;           //! Is AI enabled?
 
	uint tick;              //! The current tick (something like _frame_counter, only for AIs)
 

	
 
	/* For network-clients (a OpenTTD client who acts as an AI connected to a server) */
 
	bool network_client;    //! Are we a network_client?
 
	uint8 network_playas;   //! The current network player we are connected as
 

	
 
#ifdef GPMI
 
	bool gpmi;              //! True if we want GPMI AIs
 
#endif /* GPMI */
 
} AIStruct;
 

	
 
VARDEF AIStruct _ai;
 
VARDEF AIPlayer _ai_player[MAX_PLAYERS];
 

	
 
// ai.c
 
void AI_StartNewAI(PlayerID player);
 
void AI_PlayerDied(PlayerID player);
 
void AI_RunGameLoop(void);
 
void AI_Initialize(void);
 
void AI_Uninitialize(void);
 
int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
settings.c
Show inline comments
 
@@ -2,27 +2,25 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "currency.h"
 
#include "functions.h"
 
#include "macros.h"
 
#include "screenshot.h"
 
#include "sound.h"
 
#include "string.h"
 
#include "variables.h"
 
#include "network.h"
 
#include "settings.h"
 
#ifdef GPMI
 
#include "ai/ai.h"
 
#endif /* GPMI */
 

	
 
typedef struct IniFile IniFile;
 
typedef struct IniItem IniItem;
 
typedef struct IniGroup IniGroup;
 
typedef struct SettingsMemoryPool SettingsMemoryPool;
 

	
 
static void pool_init(SettingsMemoryPool **pool);
 
static void *pool_alloc(SettingsMemoryPool **pool, uint size);
 
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size);
 
static void pool_free(SettingsMemoryPool **pool);
 

	
 
struct SettingsMemoryPool {
 
@@ -937,27 +935,25 @@ const SettingDesc patch_settings[] = {
 
	{"auto_euro",						SDT_BOOL,		(void*)true,	&_patches.auto_euro,						NULL},
 

	
 
	{"serviceathelipad",		SDT_BOOL,		(void*)true,	&_patches.serviceathelipad,			NULL},
 
	{"smooth_economy",			SDT_BOOL,		(void*)true,	&_patches.smooth_economy,				NULL},
 
	{"allow_shares",				SDT_BOOL,		(void*)true,	&_patches.allow_shares,					NULL},
 
	{"dist_local_authority",SDT_UINT8,	(void*)20,		&_patches.dist_local_authority, NULL},
 

	
 
	{"wait_oneway_signal",	SDT_UINT8,	(void*)15,		&_patches.wait_oneway_signal,		NULL},
 
	{"wait_twoway_signal",	SDT_UINT8,	(void*)41,		&_patches.wait_twoway_signal,		NULL},
 

	
 
	{"ainew_active",				SDT_BOOL,		(void*)false, &_patches.ainew_active,					NULL},
 
	{"ai_in_multiplayer",		SDT_BOOL,		(void*)false, &_patches.ai_in_multiplayer,		NULL},
 
#ifdef GPMI
 
	{"ai_gpmi",							SDT_BOOL,		(void*)true,	&_ai.gpmi,											NULL},
 
#endif /* GPMI */
 

	
 
	{"map_x", SDT_UINT32, (void*)8, &_patches.map_x, NULL},
 
	{"map_y", SDT_UINT32, (void*)8, &_patches.map_y, NULL},
 

	
 
	/* New Path Finding */
 
	{"new_pathfinding_all",	SDT_BOOL,		(void*)false, &_patches.new_pathfinding_all,	NULL},
 

	
 
	/* The maximum number of nodes to search */
 
	{"npf_max_search_nodes",   SDT_UINT32, (void*)10000,  &_patches.npf_max_search_nodes,		NULL},
 

	
 
	/* When a red signal is encountered, a small detour can be made around
 
	* it. This specifically occurs when a track is doubled, in which case
settings_gui.c
Show inline comments
 
@@ -10,27 +10,25 @@
 
#include "table/strings.h"
 
#include "window.h"
 
#include "gui.h"
 
#include "gfx.h"
 
#include "command.h"
 
#include "engine.h"
 
#include "screenshot.h"
 
#include "newgrf.h"
 
#include "network.h"
 
#include "console.h"
 
#include "town.h"
 
#include "variables.h"
 
#ifdef GPMI
 
#include "ai/ai.h"
 
#endif /* GPMI */
 

	
 
static uint32 _difficulty_click_a;
 
static uint32 _difficulty_click_b;
 
static byte _difficulty_timeout;
 

	
 
static const StringID _distances_dropdown[] = {
 
	STR_0139_IMPERIAL_MILES,
 
	STR_013A_METRIC_KILOMETERS,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _driveside_dropdown[] = {
 
@@ -754,27 +752,25 @@ static const PatchEntry _patches_economy
 

	
 
	{PE_INT32,	PF_NOCOMMA, STR_CONFIG_PATCHES_COLORED_NEWS_DATE, "colored_new_data", &_patches.colored_news_date, 1900, 2200, 5, NULL},
 
	{PE_INT32,	PF_NOCOMMA, STR_CONFIG_PATCHES_STARTING_DATE, "starting_date", &_patches.starting_date,	 MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, 1, NULL},
 
	{PE_INT32,	PF_NOCOMMA | PF_NETWORK_ONLY, STR_CONFIG_PATCHES_ENDING_DATE, "ending_date", &_patches.ending_date,	 MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, 1, NULL},
 

	
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_SMOOTH_ECONOMY,		"smooth_economy", &_patches.smooth_economy,						0,  0,  0, NULL},
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_ALLOW_SHARES,			"allow_shares", &_patches.allow_shares,						0,  0,  0, NULL},
 
};
 

	
 
static const PatchEntry _patches_ai[] = {
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AINEW_ACTIVE, "ainew_active", &_patches.ainew_active, 0, 1, 1, &AiNew_PatchActive_Warning},
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER, "ai_in_multiplayer", &_patches.ai_in_multiplayer, 0, 1, 1, &Ai_In_Multiplayer_Warning},
 
#ifdef GPMI
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AI_GPMI, "ai_gpmi", &_ai.gpmi, 0, 1, 1, NULL},
 
#endif /* GPMI */
 

	
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, "ai_disable_veh_train", &_patches.ai_disable_veh_train,			0,  0,  0, NULL},
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,"ai_disable_veh_roadveh",&_patches.ai_disable_veh_roadveh,		0,  0,  0, NULL},
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,"ai_disable_veh_aircraft",&_patches.ai_disable_veh_aircraft,0,  0,  0, NULL},
 
	{PE_BOOL,		0, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,"ai_disable_veh_ship",&_patches.ai_disable_veh_ship,			0,  0,  0, NULL},
 
};
 

	
 
typedef struct PatchPage {
 
	const PatchEntry *entries;
 
	uint num;
 
} PatchPage;
 

	
0 comments (0 inline, 0 general)