Commit d2517d71 authored by Ansgar's avatar Ansgar

Imported Upstream version 102.2.2~ds1

parent 8cf9707a
......@@ -4,7 +4,7 @@ CONFIG ?= config.default
BACKENDS = allegro gdi sdl mixer_sdl x11 posix
COLOUR_DEPTHS = 0 8 16
OSTYPES = beos cygwin freebsd linux mingw mac
OSTYPES = beos cygwin freebsd haiku linux mingw mac
ifeq ($(findstring $(BACKEND), $(BACKENDS)),)
$(error Unkown BACKEND "$(BACKEND)", must be one of "$(BACKENDS)")
......@@ -25,35 +25,39 @@ endif
ifeq ($(OSTYPE),beos)
STD_LIBS ?= -lz -lnet
STD_LIBS ?= -lz -lbz2
endif
ifeq ($(OSTYPE),haiku)
STD_LIBS ?= -lz -lbz2
endif
ifeq ($(OSTYPE),freebsd)
STD_LIBS ?= -lz
STD_LIBS ?= -lz -lbz2
endif
ifeq ($(OSTYPE),mac)
CFLAGS += -DUSE_HW -DUSE_C -Os -fast
CXXFLAGS += -DUSE_HW -DUSE_C
STD_LIBS ?= -lz
STD_LIBS ?= -lz -lbz2
endif
ifeq ($(OSTYPE),linux)
STD_LIBS ?= -lz
STD_LIBS ?= -lz -lbz2
endif
ifeq ($(OSTYPE),cygwin)
OS_INC ?= -I/usr/include/mingw
OS_OPT ?= -mwin32
STD_LIBS ?= -lgdi32 -lwinmm -lz
STD_LIBS ?= -lgdi32 -lwinmm -lz -lbz2
endif
ifeq ($(OSTYPE),mingw)
CC ?= gcc
SOURCES += simsys_w32_png.cc
OS_OPT ?= -mno-cygwin -DPNG_STATIC -DZLIB_STATIC -march=pentium
STD_LIBS ?= -lz
STD_LIBS ?= -lz -lbz2
ifeq ($(BACKEND),gdi)
STD_LIBS += -lunicows
endif
......
......@@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winmm.lib zlibstat.lib advapi32.lib wsock32.lib $(NOINHERIT)"
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winmm.lib zlibstat.lib advapi32.lib wsock32.lib libbz2.lib $(NOINHERIT)"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;G:\Program Files\PlatformSDK\Lib&quot;;G:\Projects\zlib\lib"
IgnoreAllDefaultLibraries="false"
......@@ -125,7 +125,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;G:\Projects\SDL-1.2.10\include&quot;;&quot;G:\Program Files\PlatformSDK\Include&quot;;G:\Projects\zlib\include"
PreprocessorDefinitions="ZLIB_WINAPI;LITTLE_ENDIAN;STEPS16;USE_C;WIN32"
PreprocessorDefinitions="DEBUG;ZLIB_WINAPI;LITTLE_ENDIAN;STEPS16;USE_C;WIN32"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
......@@ -144,7 +144,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winmm.lib zlibstat.lib advapi32.lib wsock32.lib $(NOINHERIT)"
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winmm.lib zlibstat.lib advapi32.lib wsock32.lib libbz2.lib $(NOINHERIT)"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;G:\Program Files\PlatformSDK\Lib&quot;;G:\Projects\zlib\lib"
IgnoreDefaultLibraryNames="libcmt.lib"
......@@ -1082,6 +1082,10 @@
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\simres.rc"
>
</File>
</Filter>
</Files>
<Globals>
......
......@@ -287,6 +287,13 @@ void hausbauer_t::remove( karte_t *welt, spieler_t *sp, gebaeude_t *gb )
}
}
}
// tell players of the deletion
for(uint8 i=0; i<MAX_PLAYER_COUNT; i++) {
spieler_t *sp = welt->get_spieler(i);
if (sp) {
sp->notify_factory(spieler_t::notify_delete, fab);
}
}
// remove all transformers
for(k.y = pos.y; k.y < pos.y+size.y; k.y ++) {
k.x = pos.x-1;
......
......@@ -298,11 +298,11 @@ bool tunnelbauer_t::baue_tunnel(karte_t *welt, spieler_t *sp, koord3d start, koo
DBG_MESSAGE("tunnelbauer_t::baue()","build from (%d,%d,%d) to (%d,%d,%d) ", pos.x, pos.y, pos.z, end.x, end.y, end.z );
// now we seach a matchin way for the tunnels top speed
// now we search a matching way for the tunnels top speed
const weg_besch_t *weg_besch = besch->get_weg_besch();
if(weg_besch==NULL) {
// now we seach a matchin wy for the tunnels top speed
weg_besch = wegbauer_t::weg_search( wegtyp, besch->get_topspeed(), welt->get_timeline_year_month(), weg_t::type_flat );
// ignore timeline to get consistent results
weg_besch = wegbauer_t::weg_search( wegtyp, besch->get_topspeed(), 0, weg_t::type_flat );
}
const weg_besch_t *einfahrt_weg_besch = baue_einfahrt(welt, sp, pos, zv, besch, NULL, cost);
......
/*
* Copyright (c) 1997 - 2002 Hansjrg Malthaner
* Copyright (c) 1997 - 2002 Hj. Malthaner
*
* This file is part of the Simutrans project under the artistic licence.
* (see licence.txt)
......@@ -11,6 +11,7 @@
#include "../simware.h"
#include "../simcolor.h"
#include "warenbauer.h"
#include "../dataobj/translator.h"
stringhashtable_tpl<const ware_besch_t *> warenbauer_t::besch_names;
......@@ -147,11 +148,11 @@ bool warenbauer_t::register_besch(ware_besch_t *besch)
const ware_besch_t *
warenbauer_t::get_info(const char* name)
{
const ware_besch_t* t = besch_names.get(name);
if(t == NULL) {
dbg->fatal("warenbauer_t::get_info()", "No info for good '%s' available", name);
const ware_besch_t *ware = besch_names.get(name);
if (ware==NULL) {
ware = besch_names.get(translator::compatibility_name(name));
}
return t;
return ware;
}
......
......@@ -57,6 +57,7 @@
#include "../dings/crossing.h"
#include "../dings/leitung2.h"
#include "../dings/groundobj.h"
#include "../dings/wayobj.h"
#include "../vehicle/movingobj.h"
......@@ -1504,16 +1505,14 @@ wegbauer_t::intern_calc_route_runways(koord3d start3d, const koord3d ziel3d)
}
// now try a straight line with no crossings and no curves at the end
const int dist=koord_distance( ziel, start );
grund_t *from = welt->lookup(start)->get_kartenboden();
for( int i=0; i<=dist; i++ ) {
gr=welt->lookup(start+zv*i)->get_kartenboden();
// no slopes!
if(gr->get_grund_hang()!=0) {
return false;
}
if(gr->hat_wege() && !gr->hat_weg(air_wt)) {
// cannot cross another way
grund_t *to = welt->lookup(start+zv*i)->get_kartenboden();
long dummy;
if (!is_allowed_step(from, to, &dummy)) {
return false;
}
from = to;
}
// now we can build here
route.clear();
......@@ -1812,8 +1811,9 @@ wegbauer_t::baue_tunnelboden()
const weg_besch_t *wb = tunnel_besch->get_weg_besch();
if(wb==NULL) {
// now we seach a matchin wy for the tunnels top speed
wb = wegbauer_t::weg_search( tunnel_besch->get_waytype(), tunnel_besch->get_topspeed(), welt->get_timeline_year_month(), weg_t::type_flat );
// now we search a matching way for the tunnels top speed
// ignore timeline to get consistent results
wb = wegbauer_t::weg_search( tunnel_besch->get_waytype(), tunnel_besch->get_topspeed(), 0, weg_t::type_flat );
}
if(gr==NULL) {
......@@ -1844,6 +1844,11 @@ wegbauer_t::baue_tunnelboden()
weg_t *weg = gr->get_weg(tunnel_besch->get_waytype());
weg->set_besch(wb);
weg->set_max_speed(tunnel_besch->get_topspeed());
// respect max speed of catenary
wayobj_t *wo = gr->get_wayobj((waytype_t)tunnel_besch->get_waytype());
if (wo && wo->get_besch()->get_topspeed() < weg->get_max_speed()) {
weg->set_max_speed( wo->get_besch()->get_topspeed() );
}
gr->calc_bild();
cost -= tunnel_besch->get_preis();
......@@ -1915,7 +1920,7 @@ void wegbauer_t::baue_strasse()
weg_t * weg = gr->get_weg(road_wt);
// keep faster ways or if it is the same way ... (@author prissi)
if(weg->get_besch()==besch || keep_existing_ways || (keep_existing_city_roads && weg->hat_gehweg()) || (keep_existing_faster_ways && weg->get_besch()->get_topspeed()>besch->get_topspeed()) || (sp!=NULL && !spieler_t::check_owner( sp, weg->get_besitzer())) || (gr->get_typ()==grund_t::monorailboden && (bautyp&elevated_flag)==0)) {
if(weg->get_besch()==besch || keep_existing_ways || (keep_existing_city_roads && weg->hat_gehweg()) || (keep_existing_faster_ways && weg->get_besch()->get_topspeed()>besch->get_topspeed()) || (sp!=NULL && weg->ist_entfernbar(sp)!=NULL) || (gr->get_typ()==grund_t::monorailboden && (bautyp&elevated_flag)==0)) {
//nothing to be done
//DBG_MESSAGE("wegbauer_t::baue_strasse()","nothing to do at (%i,%i)",k.x,k.y);
}
......@@ -1926,6 +1931,11 @@ void wegbauer_t::baue_strasse()
// cost is the more expensive one, so downgrading is between removing and new buidling
cost -= max( weg->get_besch()->get_preis(), besch->get_preis() );
weg->set_besch(besch);
// respect max speed of catenary
wayobj_t *wo = gr->get_wayobj((waytype_t)besch->get_wtyp());
if (wo && wo->get_besch()->get_topspeed() < weg->get_max_speed()) {
weg->set_max_speed( wo->get_besch()->get_topspeed() );
}
spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung());
weg->set_besitzer(sp);
}
......@@ -1991,6 +2001,11 @@ void wegbauer_t::baue_schiene()
// cost is the more expensive one, so downgrading is between removing and new buidling
cost -= max( weg->get_besch()->get_preis(), besch->get_preis() );
weg->set_besch(besch);
// respect max speed of catenary
wayobj_t *wo = gr->get_wayobj((waytype_t)besch->get_wtyp());
if (wo && wo->get_besch()->get_topspeed() < weg->get_max_speed()) {
weg->set_max_speed( wo->get_besch()->get_topspeed() );
}
spieler_t::add_maintenance( sp, weg->get_besch()->get_wartung());
weg->set_besitzer(sp);
}
......@@ -2073,9 +2088,10 @@ class fluss_fahrer_t : fahrer_t
// make a river
void wegbauer_t::baue_fluss()
{
/* since the contraits of the wayfinder ensures that a river flows always downwards
/* since the contraints of the wayfinder ensures that a river flows always downwards
* we can assume that the first tiles are the ocean.
* Usually the wayfinder would find either direction!
* route[0] tile at the ocean, route[get_count()-1] the spring of the river
*/
// Do we join an other river?
......@@ -2092,10 +2108,12 @@ void wegbauer_t::baue_fluss()
// first check then lower riverbed
const sint8 start_h = route[start_n].z;
uint32 end_n = get_count();
uint32 i = start_n;
while(i<get_count()) {
// first find all tiles that are on the same level as tile i
// and check whether we can lower all of them
// if lowering fails we do not continue river building
bool ok = true;
uint32 j;
for(j=i; j<get_count() && ok; j++) {
......@@ -2105,20 +2123,22 @@ void wegbauer_t::baue_fluss()
ok = welt->can_ebne_planquadrat(route[j].get_2d(), max(route[j].z-1, start_h));
}
// now lower all tiles that have the same height as tile i
if (ok) {
for(uint32 k=i; k<j; k++) {
welt->ebne_planquadrat(NULL, route[k].get_2d(), max(route[k].z-1, start_h));
}
for(uint32 k=i; k<j; k++) {
welt->ebne_planquadrat(NULL, route[k].get_2d(), max(route[k].z-1, start_h));
}
i = ok ? j : j+1;
if (!ok) {
end_n = j;
break;
}
i = j;
}
// now build the river
for( uint32 i=start_n; i<get_count(); i++ ) {
for( uint32 i=start_n; i<end_n; i++ ) {
grund_t* gr = welt->lookup_kartenboden(route[i].get_2d());
if( gr->get_typ()!=grund_t::wasser ) {
// get direction
ribi_t::ribi ribi = route.get_short_ribi(i);
ribi_t::ribi ribi = i<end_n-1 ? route.get_short_ribi(i) : ribi_typ(route[i-1].get_2d()-route[i].get_2d());
bool extend = gr->weg_erweitern(water_wt, ribi);
if( !extend ) {
weg_t *sch=weg_t::alloc(water_wt);
......@@ -2129,7 +2149,7 @@ void wegbauer_t::baue_fluss()
}
// we will make rivers gradually larger by stepping up their width
if( umgebung_t::river_types>1 ) {
if( umgebung_t::river_types>1 && start_n<get_count()) {
/* since we will stop at the first crossing with an existent river,
* we cannot make sure, we have the same destination;
* thus we use the routefinder to find the sea
......
......@@ -242,7 +242,8 @@ void weg_t::rdwr(loadsave_t *file)
*/
void weg_t::info(cbuffer_t & buf) const
{
buf.append("\n");
ding_t::info(buf);
buf.append(translator::translate("Max. speed:"));
buf.append(" ");
buf.append(max_speed);
......@@ -299,11 +300,10 @@ void weg_t::rotate90()
/**
* counts signals on this tile;
* It would be enough for the signals to register and unreigister themselves, but this is more secure ...
* It would be enough for the signals to register and unregister themselves, but this is more secure ...
* @author prissi
*/
void
weg_t::count_sign()
void weg_t::count_sign()
{
// Either only sign or signal please ...
flags &= ~(HAS_SIGN|HAS_SIGNAL|HAS_CROSSING);
......@@ -383,11 +383,14 @@ bool weg_t::check_season( const long )
}
}
else if( ribi_t::is_threeway(ribi) && besch->has_switch_bild() ) {
if( bild==besch->get_bild_nr( ribi, old_snow ) ) {
set_bild( besch->get_bild_nr( ribi, snow ) );
if( bild==besch->get_bild_nr_switch(ribi, old_snow, false) ) {
set_bild( besch->get_bild_nr_switch(ribi, snow, false) );
}
else if( bild==besch->get_bild_nr_switch(ribi, old_snow, true) ) {
set_bild( besch->get_bild_nr_switch(ribi, snow, true) );
}
else {
set_bild( besch->get_bild_nr( ribi+16, snow ) );
set_bild( besch->get_bild_nr( ribi, snow ) );
}
}
else {
......@@ -420,7 +423,7 @@ void weg_t::calc_bild()
}
// use snow image if above snowline and above ground
bool snow = (get_pos().z >= welt->get_snowline());
bool snow = (!from->ist_tunnel() || from->ist_karten_boden()) && (get_pos().z >= welt->get_snowline());
flags &= ~IS_SNOW;
if( snow ) {
flags |= IS_SNOW;
......
......@@ -579,7 +579,7 @@ dingliste_t::loesche_alle(spieler_t *sp, uint8 offset)
else {
if(capacity==1) {
ding_t *dt = obj.one;
if(dt->is_moving()) {
if(dt->is_moving() && !(dt->get_typ()==ding_t::fussgaenger || dt->get_typ()==ding_t::verkehr || dt->get_typ()==ding_t::movingobj)) {
((vehikel_t *)dt)->verlasse_feld();
}
else {
......
......@@ -415,7 +415,30 @@ void einstellungen_t::rdwr(loadsave_t *file)
// cost section ...
file->rdwr_bool( freeplay, "" );
file->rdwr_longlong( starting_money, "" );
if( file->get_version()>=103000 ) {
file->rdwr_longlong( starting_money, "" );
// these must be saved, since new player will get different amounts eventually
for( int i=0; i<10; i++ ) {
file->rdwr_short( startingmoneyperyear[i].year, 0 );
file->rdwr_longlong( startingmoneyperyear[i].money, 0 );
file->rdwr_bool( startingmoneyperyear[i].interpol, 0 );
}
}
else {
// compatibility code
sint64 save_starting_money = starting_money;
if(file->is_saving()) {
if(save_starting_money==0) save_starting_money = get_starting_money(starting_year);
if(save_starting_money==0) save_starting_money = umgebung_t::default_einstellungen.get_starting_money(starting_year);
if(save_starting_money==0) save_starting_money = 20000000;
}
file->rdwr_longlong( save_starting_money, "" );
if(file->is_loading()) {
if(save_starting_money==0) save_starting_money = umgebung_t::default_einstellungen.get_starting_money(starting_year);
if(save_starting_money==0) save_starting_money = 20000000;
starting_money = save_starting_money;
}
}
file->rdwr_long( maint_building, "" );
file->rdwr_longlong( cst_multiply_dock, "" );
......@@ -602,7 +625,58 @@ void einstellungen_t::parse_simuconf( tabfile_t &simuconf, sint16 &disp_width, s
verkehr_level = contents.get_int("citycar_level", verkehr_level); // ten normal years
stadtauto_duration = contents.get_int("default_citycar_life", stadtauto_duration); // ten normal years
// starting money
starting_money = contents.get_int64("starting_money", starting_money );
/* up to ten blocks year, money, interpolation={0,1} are possible:
* starting_money[i]=y,m,int
* y .. year
* m .. money (in 1/100 Cr)
* int .. interpolation: 0 - no interpolation, !=0 linear interpolated
* (m) is the starting money for player start after (y), if (i)!=0, the starting money
* is linearly interpolated between (y) and the next greater year given in another entry.
* starting money for given year is:
*/
int j=0;
for( int i = 0; i<10; i++ ) {
char name[32];
sprintf( name, "starting_money[%i]", i );
int *test = contents.get_ints(name);
if ((test[0]>1) && (test[0]<=3)) {
// insert sorted by years
int k=0;
for (k=0; k<i; k++) {
if (startingmoneyperyear[k].year > test[1]) {
for (int l=j; l>=k; l--)
memcpy( &startingmoneyperyear[l+1], &startingmoneyperyear[l], sizeof(yearmoney));
break;
}
}
startingmoneyperyear[k].year = test[1];
startingmoneyperyear[k].money = test[2];
if (test[0]==3) {
startingmoneyperyear[k].interpol = test[3]!=0;
}
else {
startingmoneyperyear[k].interpol = false;
}
j++;
}
else {
// invalid entry
}
delete [] test;
}
// at least one found => use this now!
if( j>0 && startingmoneyperyear[0].money>0 ) {
starting_money = 0;
}
// fill remaining entries
for( int i=j+1; i<10; i++ ) {
startingmoneyperyear[i].year = 0;
startingmoneyperyear[i].money = 0;
startingmoneyperyear[i].interpol = 0;
}
maint_building = contents.get_int("maintenance_building", maint_building);
numbered_stations = contents.get_int("numbered_stations", numbered_stations );
......@@ -701,3 +775,45 @@ void einstellungen_t::parse_simuconf( tabfile_t &simuconf, sint16 &disp_width, s
simuconf.close();
}
sint64 einstellungen_t::get_starting_money(sint16 year) const
{
if( starting_money>0 ) {
return starting_money;
}
// search entry with startingmoneyperyear[i].year > year
int i;
bool found = false;
for( i=0; i<10; i++ ) {
if(startingmoneyperyear[i].year!=0) {
if (startingmoneyperyear[i].year>year) {
found = true;
break;
}
}
else {
// year is behind the latest given date
return startingmoneyperyear[i>0 ? i-1 : 0].money;
}
}
if (i==0) {
// too early: use first entry
return startingmoneyperyear[0].money;
}
else {
// now: startingmoneyperyear[i-1].year <= year < startingmoneyperyear[i].year
if (startingmoneyperyear[i-1].interpol) {
// linear interpolation
return startingmoneyperyear[i-1].money +
(startingmoneyperyear[i].money-startingmoneyperyear[i-1].money)
* (year-startingmoneyperyear[i-1].year) /(startingmoneyperyear[i].year-startingmoneyperyear[i-1].year);
}
else {
// no interpolation
return startingmoneyperyear[i-1].money;
}
}
}
......@@ -118,6 +118,14 @@ private:
sint64 starting_money;
typedef struct {
sint16 year;
sint64 money;
bool interpol;
} yearmoney;
yearmoney startingmoneyperyear[10];
/**
* Use numbering for stations?
*
......@@ -324,7 +332,7 @@ public:
sint32 get_max_transfers() const { return max_transfers; }
void set_max_transfers(sint32 m) { max_transfers=m; }
sint64 get_starting_money() const { return starting_money; }
sint64 get_starting_money(sint16 year) const;
void set_starting_money(sint64 s) { starting_money = s; }
bool get_random_pedestrians() const { return fussgaenger; }
......
......@@ -159,7 +159,7 @@ void freelist_t::putback_node( size_t size, void *p )
if(size>MAX_LIST_INDEX) {
switch(size) {
case message_node_size:
case message_node_size/4:
list = &message_nodes;
break;
case 1220/4:
......
This diff is collapsed.
......@@ -9,6 +9,7 @@
#define loadsave_h
#include <stdio.h>
#include <bzlib.h>
#include "../utils/cstring_t.h"
#include "../simtypes.h"
......@@ -31,7 +32,7 @@
class loadsave_t {
public:
enum mode_t { text=8, xml=2, binary=1, zipped=4, xml_zipped=6 };
enum mode_t { text=1, xml=2, binary=0, zipped=4, xml_zipped=6, bzip2=8, xml_bzip2=10 };
private:
int mode;
......@@ -43,9 +44,11 @@ private:
cstring_t filename; // the current name ...
FILE *fp;
BZFILE *bzfp;
int bse;
// Hajo: putc got a name clash on my system
int lsputc(int c);
void lsputc(int c);
// Hajo: getc got a name clash on my system
int lsgetc();
......@@ -72,10 +75,10 @@ public:
*/
bool is_eof();
void* get_file() { return fp; }
bool is_loading() const { return !saving; }
bool is_saving() const { return saving; }
bool is_zipped() const { return mode&zipped; }
bool is_bzip2() const { return mode&bzip2; }
bool is_xml() const { return mode&xml; }
uint32 get_version() const { return version; }
const char *get_pak_extension() const { return pak_extension; }
......
This diff is collapsed.
......@@ -9,8 +9,6 @@
bool umgebung_t::drive_on_left = false;
char umgebung_t::program_dir[1024];
const char *umgebung_t::user_dir = 0;
bool umgebung_t::networkmode = false;
bool umgebung_t::server = false;
long umgebung_t::server_frames_ahead = 1;
// this is explicitely and interactively set by user => we do not touch it in init
......
......@@ -36,11 +36,11 @@ public:
static cstring_t objfilename;
// true, if we are in networkmode
static bool networkmode;
static const bool networkmode = false;
static long server_frames_ahead;
// true, if we are the server
static bool server;
static const bool server = false;
// scrollrichtung
static sint16 scroll_multi;
......
......@@ -625,7 +625,6 @@ void baum_t::info(cbuffer_t & buf) const
{
ding_t::info(buf);
buf.append("\n");
buf.append(translator::translate(get_besch()->get_name()));
buf.append("\n");
buf.append(welt->get_current_month() - geburt);
......
......@@ -163,3 +163,17 @@ void crossing_t::laden_abschliessen()
logic->recalc_state();
}
}
// returns NULL, if removal is allowed
// players can remove public owned ways
const char *crossing_t::ist_entfernbar(const spieler_t *sp)
{
if (get_player_nr()==1) {
return NULL;
}
else {
return ding_t::ist_entfernbar(sp);
}
}
......@@ -50,6 +50,12 @@ public:
// no info
void zeige_info() {}
/**
* @returns NULL wenn OK, ansonsten eine Fehlermeldung
* @author Hj. Malthaner
*/
virtual const char *ist_entfernbar(const spieler_t *sp);
// returns true, if the crossing can be passed by this vehicle
bool request_crossing( const vehikel_basis_t *v ) { return logic->request_crossing( v ); }
......
......@@ -55,6 +55,7 @@ void gebaeude_t::init()
sync = false;
count = 0;
zeige_baugrube = false;
snow = false;
}
......@@ -308,7 +309,7 @@ bool gebaeude_t::sync_step(long delta_t)
if(!zeige_baugrube) {
// old positions need redraw
if( tile->is_hintergrund_phases( get_pos().z>=welt->get_snowline() ) ) {
if( tile->is_hintergrund_phases( snow ) ) {
// the background is animated
set_flag(ding_t::dirty);
// we must take care of the tiles above
......@@ -322,10 +323,10 @@ bool gebaeude_t::sync_step(long delta_t)
}
else {
// try foreground
image_id bild = tile->get_vordergrund(count, get_pos().z>=welt->get_snowline());
image_id bild = tile->get_vordergrund(count, snow);
mark_image_dirty(bild,0);
// next phase must be marked dirty too ...
bild = tile->get_vordergrund( count+1>=tile->get_phasen()?0:count+1, get_pos().z>=welt->get_snowline());
bild = tile->get_vordergrund( count+1>=tile->get_phasen()?0:count+1, snow);
mark_image_dirty(bild,0);
}
......@@ -346,6 +347,10 @@ bool gebaeude_t::sync_step(long delta_t)
void
gebaeude_t::calc_bild()
{
grund_t *gr=welt->lookup(get_pos());
// snow image?
snow = (get_pos().z + (!gr->ist_bruecke() || gr->get_grund_hang()==hang_t::flach ? 0 : 1)>= welt->get_snowline())
&& (!gr->ist_tunnel() || gr->ist_karten_boden());
// need no ground?
if(!tile->get_besch()->ist_mit_boden() || !tile->has_image()) {
grund_t *gr=welt->lookup(get_pos());
......@@ -385,7 +390,7 @@ gebaeude_t::get_bild() const
return skinverwaltung_t::construction_site->get_bild_nr(0);
}
else {
return tile->get_hintergrund(count, 0, get_pos().z>=welt->get_snowline());
return tile->get_hintergrund(count, 0, snow);
}
}
......@@ -396,7 +401,7 @@ gebaeude_t::get_outline_bild() const
{
if(umgebung_t::hide_buildings!=0 && umgebung_t::hide_with_transparency && !zeige_baugrube) {
// opaque houses
return tile->get_hintergrund(count, 0, get_pos().z>=welt->get_snowline());
return tile->get_hintergrund(count, 0, snow);
}
return IMG_LEER;
}
......@@ -430,7 +435,7 @@ gebaeude_t::get_bild(int nr) const
}
else {
// winter for buildings only above snowline
return tile->get_hintergrund(count, nr, get_pos().z>=welt->get_snowline());
return tile->get_hintergrund(count, nr, snow);
}
}