Commit 88355c6a authored by Jörg Frings-Fürst's avatar Jörg Frings-Fürst

Update upstream source from tag 'upstream/120.3'

Update to upstream version '120.3'
with Debian dir 1114248825481576330d67e4695ba33986741c87
parents ef9730d7 1aa598b0
.pc
debian/files
This is the simutrans source code.
(c) 1997-2004 Hj. Malthaner
(c) since 2005 The Simutrans Team
Simutrans source code is provided by the current simutrans team
(team64@simutrans.com) as copyright holder under the artistic license.
This includes the translations from:
http://translator.simutrans.com/
the documentation, images and .dat files included in the source distribution,
the midi files and the fonts with the exception of the m+10r.bdf, which
is taken from the M+ font project:
http://mplus-fonts.sourceforge.jp/
-----------------------------------------------------------------------------
The Artistic License
Preamble
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
Definitions:
* "Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
* "Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder.
* "Copyright Holder" is whoever is named in the copyright or
copyrights for the package.
* "You" is you, if you're thinking about copying or distributing
this Package.
* "Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
* "Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as ftp.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided, and provide
a separate manual page for each non-standard executable that clearly
documents how it differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where
to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) accompany any non-standard executables with their corresponding
Standard Version executables, giving the non-standard executables
non-standard names, and clearly documenting the differences in manual
pages (or equivalent), together with instructions on where to get
the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package.
You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whomever generated
them, and may be sold commercially, and may be aggregated with this
Package.
7. C or perl subroutines supplied by you and linked into this Package
shall not be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
---------------------------------------------------------------------------
This means, translated to ebay terms:
You may not charge for the program, if you charge shipping fees.
This diff is collapsed.
#!/bin/sh
# find the cpu type for SDL
sdl_cpu="`uname -p`"
if [ "${sdl_cpu}" == "i386" ]
then
# OSX 10.4 for intel uses ppc SDL
os_version="`/usr/sbin/system_profiler SPSoftwareDataType -detailLevel mini | egrep '(System Version): ' | cut -d: -f2-`"
os_version="${os_version#*10.}"
os_version="${os_version%.*}"
if [ "${os_version}" == "4" ]
then
sdl_cpu="ppc"
fi
fi
framework_path="${0%/*}"
if [ "${framework_path:0:1}" != "/" ]
then
framework_path="`pwd`"
fi
framework_path="${framework_path}/../Frameworks"
# remake the link every time. The bundle might have been moved to a new system.
ln -f -s "${framework_path}/SDL-${sdl_cpu}.framework" "${framework_path}/SDL.framework"
# execute the game
"${0}.`uname -p`"
# open the console if the game crashed
if [ "$?" != "0" ]
then
/usr/bin/osascript <<-EOF
tell application "Console" to activate
EOF
fi
# Makefile to build bundle applications for Mac OS X
# bundle makes a bundle designed to work on the system it was build on
# bundle_dist makes a bundle, which should work on all supported systems (custom config needed)
# Variables:
# CXXHOST CXX for host system. Only used when crosscompiling.
# BINARY_PPC path to the binary for PPC
# BINARY_i386 path to the binary for i386 (default $(PROGDIR)/$(PROG))
# SDL_PPC path to SDL.framwork for PPC
# SDL_i386 path to SDL.framwork for i386 (default ../Frameworks/SDL.framework)
# The name of the project is simutrans => thus we want to build the default bundle under simutrans
PROGNAME = $(PROG)
ifeq ($(PROGNAME),sim)
PROGNAME := "simutrans"
endif
CXXHOST ?= $(CXX)
BINARY_i386 ?= "$(PROGDIR)/$(PROG).app/Contents/MacOS/$(PROG)"
SDL_i386 ?= "../Frameworks/SDL.framework"
.PHONY: bundle bundle_dist
"OSX/getversion": OSX/getversion.cc simversion.h
@echo "===> Building $@"
$(Q)$(CXXHOST) "OSX/getversion.cc" -o $@
bundle: all "OSX/getversion"
@echo "===> Building bundle"
$(Q)rm -fr "$(PROGDIR)/$(PROG).app"
$(Q)mkdir -p "$(PROGDIR)/$(PROG).app/Contents/MacOS"
$(Q)mkdir -p "$(PROGDIR)/$(PROG).app/Contents/Resources"
$(Q)cp "$(PROGDIR)/$(PROG)" "$(PROGDIR)/$(PROG).app/Contents/MacOS/$(PROG)"
$(Q)cp "OSX/simutrans.icns" "$(PROGDIR)/$(PROG).app/Contents/Resources/$(PROG).icns"
$(Q)echo "APPL????" > "$(PROGDIR)/$(PROG).app/Contents/PkgInfo"
$(Q)OSX/plistgen.sh "$(PROGDIR)/$(PROG).app" "$(PROG)"
bundle_dist: bundle
@echo "===> Changing bundle to be distributable"
$(Q)mkdir -p "$(PROGDIR)/$(PROG).app/Contents/Frameworks"
$(Q)cp "$(BINARY_i386)" "$(PROGDIR)/$(PROG).app/Contents/MacOS/$(PROG).i386"
$(Q)cp "$(BINARY_PPC)" "$(PROGDIR)/$(PROG).app/Contents/MacOS/$(PROG).ppc"
$(Q)cp "OSX/binary_picker.sh" "$(PROGDIR)/$(PROG).app/Contents/MacOS/$(PROG)"
$(Q)cp -r "$(SDL_PPC)" "$(PROGDIR)/$(PROG).app/Contents/Frameworks/SDL-ppc.framework"
$(Q)cp -r "$(SDL_i386)" "$(PROGDIR)/$(PROG).app/Contents/Frameworks/SDL-i386.framework"
#!/bin/sh
date=`date +%Y`
PROG="$2"
COPYRIGHT="Copyright 1997-${date} by the simutrans team"
if [ -z "$3" ]; then
VERSION="`OSX/getversion`"
else
VERSION=$3
fi
echo "Executable $PROG"
echo "$VERSION"
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
\"http://www.apple.com/DTDs/Prop$
<plist version=\"1.0\">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PROG}</string>
<key>CFBundleExecutable</key>
<string>${PROG}</string>
<key>CFBundleGetInfoString</key>
<string>${VERSION}, ${COPYRIGHT}</string>
<key>CFBundleIconFile</key>
<string>${PROG}.icns</string>
<key>CFBundleIdentifier</key>
<string>org.${PROG}.${PROG}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PROG}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>NSHumanReadableCopyright</key>
<string>${COPYRIGHT}</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>" > "$1"/Contents/Info.plist
#!/bin/sh
"${0}.`uname -p`"
if [ "$?" != "0" ]
then
/usr/bin/osascript <<-EOF
tell application "Console" to activate
EOF
fi
......@@ -854,8 +854,10 @@ void bridge_builder_t::build_bridge(player_t *player, const koord3d start, const
grund_t *to = NULL;
if( ribi_t::is_single(ribi) && gr->get_neighbour(to, invalid_wt, ribi_t::backward(ribi))) {
// connect to open sea, calc_image will recompute ribi at to.
if (to->is_water()) {
if (desc->get_waytype() == water_wt && to->is_water()) {
gr->weg_erweitern(water_wt, ribi_t::backward(ribi));
to->calc_image();
continue;
}
// only single tile under bridge => try to connect to next tile
way_builder_t bauigel(player);
......
......@@ -234,7 +234,7 @@ bool factory_builder_t::successfully_loaded()
find_producer( producer, current->get_supplier(j)->get_input_type(), 0 );
if( producer.is_contained(current) ) {
// must not happen else
dbg->fatal( "factory_builder_t::build_link()", "Factory %s output %s cannot be its own input!", i.key, current->get_supplier(j)->get_input_type()->get_name() );
dbg->fatal( "factory_builder_t::successfully_loaded()", "Factory %s output %s cannot be its own input!", i.key, current->get_supplier(j)->get_input_type()->get_name() );
}
}
checksum_t *chk = new checksum_t();
......@@ -549,7 +549,7 @@ bool factory_builder_t::can_factory_tree_rotate( const factory_desc_t *desc )
* is the maximum number of good types for which suppliers chains are built
* (meaning there are no unfinished factory chains).
*/
int factory_builder_t::build_link(koord3d* parent, const factory_desc_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, player_t* player, int number_of_chains )
int factory_builder_t::build_link(koord3d* parent, const factory_desc_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, player_t* player, int number_of_chains, bool ignore_climates)
{
int n = 1;
int org_rotation = -1;
......@@ -582,6 +582,8 @@ int factory_builder_t::build_link(koord3d* parent, const factory_desc_t* info, s
// build consumer (factory) in town
stadt_t *city = welt->find_nearest_city(pos->get_2d());
climate_bits cl = ignore_climates ? ALL_CLIMATES : info->get_building()->get_allowed_climate_bits();
/* Three variants:
* A:
* A building site, preferably close to the town hall with a street next to it.
......@@ -591,12 +593,12 @@ int factory_builder_t::build_link(koord3d* parent, const factory_desc_t* info, s
*/
bool is_rotate=info->get_building()->get_all_layouts()>1 && size.x!=size.y && info->get_building()->can_rotate();
// first try with standard orientation
koord k = factory_place_with_road_finder(welt).find_place(city->get_pos(), size.x, size.y, info->get_building()->get_allowed_climate_bits());
koord k = factory_place_with_road_finder(welt).find_place(city->get_pos(), size.x, size.y, cl);
// second try: rotated
koord k1 = koord::invalid;
if (is_rotate && (k == koord::invalid || simrand(256)<128)) {
k1 = factory_place_with_road_finder(welt).find_place(city->get_pos(), size.y, size.x, info->get_building()->get_allowed_climate_bits());
k1 = factory_place_with_road_finder(welt).find_place(city->get_pos(), size.y, size.x, cl);
}
rotate = simrand( info->get_building()->get_all_layouts() );
......@@ -687,7 +689,7 @@ int factory_builder_t::build_chain_link(const fabrik_t* our_fab, const factory_d
const int producer_count=count_producers( ware, welt->get_timeline_year_month() );
if(producer_count==0) {
dbg->error("factory_builder_t::build_link()","No producer for %s found, chain incomplete!",ware->get_name() );
dbg->error("factory_builder_t::build_chain_link()","No producer for %s found, chain incomplete!",ware->get_name() );
return 0;
}
......@@ -701,7 +703,7 @@ int factory_builder_t::build_chain_link(const fabrik_t* our_fab, const factory_d
int lcount = supplier->get_supplier_count();
int lfound = 0; // number of found producers
DBG_MESSAGE("factory_builder_t::build_link","supplier_count %i, lcount %i (need %i of %s)",info->get_supplier_count(),lcount,consumption,ware->get_name());
DBG_MESSAGE("factory_builder_t::build_chain_link","supplier_count %i, lcount %i (need %i of %s)",info->get_supplier_count(),lcount,consumption,ware->get_name());
// Hajo: search if there already is one or two (cross-connect everything if possible)
FOR(slist_tpl<fabrik_t*>, const fab, welt->get_fab_list()) {
......@@ -742,7 +744,7 @@ DBG_MESSAGE("factory_builder_t::build_link","supplier_count %i, lcount %i (need
if(production_left>0) {
consumption -= production_left;
fab->add_lieferziel(our_fab->get_pos().get_2d());
DBG_MESSAGE("factory_builder_t::build_link","supplier %s can supply approx %i of %s to us", fd->get_name(), production_left, ware->get_name());
DBG_MESSAGE("factory_builder_t::build_chain_link","supplier %s can supply approx %i of %s to us", fd->get_name(), production_left, ware->get_name());
}
else {
/* we steal something; however the total capacity
......@@ -779,12 +781,12 @@ DBG_MESSAGE("factory_builder_t::build_link","supplier_count %i, lcount %i (need
if( producer.empty() ) {
// can happen with timeline
if(!info->is_consumer_only()) {
dbg->error( "factory_builder_t::build_link()", "no producer for %s!", ware->get_name() );
dbg->error( "factory_builder_t::build_chain_link()", "no producer for %s!", ware->get_name() );
return 0;
}
else {
// only consumer: Will do with partly covered chains
dbg->error( "factory_builder_t::build_link()", "no producer for %s!", ware->get_name() );
dbg->error( "factory_builder_t::build_chain_link()", "no producer for %s!", ware->get_name() );
}
}
......@@ -817,8 +819,8 @@ DBG_MESSAGE("factory_builder_t::build_link","supplier_count %i, lcount %i (need
INT_CHECK("fabrikbauer 697");
DBG_MESSAGE("factory_builder_t::build_link","Try to built supplier %s at (%i,%i) r=%i for %s.",producer_d->get_name(),k.x,k.y,rotate,info->get_name());
n += build_link(&parent_pos, producer_d, -1 /*random prodbase */, rotate, &k, player, 10000 );
DBG_MESSAGE("factory_builder_t::build_chain_link","Try to built supplier %s at (%i,%i) r=%i for %s.",producer_d->get_name(),k.x,k.y,rotate,info->get_name());
n += build_link(&parent_pos, producer_d, -1 /*random prodbase */, rotate, &k, player, 10000, ignore_climates);
lfound ++;
INT_CHECK( "fabrikbauer 702" );
......@@ -826,7 +828,7 @@ DBG_MESSAGE("factory_builder_t::build_link","Try to built supplier %s at (%i,%i)
// now subtract current supplier
fabrik_t *fab = fabrik_t::get_fab(k.get_2d() );
if(fab==NULL) {
DBG_MESSAGE( "factory_builder_t::build_link", "Failed to build at %s", k.get_str() );
DBG_MESSAGE( "factory_builder_t::build_chain_link", "Failed to build at %s", k.get_str() );
retry --;
continue;
}
......@@ -839,7 +841,7 @@ DBG_MESSAGE( "factory_builder_t::build_link", "Failed to build at %s", k.get_str
sint32 production = fab->get_base_production() * fd->get_product(gg)->get_factor();
// the take care of how much this factory could supply
consumption -= production;
DBG_MESSAGE("factory_builder_t::build_link", "new supplier %s can supply approx %i of %s to us", fd->get_name(), production, ware->get_name());
DBG_MESSAGE("factory_builder_t::build_chain_link", "new supplier %s can supply approx %i of %s to us", fd->get_name(), production, ware->get_name());
break;
}
}
......@@ -1002,7 +1004,7 @@ next_ware_check:
}
if(welt->lookup(pos)) {
// Space found...
nr += build_link(NULL, fab, -1 /* random prodbase */, rotation, &pos, welt->get_public_player(), 1 );
nr += build_link(NULL, fab, -1 /* random prodbase */, rotation, &pos, welt->get_public_player(), 1, ignore_climates);
if(nr>0) {
fabrik_t *our_fab = fabrik_t::get_fab( pos.get_2d() );
reliefkarte_t::get_karte()->calc_map_size();
......
......@@ -110,7 +110,7 @@ public:
* (meaning there are no unfinished factory chains).
* @returns number of factories built
*/
static int build_link(koord3d* parent, const factory_desc_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, player_t* player, int number_of_chains );
static int build_link(koord3d* parent, const factory_desc_t* info, sint32 initial_prod_base, int rotate, koord3d* pos, player_t* player, int number_of_chains, bool ignore_climates );
/**
* Helper function for baue_hierachie(): builds the connections (chain) for one single product)
......
......@@ -95,12 +95,12 @@ bool goods_manager_t::successfully_loaded()
}
}
}
// passenger and good colors
// passenger and mail colors
if(goods[0]->color==255) {
goods[0]->color = color_idx_to_rgb(COL_GREY3);
goods[0]->color = COL_GREY3;
}
if(goods[1]->color==255) {
goods[1]->color = color_idx_to_rgb(COL_YELLOW);
goods[1]->color = COL_YELLOW;
}
// none should never be loaded to something ...
// however, some place do need the dummy ...
......
......@@ -432,7 +432,7 @@ void hausbauer_t::remove( player_t *player, gebaeude_t *gb )
ground_recalc = false;
}
welt->access(newk)->kartenboden_setzen( new boden_t( koord3d( newk, new_hgt ), new_slope ) );
welt->calc_climate( newk, true );
// climate is stored in planquadrat, and hence automatically preserved
}
// there might be walls from foundations left => thus some tiles may need to be redrawn
if(ground_recalc) {
......
......@@ -370,6 +370,15 @@ const char *tunnel_builder_t::build( player_t *player, koord pos, const tunnel_d
return err;
}
if (!full_tunnel) {
// if there is no tunnel behind set end to start position
const grund_t *gr_end = welt->lookup(end);
if (gr_end == NULL || !gr_end->ist_tunnel()) {
end = gr->get_pos();
}
}
if(!welt->is_within_limits(end.get_2d())) {
return "Tunnel must start on single way!";
}
......
This diff is collapsed.
......@@ -85,6 +85,7 @@ private:
build_straight = 1, ///< next step has to be straight
terraform = 2, ///< terraform this tile
build_tunnel_bridge = 4, ///< bridge/tunnel ends here
is_upperlayer = 8, ///only used when elevated true:upperlayer
};
struct next_gr_t
......@@ -119,7 +120,7 @@ private:
const bridge_desc_t * bridge_desc;
/**
* Type of bridges to build (zero=>no bridges)
* Type of tunnels to build (zero=>no bridges)
* @author Hj. Malthaner
*/
const tunnel_desc_t * tunnel_desc;
......@@ -148,7 +149,7 @@ public:
* B) if allowed, calculate the cost for the step from from to to
* @author prissi
*/
bool is_allowed_step(const grund_t *from, const grund_t *to, sint32 *costs);
bool is_allowed_step(const grund_t *from, const grund_t *to, sint32 *costs, bool is_upperlayer = false ) const;
private:
// checks, if we can built a bridge here ...
......@@ -158,6 +159,8 @@ private:
sint32 intern_calc_route(const vector_tpl<koord3d> &start, const vector_tpl<koord3d> &ziel);
void intern_calc_straight_route(const koord3d start, const koord3d ziel);
sint32 intern_calc_route_elevated(const koord3d start, const koord3d ziel);
// runways need to meet some special conditions enforced here
bool intern_calc_route_runways(koord3d start, const koord3d ziel);
......@@ -225,7 +228,7 @@ public:
// allowed slope?
bool check_slope( const grund_t *from, const grund_t *to );
bool check_terraforming( const grund_t *from, const grund_t *to, uint8* new_from_slope=NULL, uint8* new_to_slope=NULL);
bool check_terraforming( const grund_t *from, const grund_t *to, uint8* new_from_slope=NULL, uint8* new_to_slope=NULL) const;
void do_terraforming();
void build();
......
......@@ -172,14 +172,6 @@ void grund_t::operator delete(void* p, size_t s)
}
grund_t::grund_t(loadsave_t *file)
{
flags = 0;
back_imageid = 0;
rdwr(file);
}
void grund_t::rdwr(loadsave_t *file)
{
koord k = pos.get_2d();
......@@ -635,20 +627,10 @@ void grund_t::info(cbuffer_t& buf) const
if(get_weg_ribi_unmasked(water_wt)) {
buf.printf("\nwater ribi: %i",get_weg_ribi_unmasked(water_wt));
}
buf.printf("\ndraw_as_obj= %i",(flags&draw_as_obj)!=0);
buf.append("\nclimates= ");
bool following = false;
climate cl = welt->get_climate( get_pos().get_2d() );
for( uint16 i=0; i < MAX_CLIMATES; i++ ) {
if( cl & (1<<i) ) {
if( following ) {
buf.append( ", " );
}
following = true;
buf.append( translator::translate( ground_desc_t::get_climate_name_from_bit((climate)i) ) );
}
if(is_water()) {
buf.printf("\ncanal ribi: %i", ((const wasser_t*)this)->get_canal_ribi());
}
buf.printf("\ndraw_as_obj= %i",(flags&draw_as_obj)!=0);
#endif
}
......@@ -880,6 +862,12 @@ void grund_t::calc_back_image(const sint8 hgt, const slope_t::type slope_this)
if( const grund_t *gr=welt->lookup_kartenboden(k + testdir[i] - koord(step,step)) ) {
sint16 h = gr->get_disp_height()*scale_z_step;
sint8 s = gr->get_disp_slope();
// tile should hide anything in tunnel portal behind (tile not in direction of tunnel)
if (step == 0 && ((i&1)==0) && s && gr->ist_tunnel()) {
if ( ribi_t::reverse_single(ribi_type(s)) != ribi_type(testdir[i])) {
s = slope_t::flat;
}
}
// take backimage into account, take base-height of back image as corner heights