OpenTTD

Tasklist

FS#4468 - Exception: E1212012 no more free items

Attached to Project: OpenTTD
Opened by PulsarPL (PulsarPL) - Saturday, 05 February 2011, 14:09 GMT
Last edited by Zdeněk Sojka (SmatZ) - Tuesday, 08 February 2011, 22:32 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity High
Priority Normal
Reported Version 1.1.0-beta5
Due in Version 1.1.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Bug in 1.1.0-beta4 & 1.1.0-beta5 under WIN 7 x64
Savegame is unfortunately too big to attach here
This task depends upon

Closed by  Zdeněk Sojka (SmatZ)
Tuesday, 08 February 2011, 22:32 GMT
Reason for closing:  Fixed
Additional comments about closing:  r22022
Comment by Michael Lutz (michi_cc) - Saturday, 05 February 2011, 14:35 GMT
You have managed to create more than 64000 orders. Raising that limit is probably not trivial.

Do you use http://wiki.openttd.org/Shared_orders#Shared_orders ?
Comment by PulsarPL (PulsarPL) - Saturday, 05 February 2011, 20:11 GMT
Thank you for your reply.
I don't use shared orders. I wasn't aware of that option.
Maybe it's time for a new map.
Comment by Zdeněk Sojka (SmatZ) - Saturday, 05 February 2011, 22:27 GMT
  • Field changed: Due in Version (Undecided → 1.1.0)
  • Field changed: Operating System (Windows → All)
Raising the limit isn't a solution. If this happens, there is a place where Order::CanAllocateItems() isn't called before 'new Order()'. That's a serious problem, as it can be used to easily DoS a server.
Comment by Zdeněk Sojka (SmatZ) - Saturday, 05 February 2011, 22:34 GMT
Index: src/vehicle.cpp
===================================================================
--- src/vehicle.cpp (revision 21962)
+++ src/vehicle.cpp (working copy)
@@ -1849,7 +1849,8 @@
Order *in_list = this->GetOrder(this->cur_auto_order_index);
if (in_list != NULL && this->orders.list->GetNumOrders() < MAX_VEH_ORDER_ID &&
(!in_list->IsType(OT_AUTOMATIC) ||
- in_list->GetDestination() != this->last_station_visited)) {
+ in_list->GetDestination() != this->last_station_visited) &&
+ Order::CanAllocateItem()) {
Order *auto_order = new Order();
auto_order->MakeAutomatic(this->last_station_visited);
InsertOrder(this, auto_order, this->cur_auto_order_index);

Something like this can be used to solve this problem, but maybe there are other places that need fixing.
Comment by Zdeněk Sojka (SmatZ) - Saturday, 05 February 2011, 23:14 GMT
http://devs.openttd.org/~smatz/verify_can_allocate.diff

This patch adds a verification that CanAllocateItem() is called before each operator new. There are many fixes needed just to load the intro game.

Loading...