News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Recent posts

#52
Simutrans Gaming Discussion / Re: Where are the trams? pak64
Last post by Andarix - January 23, 2026, 07:18:02 AM
Quote from: Isaac Eiland-Hall on January 23, 2026, 03:28:11 AM... I think there's been a lot of discussion over the years on ways to make it more obvious, but nobody's come up with something that seems worth it. ....

Adding it to the tutorial would be an option today.
#53
Simutrans Gaming Discussion / Re: Where are the trams? pak64
Last post by Isaac Eiland-Hall - January 23, 2026, 03:28:11 AM
THe electrified-rail thing has to be one of the most difficult parts of the steep learning curve for Simutrans. I think there's been a lot of discussion over the years on ways to make it more obvious, but nobody's come up with something that seems worth it. So....... a hearty welcome to Simutrans, ten years late ;-)
#54
Simutrans Gaming Discussion / Where are the trams? pak64
Last post by jrs - January 22, 2026, 04:42:51 AM
The only tram available is the horse drawn one. For A long time I just thought that no one had made any trams for the 1930s era in pak64. so never used trams or used short trains in the same role. But I was just looking through the "list of all vehicles" and see a bunch of them.

Am I missing something obvious? I can't build them in a tram depot or any depot(I looked) Where are all the trams hiding?

Update: I found it. you have to put a depot on an electrified rail. this opens up electric trains. I have been playing simutrans for 10 years now and never knew this, So many new possibilities. I feel bad now, it's line one of the help text.
#55
Extension Requests / Change colours for destination...
Last post by cousjath - January 20, 2026, 09:30:41 PM
In destinations mapmode, the colours are very similar and hard to tell apart, especially between overcrowded (ORANGE) and no route (DARK_ORANGE). The definitions are on lines 88-92 of src/simutrans/world/simcity.h
#56
Simutrans Tutorial / Tutorial - Object selection is...
Last post by Andarix - January 20, 2026, 06:48:32 PM
I've added the infrastructure selection function (bridge, tunnel, way, catenary) from the script AI and extended it for the postal service (station, extension).

This allows object selection to be automated instead of having to define it manually for each package set.

Vehicles, however, should still be defined manually.

object search function
#57
Patches & Projects / Re: tpl freelist mutex locking...
Last post by jrs - January 20, 2026, 04:53:12 PM
Salutes, And I just wanted to say thank you for providing a super positive experience for a first time poster with a one line diff.
#58
Patches & Projects / Re: tpl freelist mutex locking...
Last post by prissi - January 20, 2026, 05:50:49 AM
Well spotted, that should be indeed a lock unstead of unlock.

And the squirrel headers are patched, as we had to download squirrel verbatim. I am anyway trying to update simutrans to squirrel 3.2.

#59
Patches & Projects / tpl freelist mutex locking inc...
Last post by jrs - January 20, 2026, 05:00:54 AM
I am working on a port of simutrans to openbsd and found their pthreads implementation was not happy with tpl/freelist_tpl.h, aborting due to an unlock with an unknown owner. While poking at the code trying to understand this I found the lock/unlock dance in tpl/freelist_tpl.h strange. Unlock was called twice. changing the first one to a lock allowed the game to run.

Index: simutrans/src/simutrans/tpl/freelist_tpl.h
--- simutrans/src/simutrans/tpl/freelist_tpl.h.orig
+++ simutrans/src/simutrans/tpl/freelist_tpl.h
@@ -170,7 +170,7 @@ class freelist_size_t (public)
#endif

#ifdef MULTI_THREAD
- pthread_mutex_unlock(&freelist_mutex);
+ pthread_mutex_lock(&freelist_mutex);
#endif

// putback to first node

One other small thing, this might just be an openbsd/clang peculiarity. but wanted to mention it just in case.
squirrel/squirrel/sqvm.h can not find a declaration for "va_list" I found it in stdarg.h

Index: simutrans/src/squirrel/squirrel/sqvm.h
--- simutrans/src/squirrel/squirrel/sqvm.h.orig
+++ simutrans/src/squirrel/squirrel/sqvm.h
@@ -2,6 +2,7 @@
 #ifndef _SQVM_H_
 #define _SQVM_H_
 
+#include <stdarg.h>
 #include "sqopcodes.h"
 #include "sqobject.h"
 #define MAX_NATIVE_CALLS 100



#60
Extension Requests / Re: edit credit per MW of powe...
Last post by poppo - January 20, 2026, 04:22:18 AM
diff --git a/src/simutrans/dataobj/settings.cc b/src/simutrans/dataobj/settings.cc
index bcc0a3294..67e110fe2 100644
--- a/src/simutrans/dataobj/settings.cc
+++ b/src/simutrans/dataobj/settings.cc
@@ -746,6 +746,13 @@ void settings_t::rdwr(loadsave_t *file)
  file->rdwr_long(way_count_avoid_crossings);
  file->rdwr_long(way_count_maximum);
  }
+
+ if (file->is_version_atleast(124,4)) {
+ file->rdwr_long(credit_per_MWs);
+ }
+ else {
+ credit_per_MWs = 2;
+ }
  }
 
  // sometimes broken savegames could have no legal direction for take off ...
@@ -1307,6 +1314,8 @@ void settings_t::parse_simuconf( tabfile_t& simuconf, sint16& disp_width, sint16
 
  crossconnect_factories         = contents.get_int("crossconnect_factories", crossconnect_factories ) != 0;
 
+ credit_per_MWs = contents.get_int_clamped( "credit_per_MWs", credit_per_MWs, 1, 512);
+
  env_t::just_in_time = contents.get_int_clamped("just_in_time", env_t::just_in_time, 0, 2);
  just_in_time = env_t::just_in_time;
 
diff --git a/src/simutrans/dataobj/settings.h b/src/simutrans/dataobj/settings.h
index a15b485f4..d3a12fa57 100644
--- a/src/simutrans/dataobj/settings.h
+++ b/src/simutrans/dataobj/settings.h
@@ -63,6 +63,8 @@ private:
  sint32 factory_count       =  12;
  sint32 electric_promille   = 330;
 
+ uint32 credit_per_MWs;
+
  sint32 city_count         =   16;
  sint32 mean_citizen_count = 1600;
 
@@ -418,6 +420,8 @@ public:
 
  sint32 get_electric_promille() const {return electric_promille;}
 
+ sint32 get_credit_per_MWs() const {return credit_per_MWs;}
+
  void set_tourist_attractions( sint32 n ) { tourist_attractions = n; }
  sint32 get_tourist_attractions() const {return tourist_attractions;}
 
diff --git a/src/simutrans/gui/settings_stats.cc b/src/simutrans/gui/settings_stats.cc
index 40b1425d0..bb113b843 100644
--- a/src/simutrans/gui/settings_stats.cc
+++ b/src/simutrans/gui/settings_stats.cc
@@ -306,6 +306,7 @@ void settings_economy_stats_t::init(settings_t const* const sets)
  INIT_NUM( "electric_promille", sets->get_electric_promille(), 0, 1000, gui_numberinput_t::AUTOLINEAR, false );
  INIT_BOOL( "allow_underground_transformers", sets->get_allow_underground_transformers() );
  INIT_NUM( "way_height_clearance", sets->get_way_height_clearance(), 1, 2, gui_numberinput_t::AUTOLINEAR, true );
+ INIT_NUM( "credit_per_MWs", sets->get_credit_per_MWs(), 1, 512, gui_numberinput_t::AUTOLINEAR, false);
  SEPERATOR
 
  INIT_NUM( "passenger_factor",  sets->get_passenger_factor(), 0, 16, gui_numberinput_t::AUTOLINEAR, false );
@@ -398,6 +399,7 @@ void settings_economy_stats_t::read(settings_t* const sets)
  READ_NUM_VALUE( sets->electric_promille );
  READ_BOOL_VALUE( sets->allow_underground_transformers );
  READ_NUM_VALUE( sets->way_height_clearance );
+ READ_NUM_VALUE( sets->credit_per_MWs );
 
  READ_NUM_VALUE( sets->passenger_factor );
  READ_NUM_VALUE( sets->minimum_city_distance );
diff --git a/src/simutrans/obj/leitung2.cc b/src/simutrans/obj/leitung2.cc
index c84e9b36c..b2d528667 100644
--- a/src/simutrans/obj/leitung2.cc
+++ b/src/simutrans/obj/leitung2.cc
@@ -668,7 +668,7 @@ senke_t::~senke_t()
 void senke_t::pay_revenue()
 {
  // megajoules (megawatt seconds) per cent
- const uint64 mjpc = (1 << POWER_TO_MW) / CREDIT_PER_MWS; // should be tied to game setting
+ const uint64 mjpc = (1 << POWER_TO_MW) / world()->get_settings().get_credit_per_MWs(); // should be tied to game setting
 
  // calculate payment in cent
  const sint64 payment = (sint64)(energy_acc / mjpc);
diff --git a/src/simutrans/obj/leitung2.h b/src/simutrans/obj/leitung2.h
index e1a17e75c..a4c4e1a5d 100644
--- a/src/simutrans/obj/leitung2.h
+++ b/src/simutrans/obj/leitung2.h
@@ -16,8 +16,6 @@
 // bitshift for converting internal power values to MW for display
 extern const uint32 POWER_TO_MW;
 
-#define CREDIT_PER_MWS 2
-
 class powernet_t;
 class player_t;
 class fabrik_t;
I made a patch.
But I want to discuss about how much the upper limit of credit per MW.
In addition, in calculating energy_acc, we should consider about "MW per credit" cannot be as an integer (a remainder occurs in division).