(svn r16508) [0.7] -Backport from trunk:

- Fix: Base graphics names must be unique, so do not add duplicates (r16503)
- Fix: [NoAI] When an AI was suspended while in a function called (indirectly) via call/acall/pcall OpenTTD crashed. Fix this by disallowing AIs to be suspended while called via call/acall/pcall [FS#2935] (r16502)
This commit is contained in:
rubidium 2009-06-03 13:33:58 +00:00
parent 9456d20800
commit 65c5e26913
10 changed files with 81 additions and 9 deletions

View File

@ -1,3 +1,25 @@
0.7.1-RC3 (2009-06-03)
------------------------------------------------------------------------
- Add: [NoAI] AISignList that can be used to get a list of valid signs (r16400)
- Change: [NoAI] Stop an AI when it takes too long to initialize or load [FS#2869] (r16425)
- Fix: Base graphics names must be unique, so do not add duplicates (r16503)
- Fix: [NoAI] When an AI was suspended while in a function called (indirectly) via call/acall/pcall OpenTTD crashed. Fix this by disallowing AIs to be suspended while called via call/acall/pcall [FS#2935] (r16502)
- Fix: [NewGRF] Invalidate NewGRF variable caches of more vehicles in more places. Esp. they were only invalidated for trains (r16480)
- Fix: [NewGRF] Call callbacks after initialisation of vehicle variables (r16479)
- Fix: [NewGRF] Determining most common (sub-)cargo-type was broken due to someone confusing similiary named variables (r16478)
- Fix: Loading indicator when 'unload' in and 'no loading' is off was pointing in the wrong direction [FS#2936] (r16477)
- Fix: Track reservation was drawn at bridge heads in the menu (r16470)
- Fix: [NoAI] Another try/catch related bug (r16454)
- Fix: Road vehicles ending up on the pavement when they are in a drive through station that got removed due to bankruptcy [FS#2909] (r16448)
- Fix: [NoAI] AIRail::GetRailStationDirection returned incorrect information (r16440)
- Fix: Crash when a company is deleted while a dropdown with company names is open (r16430)
- Fix: Do not allow content download via the console when there is no zlib as it is done for the GUI already [FS#2919] (r16420)
- Fix: Some 64bit architectures require size_t to be aligned at 8-byte boundary, ensure it for MemBlock (r16415)
- Fix: [NewGRF] Disable multitile houses with non-zero population on additional tiles as they cause desyncs and because the specs do not allow that either (r16383)
- Fix: [NewGRF] Valid UTF-8 sequences between 0x20 and 0xFF should be allowed as is instead of being treated as control codes (r16374)
- Fix: [NewGRF] Use a valid StringID as fall-back when undefined generic NewGRF strings of vehicles are requested (r16366)
0.7.1-RC2 (2009-05-21)
------------------------------------------------------------------------
- Fix: The previously selected NewGRF station type was still remembered after switching to a different game without newstations enabled, preventing stations from being built (r16363)

View File

@ -1,3 +1,9 @@
openttd (0.7.1~RC3) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 03 Jun 2008 15:34:56 +0200
openttd (0.7.1~RC2) unstable; urgency=low
* New upstream release.

View File

@ -1,7 +1,7 @@
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.7.1-RC2" ; Define application version
!define APPVERSION "0.7.1-RC3" ; Define application version
!define APPVERSIONINTERNAL "0.7.1.0" ; Define application version in X.X.X.X
!define INSTALLERVERSION 60 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define INSTALLERVERSION 61 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org"

View File

@ -275,6 +275,7 @@ typedef struct tagSQRegFunction{
}SQRegFunction;
/*vm*/
SQUIRREL_API bool sq_can_suspend(HSQUIRRELVM v);
SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize);
SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize);
SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);

View File

@ -90,6 +90,11 @@ SQInteger sq_getvmstate(HSQUIRRELVM v)
}
}
bool sq_can_suspend(HSQUIRRELVM v)
{
return v->_can_suspend;
}
void sq_seterrorhandler(HSQUIRRELVM v)
{
SQObject o = stack_get(v, -1);

View File

@ -30,6 +30,7 @@ private:
class AIInstance {
public:
friend class AIObject;
AIInstance(class AIInfo *info);
~AIInstance();

View File

@ -2,6 +2,11 @@
/** @file ai_object.cpp Implementation of AIObject. */
#include "../../stdafx.h"
#include <squirrel.h>
#include "../../script/squirrel.hpp"
#include "../../company_base.h"
#include "ai_log.hpp"
#include "table/strings.h"
#include "../ai.hpp"
@ -157,7 +162,8 @@ void AIObject::SetAllowDoCommand(bool allow)
bool AIObject::GetAllowDoCommand()
{
return GetStorage()->allow_do_command;
Squirrel *squirrel = GetCompany(_current_company)->ai_instance->engine;
return GetStorage()->allow_do_command && squirrel->CanSuspend();
}
void *&AIObject::GetEventPointer()

View File

@ -445,7 +445,7 @@ public:
bool OBGFileScanner::AddFile(const char *filename, size_t basepath_length)
{
bool ret = false;
DEBUG(grf, 1, "Found %s as base graphics set", filename);
DEBUG(grf, 1, "Checking %s for base graphics set", filename);
GraphicsSet *graphics = new GraphicsSet();;
IniFile *ini = new IniFile();
@ -460,12 +460,30 @@ bool OBGFileScanner::AddFile(const char *filename, size_t basepath_length)
}
if (FillGraphicsSetDetails(graphics, ini, path)) {
bool duplicate = false;
for (const GraphicsSet *c = _available_graphics_sets; !duplicate && c != NULL; c = c->next) {
duplicate = (strcmp(c->name, graphics->name) == 0 || c->shortname == graphics->shortname) && c->version == graphics->version;
GraphicsSet *duplicate = NULL;
for (GraphicsSet *c = _available_graphics_sets; c != NULL; c = c->next) {
if (strcmp(c->name, graphics->name) == 0 || c->shortname == graphics->shortname) {
duplicate = c;
break;
}
}
if (duplicate) {
delete graphics;
if (duplicate != NULL) {
if (duplicate->version >= graphics->version) {
DEBUG(grf, 1, "Not adding %s (%i) as base graphics set (duplicate)", graphics->name, graphics->version);
delete graphics;
} else {
GraphicsSet **prev = &_available_graphics_sets;
while (*prev != duplicate) prev = &(*prev)->next;
*prev = graphics;
graphics->next = duplicate->next;
/* don't allow recursive delete of all remaining items */
duplicate->next = NULL;
DEBUG(grf, 1, "Removing %s (%i) as base graphics set (duplicate)", duplicate->name, duplicate->version);
delete duplicate;
ret = true;
}
} else {
GraphicsSet **last = &_available_graphics_sets;
while (*last != NULL) last = &(*last)->next;
@ -473,6 +491,9 @@ bool OBGFileScanner::AddFile(const char *filename, size_t basepath_length)
*last = graphics;
ret = true;
}
if (ret) {
DEBUG(grf, 1, "Adding %s (%i) as base graphics set", graphics->name, graphics->version);
}
} else {
delete graphics;
}

View File

@ -508,3 +508,8 @@ void Squirrel::ResetCrashed()
{
this->crashed = false;
}
bool Squirrel::CanSuspend()
{
return sq_can_suspend(this->vm);
}

View File

@ -213,6 +213,11 @@ public:
* Reset the crashed status.
*/
void ResetCrashed();
/**
* Are we allowed to suspend the squirrel script at this moment?
*/
bool CanSuspend();
};
#endif /* SQUIRREL_HPP */