mirror of https://github.com/OpenTTD/OpenTTD
(svn r2781) Fix some of the issues with variables in .h files.
parent
91353c841f
commit
29564f9fcf
27
economy.c
27
economy.c
|
@ -25,6 +25,23 @@
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "vehicle_gui.h"
|
#include "vehicle_gui.h"
|
||||||
|
|
||||||
|
// Score info
|
||||||
|
const ScoreInfo _score_info[] = {
|
||||||
|
{SCORE_VEHICLES, 120, 100},
|
||||||
|
{SCORE_STATIONS, 80, 100},
|
||||||
|
{SCORE_MIN_PROFIT, 10000, 100},
|
||||||
|
{SCORE_MIN_INCOME, 50000, 50},
|
||||||
|
{SCORE_MAX_INCOME, 100000, 100},
|
||||||
|
{SCORE_DELIVERED, 40000, 400},
|
||||||
|
{SCORE_CARGO, 8, 50},
|
||||||
|
{SCORE_MONEY, 10000000, 50},
|
||||||
|
{SCORE_LOAN, 250000, 50},
|
||||||
|
{SCORE_TOTAL, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
int _score_part[MAX_PLAYERS][NUM_SCORE];
|
||||||
|
|
||||||
|
|
||||||
// get a mask of the allowed currencies depending on the year
|
// get a mask of the allowed currencies depending on the year
|
||||||
uint GetMaskOfAllowedCurrencies(void)
|
uint GetMaskOfAllowedCurrencies(void)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +146,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
|
||||||
/* Count vehicles */
|
/* Count vehicles */
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
int32 min_profit = score_info[SCORE_MIN_PROFIT].needed;
|
int32 min_profit = _score_info[SCORE_MIN_PROFIT].needed;
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -228,7 +245,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
|
||||||
|
|
||||||
/* Generate score for loan */
|
/* Generate score for loan */
|
||||||
{
|
{
|
||||||
_score_part[owner][SCORE_LOAN] = score_info[SCORE_LOAN].needed - p->current_loan;
|
_score_part[owner][SCORE_LOAN] = _score_info[SCORE_LOAN].needed - p->current_loan;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we calculate the score for each item..
|
// Now we calculate the score for each item..
|
||||||
|
@ -241,10 +258,12 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
|
||||||
// Skip the total
|
// Skip the total
|
||||||
if (i == SCORE_TOTAL) continue;
|
if (i == SCORE_TOTAL) continue;
|
||||||
// Check the score
|
// Check the score
|
||||||
s = (_score_part[owner][i] >= score_info[i].needed) ? score_info[i].score : ((_score_part[owner][i] * score_info[i].score) / score_info[i].needed);
|
s = (_score_part[owner][i] >= _score_info[i].needed) ?
|
||||||
|
_score_info[i].score :
|
||||||
|
((_score_part[owner][i] * _score_info[i].score) / _score_info[i].needed);
|
||||||
if (s < 0) s = 0;
|
if (s < 0) s = 0;
|
||||||
score += s;
|
score += s;
|
||||||
total_score += score_info[i].score;
|
total_score += _score_info[i].score;
|
||||||
}
|
}
|
||||||
|
|
||||||
_score_part[owner][SCORE_TOTAL] = score;
|
_score_part[owner][SCORE_TOTAL] = score;
|
||||||
|
|
16
economy.h
16
economy.h
|
@ -49,20 +49,8 @@ typedef struct ScoreInfo {
|
||||||
int score; // How much score it will give
|
int score; // How much score it will give
|
||||||
} ScoreInfo;
|
} ScoreInfo;
|
||||||
|
|
||||||
static const ScoreInfo score_info[] = {
|
extern const ScoreInfo _score_info[];
|
||||||
{SCORE_VEHICLES, 120, 100},
|
extern int _score_part[MAX_PLAYERS][NUM_SCORE];
|
||||||
{SCORE_STATIONS, 80, 100},
|
|
||||||
{SCORE_MIN_PROFIT, 10000, 100},
|
|
||||||
{SCORE_MIN_INCOME, 50000, 50},
|
|
||||||
{SCORE_MAX_INCOME, 100000, 100},
|
|
||||||
{SCORE_DELIVERED, 40000, 400},
|
|
||||||
{SCORE_CARGO, 8, 50},
|
|
||||||
{SCORE_MONEY, 10000000, 50},
|
|
||||||
{SCORE_LOAN, 250000, 50},
|
|
||||||
{SCORE_TOTAL, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
int _score_part[MAX_PLAYERS][NUM_SCORE];
|
|
||||||
|
|
||||||
int UpdateCompanyRatingAndValue(Player *p, bool update);
|
int UpdateCompanyRatingAndValue(Player *p, bool update);
|
||||||
void UpdatePlayerHouse(Player *p, uint score);
|
void UpdatePlayerHouse(Player *p, uint score);
|
||||||
|
|
|
@ -60,6 +60,7 @@ void StationPickerDrawSprite(int x, int y, int railtype, int image);
|
||||||
|
|
||||||
/* track_land.c */
|
/* track_land.c */
|
||||||
void DrawTrainDepotSprite(int x, int y, int image, int railtype);
|
void DrawTrainDepotSprite(int x, int y, int image, int railtype);
|
||||||
|
void DrawDefaultWaypointSprite(int x, int y, int railtype);
|
||||||
|
|
||||||
/* road_land.c */
|
/* road_land.c */
|
||||||
void DrawRoadDepotSprite(int x, int y, int image);
|
void DrawRoadDepotSprite(int x, int y, int image);
|
||||||
|
|
|
@ -936,8 +936,8 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
||||||
for (i=0;i<NUM_SCORE;i++) {
|
for (i=0;i<NUM_SCORE;i++) {
|
||||||
y += 20;
|
y += 20;
|
||||||
val = _score_part[owner][i];
|
val = _score_part[owner][i];
|
||||||
needed = score_info[i].needed;
|
needed = _score_info[i].needed;
|
||||||
score = score_info[i].score;
|
score = _score_info[i].score;
|
||||||
// SCORE_TOTAL has his own rulez ;)
|
// SCORE_TOTAL has his own rulez ;)
|
||||||
if (i == SCORE_TOTAL) {
|
if (i == SCORE_TOTAL) {
|
||||||
needed = total_score;
|
needed = total_score;
|
||||||
|
|
3
gui.h
3
gui.h
|
@ -121,8 +121,7 @@ void BuildFileList(void);
|
||||||
void SetFiosType(const byte fiostype);
|
void SetFiosType(const byte fiostype);
|
||||||
|
|
||||||
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
|
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
|
||||||
static const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5};
|
extern const byte _fios_colors[];
|
||||||
|
|
||||||
|
|
||||||
/* network gui */
|
/* network gui */
|
||||||
void ShowNetworkGameWindow(void);
|
void ShowNetworkGameWindow(void);
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
#include "network_client.h"
|
#include "network_client.h"
|
||||||
#include "network_server.h"
|
#include "network_server.h"
|
||||||
|
|
||||||
#include "table/animcursors.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Min/Max date for scenario editor */
|
/* Min/Max date for scenario editor */
|
||||||
static const uint MinDate = 0; // 1920-01-01 (MAX_YEAR_BEGIN_REAL)
|
static const uint MinDate = 0; // 1920-01-01 (MAX_YEAR_BEGIN_REAL)
|
||||||
static const uint MaxDate = 29220; // 2000-01-01
|
static const uint MaxDate = 29220; // 2000-01-01
|
||||||
|
|
|
@ -1158,6 +1158,9 @@ static const Widget _save_dialog_scen_widgets[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Colors for fios types
|
||||||
|
const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5};
|
||||||
|
|
||||||
void BuildFileList(void)
|
void BuildFileList(void)
|
||||||
{
|
{
|
||||||
_fios_path_changed = true;
|
_fios_path_changed = true;
|
||||||
|
|
25
rail_cmd.c
25
rail_cmd.c
|
@ -26,6 +26,13 @@
|
||||||
|
|
||||||
extern uint16 _custom_sprites_base;
|
extern uint16 _custom_sprites_base;
|
||||||
|
|
||||||
|
const byte _track_sloped_sprites[14] = {
|
||||||
|
14, 15, 22, 13,
|
||||||
|
0, 21, 17, 12,
|
||||||
|
23, 0, 18, 20,
|
||||||
|
19, 16
|
||||||
|
};
|
||||||
|
|
||||||
void ShowTrainDepotWindow(TileIndex tile);
|
void ShowTrainDepotWindow(TileIndex tile);
|
||||||
|
|
||||||
/* Format of rail map5 byte.
|
/* Format of rail map5 byte.
|
||||||
|
@ -1587,6 +1594,24 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawDefaultWaypointSprite(int x, int y, int railtype)
|
||||||
|
{
|
||||||
|
const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
|
||||||
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
|
uint32 img;
|
||||||
|
|
||||||
|
img = dtss++->image;
|
||||||
|
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK) + rti->total_offset;
|
||||||
|
DrawSprite(img, x, y);
|
||||||
|
|
||||||
|
for (; dtss->image != 0; dtss++) {
|
||||||
|
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
||||||
|
img = dtss->image;
|
||||||
|
if (img & PALETTE_MODIFIER_COLOR) img |= PLAYER_SPRITE_COLOR(_local_player);
|
||||||
|
DrawSprite(img, x + pt.x, y + pt.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct SetSignalsData {
|
typedef struct SetSignalsData {
|
||||||
int cur;
|
int cur;
|
||||||
int cur_stack;
|
int cur_stack;
|
||||||
|
|
|
@ -63,9 +63,3 @@ static const DrawTrackSeqStruct* const _track_depot_layout_table[] = {
|
||||||
_track_waypoint_table_1,
|
_track_waypoint_table_1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _track_sloped_sprites[14] = {
|
|
||||||
14, 15, 22, 13,
|
|
||||||
0, 21, 17, 12,
|
|
||||||
23, 0, 18, 20,
|
|
||||||
19, 16
|
|
||||||
};
|
|
||||||
|
|
|
@ -149,8 +149,3 @@ static const WaterDrawTileStruct* const _shiplift_display_seq[] = {
|
||||||
|
|
||||||
#undef BEGIN
|
#undef BEGIN
|
||||||
#undef END
|
#undef END
|
||||||
|
|
||||||
|
|
||||||
static const SpriteID _water_shore_sprites[15] = {
|
|
||||||
0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0
|
|
||||||
};
|
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
|
|
||||||
|
#include "table/bridge_land.h"
|
||||||
|
#include "table/tunnel_land.h"
|
||||||
|
|
||||||
|
extern const byte _track_sloped_sprites[14];
|
||||||
|
extern const SpriteID _water_shore_sprites[15];
|
||||||
|
|
||||||
extern void DrawCanalWater(TileIndex tile);
|
extern void DrawCanalWater(TileIndex tile);
|
||||||
|
|
||||||
static const byte _bridge_available_year[MAX_BRIDGES] = {
|
static const byte _bridge_available_year[MAX_BRIDGES] = {
|
||||||
|
@ -944,11 +950,6 @@ static const byte _bridge_foundations[2][16] = {
|
||||||
|
|
||||||
extern const byte _road_sloped_sprites[14];
|
extern const byte _road_sloped_sprites[14];
|
||||||
|
|
||||||
#include "table/track_land.h"
|
|
||||||
#include "table/bridge_land.h"
|
|
||||||
#include "table/tunnel_land.h"
|
|
||||||
#include "table/water_land.h"
|
|
||||||
|
|
||||||
static void DrawBridgePillars(TileInfo *ti, int x, int y, int z)
|
static void DrawBridgePillars(TileInfo *ti, int x, int y, int z)
|
||||||
{
|
{
|
||||||
const uint32 *b;
|
const uint32 *b;
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
#include "depot.h"
|
#include "depot.h"
|
||||||
#include "vehicle_gui.h"
|
#include "vehicle_gui.h"
|
||||||
|
|
||||||
|
const SpriteID _water_shore_sprites[15] = {
|
||||||
|
0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void FloodVehicle(Vehicle *v);
|
static void FloodVehicle(Vehicle *v);
|
||||||
|
|
||||||
static bool IsClearWaterTile(TileIndex tile)
|
static bool IsClearWaterTile(TileIndex tile)
|
||||||
|
|
16
waypoint.c
16
waypoint.c
|
@ -16,7 +16,6 @@
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/track_land.h"
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* Max waypoints: 64000 (8 * 8000) */
|
/* Max waypoints: 64000 (8 * 8000) */
|
||||||
|
@ -359,6 +358,7 @@ Station *ComposeWaypointStation(TileIndex tile)
|
||||||
|
|
||||||
extern uint16 _custom_sprites_base;
|
extern uint16 _custom_sprites_base;
|
||||||
|
|
||||||
|
|
||||||
/* Draw a waypoint */
|
/* Draw a waypoint */
|
||||||
void DrawWaypointSprite(int x, int y, int stat_id, uint railtype)
|
void DrawWaypointSprite(int x, int y, int stat_id, uint railtype)
|
||||||
{
|
{
|
||||||
|
@ -376,18 +376,7 @@ void DrawWaypointSprite(int x, int y, int stat_id, uint railtype)
|
||||||
|
|
||||||
/* draw default waypoint graphics of ID 0 */
|
/* draw default waypoint graphics of ID 0 */
|
||||||
if (stat_id == 0) {
|
if (stat_id == 0) {
|
||||||
const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
|
DrawDefaultWaypointSprite(x, y, railtype);
|
||||||
|
|
||||||
img = dtss++->image;
|
|
||||||
if (img & PALETTE_MODIFIER_COLOR) img = (img & SPRITE_MASK) + rti->total_offset;
|
|
||||||
DrawSprite(img, x, y);
|
|
||||||
|
|
||||||
for (; dtss->image != 0; dtss++) {
|
|
||||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
|
||||||
img = dtss->image;
|
|
||||||
if (img & PALETTE_MODIFIER_COLOR) img |= ormod;
|
|
||||||
DrawSprite(img, x + pt.x, y + pt.y);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +396,6 @@ void DrawWaypointSprite(int x, int y, int stat_id, uint railtype)
|
||||||
foreach_draw_tile_seq(seq, cust->seq) {
|
foreach_draw_tile_seq(seq, cust->seq) {
|
||||||
Point pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z);
|
Point pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z);
|
||||||
uint32 image = seq->image + relocation;
|
uint32 image = seq->image + relocation;
|
||||||
|
|
||||||
DrawSprite((image & SPRITE_MASK) | ormod, x + pt.x, y + pt.y);
|
DrawSprite((image & SPRITE_MASK) | ormod, x + pt.x, y + pt.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue