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

New upstream version 120.4.1

parent 1aa598b0
......@@ -72,7 +72,11 @@ endif
ifeq ($(OSTYPE),mingw)
SOURCES += clipboard_w32.cc
else
SOURCES += clipboard_internal.cc
ifeq ($(BACKEND),SDL2)
SOURCES += clipboard_s.cc
else
SOURCES += clipboard_internal.cc
endif
endif
LIBS += -lbz2 -lz
......@@ -260,6 +264,7 @@ SOURCES += dataobj/loadsave.cc
SOURCES += dataobj/marker.cc
SOURCES += dataobj/powernet.cc
SOURCES += dataobj/records.cc
SOURCES += dataobj/rect.cc
SOURCES += dataobj/ribi.cc
SOURCES += dataobj/route.cc
SOURCES += dataobj/scenario.cc
......@@ -577,7 +582,7 @@ ifeq ($(BACKEND),sdl2)
LIBS += -framework Foundation -framework QTKit
endif
else
SOURCES += sound/sdl_sound.cc
SOURCES += sound/sdl2_sound.cc
ifneq ($(OSTYPE),mingw)
SOURCES += music/no_midi.cc
else
......
#!/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
#!/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
#!/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
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
#!/bin/sh
"${0}.`uname -p`"
if [ "$?" != "0" ]
then
/usr/bin/osascript <<-EOF
tell application "Console" to activate
EOF
fi
......@@ -47,9 +47,8 @@ static stringhashtable_tpl<const bridge_desc_t *> desc_table;
void bridge_builder_t::register_desc(bridge_desc_t *desc)
{
// avoid duplicates with same name
if( const bridge_desc_t *old_desc = desc_table.get(desc->get_name()) ) {
dbg->warning( "bridge_builder_t::register_desc()", "Object %s was overlaid by addon!", desc->get_name() );
desc_table.remove(desc->get_name());
if( const bridge_desc_t *old_desc = desc_table.remove(desc->get_name()) ) {
dbg->doubled( "bridge", desc->get_name() );
tool_t::general_tool.remove( old_desc->get_builder() );
delete old_desc->get_builder();
delete old_desc;
......
This diff is collapsed.
......@@ -11,10 +11,8 @@
#include "../tpl/stringhashtable_tpl.h"
#include "../tpl/weighted_vector_tpl.h"
#include "../dataobj/koord3d.h"
#include "../descriptor/factory_desc.h"
class building_desc_t;
class goods_desc_t;
class factory_desc_t;
class stadt_t;
class karte_ptr_t;
class player_t;
......@@ -134,14 +132,14 @@ private:
* @param water true to search on water
* @param cl allowed climates
*/
static bool check_construction_site(koord pos, koord size, bool water, bool is_factory, climate_bits cl);
static bool check_construction_site(koord pos, koord size, factory_desc_t::site_t site, bool is_factory, climate_bits cl);
/**
* Find a random site to place a factory.
* @param radius Radius of the search circle around @p pos
* @param size size of the building site
*/
static koord3d find_random_construction_site(koord pos, int radius, koord size,bool on_water, const building_desc_t *desc, bool ignore_climates, uint32 max_iterations);
static koord3d find_random_construction_site(koord pos, int radius, koord size, factory_desc_t::site_t site, const building_desc_t *desc, bool ignore_climates, uint32 max_iterations);
/**
* Checks if all factories in this factory tree can be rotated.
......
......@@ -123,11 +123,9 @@ bool goods_manager_t::register_desc(goods_desc_t *desc)
desc->value = desc->base_value;
::register_desc(special_objects, desc);
// avoid duplicates with same name
goods_desc_t *old_desc = const_cast<goods_desc_t *>(desc_table.get(desc->get_name()));
if( old_desc ) {
dbg->warning( "goods_manager_t::register_desc()", "Object %s was overlaid by addon!", desc->get_name() );
desc_table.remove(desc->get_name());
goods.remove( old_desc );
if( const goods_desc_t *old_desc = desc_table.remove(desc->get_name()) ) {
dbg->doubled( "good", desc->get_name() );
goods.remove( const_cast<goods_desc_t*>(old_desc) );
}
desc_table.put(desc->get_name(), desc);
......
......@@ -183,7 +183,7 @@ bool hausbauer_t::successfully_loaded()
elevated_foundation_desc = desc;
break;
}
/* no break */
/* FALLTHROUGH */
default:
// obsolete object, usually such pak set will not load properly anyway (old objects should be caught before!)
......@@ -205,12 +205,12 @@ bool hausbauer_t::register_desc(building_desc_t *desc)
const building_desc_t *old_desc = desc_table.get(desc->get_name());
if(old_desc) {
// do not overlay existing factories if the new one is not a factory
dbg->doubled( "building", desc->get_name() );
if (old_desc->is_factory() && !desc->is_factory()) {
dbg->warning( "hausbauer_t::register_desc()", "Object %s could not be registered since it would overlay an existing factory building!", desc->get_name() );
dbg->error( "hausbauer_t::register_desc()", "Object %s could not be registered since it would overlay an existing factory building!", desc->get_name() );
delete desc;
return false;
}
dbg->warning( "hausbauer_t::register_desc()", "Object %s was overlaid by addon!", desc->get_name() );
desc_table.remove(desc->get_name());
tool_t::general_tool.remove( old_desc->get_builder() );
delete old_desc->get_builder();
......
......@@ -46,11 +46,10 @@ void tunnel_builder_t::register_desc(tunnel_desc_t *desc)
{
// avoid duplicates with same name
if( const tunnel_desc_t *old_desc = tunnel_by_name.get(desc->get_name()) ) {
dbg->warning( "tunnel_builder_t::register_desc()", "Object %s was overlaid by addon!", desc->get_name() );
tunnel_by_name.remove(desc->get_name());
dbg->doubled( "tunnel", desc->get_name() );
tool_t::general_tool.remove( old_desc->get_builder() );
delete old_desc->get_builder();
delete old_desc;
// delete old_desc; becasue deleting PowerTunnel seems to corrupt memprz, and the small memory loss in not reallz worth the troubles
}
// add the tool
tool_build_tunnel_t *tool = new tool_build_tunnel_t();
......@@ -446,20 +445,25 @@ DBG_MESSAGE("tunnel_builder_t::build()","build from (%d,%d,%d) to (%d,%d,%d) ",
way_desc = way_builder_t::weg_search( wegtyp, desc->get_topspeed(), 0, type_flat );
}
build_tunnel_portal(player, pos, zv, desc, way_desc, cost);
build_tunnel_portal(player, pos, zv, desc, way_desc, cost, start != end);
ribi = ribi_type(-zv);
// don't move on to next tile if only one tile long
if( end != start ) {
pos = pos + zv;
}
// calc new back image for the ground
// move on
pos = pos + zv;
// calc back image to remove wall blocking tunnel portal for active underground view
if(grund_t::underground_mode) {
grund_t *gr = welt->lookup_kartenboden(pos.get_2d());
gr->calc_image();
gr->set_flag(grund_t::dirty);
}
if( end == start ) {
// already finished
return true;
}
// Now we build the invisible part
while(pos.get_2d()!=end.get_2d()) {
tunnelboden_t *tunnel = new tunnelboden_t( pos, 0);
......@@ -495,7 +499,7 @@ DBG_MESSAGE("tunnel_builder_t::build()","build from (%d,%d,%d) to (%d,%d,%d) ",
}
else if (gr_end->ist_karten_boden()) {
// if end is above ground construct an exit
build_tunnel_portal(player, pos, -zv, desc, way_desc, cost);
build_tunnel_portal(player, pos, -zv, desc, way_desc, cost, true);
gr_end = NULL; // invalid - replaced by tunnel ground
// calc new back image for the ground
if (end!=start && grund_t::underground_mode) {
......@@ -540,12 +544,15 @@ DBG_MESSAGE("tunnel_builder_t::build()","build from (%d,%d,%d) to (%d,%d,%d) ",
}
void tunnel_builder_t::build_tunnel_portal(player_t *player, koord3d end, koord zv, const tunnel_desc_t *desc, const way_desc_t *way_desc, int &cost)
void tunnel_builder_t::build_tunnel_portal(player_t *player, koord3d end, koord zv, const tunnel_desc_t *desc, const way_desc_t *way_desc, int &cost, bool connect_inside)
{
grund_t *alter_boden = welt->lookup(end);
ribi_t::ribi ribi = 0;
if(desc->get_waytype()!=powerline_wt) {
ribi = alter_boden->get_weg_ribi_unmasked(desc->get_waytype()) | ribi_type(zv);
ribi = alter_boden->get_weg_ribi_unmasked(desc->get_waytype());
}
if (connect_inside) {
ribi |= ribi_type(zv);
}
tunnelboden_t *tunnel = new tunnelboden_t( end, alter_boden->get_grund_hang());
......
......@@ -31,7 +31,7 @@ private:
static karte_ptr_t welt;
static bool build_tunnel(player_t *player, koord3d pos, koord3d end, koord zv, const tunnel_desc_t *desc);
static void build_tunnel_portal(player_t *player, koord3d end, koord zv, const tunnel_desc_t *desc, const way_desc_t *way_desc, int &cost);
static void build_tunnel_portal(player_t *player, koord3d end, koord zv, const tunnel_desc_t *desc, const way_desc_t *way_desc, int &cost, bool connect_inside);
tunnel_builder_t() {} // private -> no instance please
......
This diff is collapsed.
......@@ -11,6 +11,7 @@
#include "../dataobj/koord3d.h"
#include "../simtypes.h"
#include "../gui/depot_frame.h"
#include <string>
class vehicle_t;
......@@ -40,7 +41,7 @@ public:
static vehicle_t* build(koord3d k, player_t* player, convoi_t* cnv, const vehicle_desc_t* vb );
static const vehicle_desc_t * get_info(const char *name);
static slist_tpl<vehicle_desc_t const*> const& get_info(waytype_t);
static slist_tpl<vehicle_desc_t const*> const& get_info(waytype_t, uint8 sortkey = depot_frame_t::sb_name);
/* extended search for vehicles for KI
* @author prissi
......
......@@ -121,11 +121,8 @@ bool way_builder_t::successfully_loaded()
bool way_builder_t::register_desc(way_desc_t *desc)
{
DBG_DEBUG("way_builder_t::register_desc()", desc->get_name());
const way_desc_t *old_desc = desc_table.get(desc->get_name());
if( old_desc ) {
desc_table.remove(desc->get_name());
dbg->warning( "way_builder_t::register_desc()", "Object %s was overlaid by addon!", desc->get_name() );
if( const way_desc_t *old_desc = desc_table.remove(desc->get_name()) ) {
dbg->doubled( "way", desc->get_name() );
tool_t::general_tool.remove( old_desc->get_builder() );
delete old_desc->get_builder();
delete old_desc;
......@@ -1098,6 +1095,7 @@ void way_builder_t::check_for_bridge(const grund_t* parent_from, const grund_t*
}
}
}
/* FALLTHROUGH */
default:
if (way0->get_waytype()!=desc->get_wtyp() || way1!=NULL) {
......
This diff is collapsed.
......@@ -111,6 +111,54 @@ public:
has_way2 = 128
};
/**
* @brief Back wall corner count.
*
* Number of corners used to produce tile back walls. Visually these corners
* are the left, top and right corners of a tile.
*/
static size_t const BACK_CORNER_COUNT = 3;
/**
* @brief Back wall count.
*
* Number of back walls a tile can have. Visually these walls are along the
* top left and right edges of the tile.
*/
static size_t const BACK_WALL_COUNT = BACK_CORNER_COUNT - 1;
/**
* @brief Number of wall images per wall.
*
* Number of unique wall image graphics per wall.
*/
static uint16 const WALL_IMAGE_COUNT = 11;
/**
* @brief Number of fence images.
*
* Number of unique fence image graphics available. Unlike walls, fence
* images are for an entire tile.
*/
static uint16 const FENCE_IMAGE_COUNT = 3;
/**
* @brief Back image ID offset for encoding fences.
*
* The offset used to encode the fence image into a back image ID. Anything
* less than this offset can be considered a wall.
*/
static sint8 const BIID_ENCODE_FENCE_OFFSET = (sint8)(WALL_IMAGE_COUNT * WALL_IMAGE_COUNT);
/**
* @brief Maximum distance in tiles that hide test will be performed for.
*
* Maximum distance in tiles that object hide test will be performed for.
* The hide test is needed for correct graphic reproduction of tunnel
* entrances and such.
*/
static uint16 const MAXIMUM_HIDE_TEST_DISTANCE = 5;
// just to calculate the offset for skipping the ways ...
static uint8 offsets[4];
......
#!/bin/bash
#
# first assume unix ...
simexe=
updatepath="/"
updater="get_pak.sh"
simarchiv=simumac
getNightlies()
{
# Use curl if available, else use wget
curl -h > /dev/null
if [ $? -eq 0 ]; then
curl http://simutrans-germany.com/stn/Download.php?d=9 > sim-macintel.zip || {
echo "Error: download of file sim-macintel.zip failed (curl returned $?)" >&2
rm -f "sim-macintel.zip"
exit 4
}
curl http://simutrans-germany.com/stn/Download.php?d=11 > sim-macpowerpc.zip || {
echo "Error: download of file sim-macpowerpc.zip failed (curl returned $?)" >&2
rm -f "sim-macpowerpc.zip"
exit 4
}
else
wget --help > /dev/null
if [ $? -eq 0 ]; then
wget -N http://simutrans-germany.com/stn/Download.php?d=9 || {
echo "Error: download of file sim-macintel.zip failed (wget returned $?)" >&2
rm -f "sim-macintel.zip"
exit 4
}
wget -N http://simutrans-germany.com/stn/Download.php?d=11 || {
echo "Error: download of file sim-macpowerpc.zip failed (wget returned $?)" >&2
rm -f "sim-macpowerpc.zip"
exit 4
}
else
echo "Error: Neither curl or wget are available on your system, please install either and try again!" >&2
exit 6
fi
fi
unzip -tv "sim-macintel.zip" || {
echo "Error: file sim-macintel.zip seems to be defective" >&2
rm -f "sim-macintel.zip"
exit 5
}
unzip -tv "sim-macpowerpc.zip" || {
echo "Error: file sim-macpowerpc.zip seems to be defective" >&2
rm -f "sim-macpowerpc.zip"
exit 5
}
}
getSDL()
{
# Use curl if available, else use wget
curl -h > /dev/null
if [ $? -eq 0 ]; then
curl http://www.libsdl.org/release/SDL-1.2.15.dmg > SDL-1.2.15.dmg || {
echo "Error: download of file SDL-1.2.15.dmg failed (curl returned $?)" >&2
rm -f "SDL-1.2.15.dmg"
exit 4
}
curl http://www.libsdl.org/release/SDL-1.2.15-OSX10.4.dmg > SDL-1.2.15-OSX10.4.dmg || {
echo "Error: download of file SDL-1.2.15-OSX10.4.dmg failed (curl returned $?)" >&2
rm -f "SDL-1.2.15-OSX10.4.dmg"
exit 4
}
else
wget --help > /dev/null
if [ $? -eq 0 ]; then
wget -N http://www.libsdl.org/release/SDL-1.2.15.dmg || {
echo "Error: download of file SDL-1.2.15.dmg failed (wget returned $?)" >&2
rm -f "SDL-1.2.15.dmg"
exit 4
}
wget -N http://www.libsdl.org/release/SDL-1.2.15-OSX10.4.dmg || {
echo "Error: download of file SDL-1.2.15-OSX10.4.dmg failed (wget returned $?)" >&2
rm -f "SDL-1.2.15-OSX10.4.dmg"
exit 4
}
else
echo "Error: Neither curl or wget are available on your system, please install either and try again!" >&2
exit 6
fi
fi
7z t "SDL-1.2.15-OSX10.4.dmg" || {
echo "Error: file SDL-1.2.15-OSX10.4.dmg seems to be defective" >&2
rm -f "sim-macintel.zip"
exit 5
}
7z t "SDL-1.2.15.dmg" || {
echo "Error: file SDL-1.2.15.dmg seems to be defective" >&2
rm -f "SDL-1.2.15.dmg"
exit 5
}
}
# (otherwise there will be many .svn included under windows)
distribute()
{
# pack all files of the current release
FILELISTE=`find simutrans -type f "(" -name "*.tab" -o -name "*.mid" -o -name "*.bdf" -o -name "*.fnt" -o -name "*.txt" -o -name "*.dll" -o -name "*.pak" -o -name "*.nut" ")"`
zip -9 $simarchiv.zip $FILELISTE simutrans/$updater
FILELISTE=`find simutrans/simutrans.app`
zip -9r $simarchiv.zip $FILELISTE
}
# fetch language files
sh ./get_lang_files.sh
# now download the nightlies
cd simutrans
cp ..updatepath$updater .
getNightlies
unzip "sim-macpowerpc.zip"
unzip "sim-macintel.zip"
rm "sim-macpowerpc.zip"
rm "sim-macintel.zip"
# Now get the SDL frameworks
getSDL
7z x "SDL-1.2.15-OSX10.4.dmg"
7z x 2.hfs
rm -f 0.ddm 1.Apple_partition_map 2. hfs 3.free
# save the version number
simversion=`grep -a "Version " sim-macintel | awk 'BEGIN { RS = "\000" } {print $0 "\n"}' | grep "Version " `
# builds a bundle for MAC OS
mkdir -p "simutrans.app/Contents/MacOS"
mkdir -p "simutrans.app/Contents/Resources"
mv sim-macpowerpc "simutrans.app/Contents/MacOS/simutrans.ppc"
mv sim-macintel "simutrans.app/Contents/MacOS/simutrans.i386"
cp "../OSX/simutrans.icns" "simutrans.app/Contents/Resources/simutrans.icns"
cp "../OSX/simutrans.sh" "simutrans.app/Contents/MacOS/simutrans.sh"
echo "APPL????" > "simutrans.app/Contents/PkgInfo"
sh ../OSX/plistgen.sh "simutrans.app" "simutrans.sh" "$simversion"
echo "#!/bin/sh\n"${0}.`uname -p`"\nif [ "$?" != "0" ] ; then\n /usr/bin/osascript <<-EOF\n tell application "Console" to activate\n EOF\fi" > "simutrans.app/Contents/MacOS/simutrans.sh"
cd ..
distribute
# .. finally delete executable and language files
rm -rf simutrans/simutrans.app
#!/bin/bash
#
# first assume unix ...
simexe=
updatepath="/"
updater="get_pak.sh"
simarchiv=simumac
getNightlies()
{
# Use curl if available, else use wget
curl -h > /dev/null