Changeset - r8790:550c9960067a
[Not reviewed]
master
1 12 3
rubidium - 17 years ago 2008-03-31 07:25:49
rubidium@openttd.org
(svn r12501) -Codechange: split signs.h.
16 files changed with 126 insertions and 86 deletions:
0 comments (0 inline, 0 general)
projects/openttd_vs80.vcproj
Show inline comments
 
@@ -1320,7 +1320,15 @@
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\signs.h"
 
				RelativePath=".\..\src\signs_base.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\signs_func.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\signs_type.h"
 
				>
 
			</File>
 
			<File
projects/openttd_vs90.vcproj
Show inline comments
 
@@ -1317,7 +1317,15 @@
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\signs.h"
 
				RelativePath=".\..\src\signs_base.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\signs_func.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\signs_type.h"
 
				>
 
			</File>
 
			<File
source.list
Show inline comments
 
@@ -238,7 +238,9 @@ settings_type.h
 
ship.h
 
signal_func.h
 
signal_type.h
 
signs.h
 
signs_base.h
 
signs_func.h
 
signs_type.h
 
slope_func.h
 
slope_type.h
 
sound_func.h
src/main_gui.cpp
Show inline comments
 
@@ -16,7 +16,7 @@
 
#include "news_func.h"
 
#include "town.h"
 
#include "console.h"
 
#include "signs.h"
 
#include "signs_func.h"
 
#include "waypoint.h"
 
#include "variables.h"
 
#include "train.h"
src/network/network_internal.h
Show inline comments
 
@@ -45,7 +45,7 @@ enum {
 
	/** How many vehicle/station types we put over the network */
 
	NETWORK_VEHICLE_TYPES = 5,
 
	NETWORK_STATION_TYPES = 5,
 
}
 
};
 

	
 
struct NetworkPlayerInfo {
 
	char company_name[NETWORK_NAME_LENGTH];         ///< Company name
src/oldloader.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
#include "roadveh.h"
 
#include "ship.h"
 
#include "train.h"
 
#include "signs.h"
 
#include "signs_base.h"
 
#include "debug.h"
 
#include "depot.h"
 
#include "newgrf_config.h"
src/openttd.cpp
Show inline comments
 
@@ -44,7 +44,8 @@
 
#include "console.h"
 
#include "screenshot.h"
 
#include "network/network.h"
 
#include "signs.h"
 
#include "signs_base.h"
 
#include "signs_func.h"
 
#include "depot.h"
 
#include "waypoint.h"
 
#include "ai/ai.h"
src/signs.cpp
Show inline comments
 
@@ -6,7 +6,8 @@
 
#include "openttd.h"
 
#include "landscape.h"
 
#include "player_func.h"
 
#include "signs.h"
 
#include "signs_base.h"
 
#include "signs_func.h"
 
#include "saveload.h"
 
#include "command_func.h"
 
#include "variables.h"
src/signs.h
Show inline comments
 
deleted file
src/signs_base.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file signs_base.h Base class for signs. */
 

	
 
#ifndef SIGNS_BASE_H
 
#define SIGNS_BASE_H
 

	
 
#include "signs_type.h"
 
#include "oldpool.h"
 

	
 
DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
 

	
 
struct Sign : PoolItem<Sign, SignID, &_Sign_pool> {
 
	char *name;
 
	ViewportSign sign;
 
	int32        x;
 
	int32        y;
 
	byte         z;
 
	PlayerByte   owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
 

	
 
	/**
 
	 * Creates a new sign
 
	 */
 
	Sign(PlayerID owner = INVALID_PLAYER);
 

	
 
	/** Destroy the sign */
 
	~Sign();
 

	
 
	inline bool IsValid() const { return this->owner != INVALID_PLAYER; }
 
};
 

	
 
static inline SignID GetMaxSignIndex()
 
{
 
	/* TODO - This isn't the real content of the function, but
 
	 *  with the new pool-system this will be replaced with one that
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetSignPoolSize() - 1;
 
}
 

	
 
static inline uint GetNumSigns()
 
{
 
	extern uint _total_signs;
 
	return _total_signs;
 
}
 

	
 
static inline bool IsValidSignID(uint index)
 
{
 
	return index < GetSignPoolSize() && GetSign(index)->IsValid();
 
}
 

	
 
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (ss->IsValid())
 
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
 

	
 
#endif /* SIGNS_BASE_H */
src/signs_func.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file signs_func.h Functions related to signs. */
 

	
 
#ifndef SIGNS_FUNC_H
 
#define SIGNS_FUNC_H
 

	
 
#include "signs_type.h"
 

	
 
extern SignID _new_sign_id;
 
extern bool _sign_sort_dirty;
 

	
 
void UpdateAllSignVirtCoords();
 
void PlaceProc_Sign(TileIndex tile);
 

	
 
/* signs_gui.cpp */
 
void ShowRenameSignWindow(const Sign *si);
 

	
 
void ShowSignList();
 

	
 
#endif /* SIGNS_FUNC_H */
src/signs_gui.cpp
Show inline comments
 
@@ -8,7 +8,8 @@
 
#include "textbuf_gui.h"
 
#include "window_gui.h"
 
#include "player_gui.h"
 
#include "signs.h"
 
#include "signs_base.h"
 
#include "signs_func.h"
 
#include "debug.h"
 
#include "variables.h"
 
#include "command_func.h"
src/signs_type.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file signs_type.h Types related to signs */
 

	
 
#ifndef SIGNS_TYPE_H
 
#define SIGNS_TYPE_H
 

	
 
typedef uint16 SignID;
 
struct Sign;
 

	
 
enum {
 
	INVALID_SIGN = 0xFFFF,
 
};
 

	
 
#endif /* SIGNS_TYPE_H */
src/strings.cpp
Show inline comments
 
@@ -20,7 +20,7 @@
 
#include "group.h"
 
#include "debug.h"
 
#include "newgrf_townname.h"
 
#include "signs.h"
 
#include "signs_base.h"
 
#include "newgrf_engine.h"
 
#include "spritecache.h"
 
#include "fontcache.h"
src/terraform_gui.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "signs.h"
 
#include "signs_func.h"
 
#include "variables.h"
 
#include "functions.h"
 
#include "sound_func.h"
src/viewport.cpp
Show inline comments
 
@@ -12,7 +12,8 @@
 
#include "viewport_func.h"
 
#include "station_base.h"
 
#include "town.h"
 
#include "signs.h"
 
#include "signs_base.h"
 
#include "signs_func.h"
 
#include "waypoint.h"
 
#include "variables.h"
 
#include "train.h"
0 comments (0 inline, 0 general)