From da8777d4e590f2c4414453d88c306c57f964326d Mon Sep 17 00:00:00 2001 From: truebrain Date: Wed, 21 Dec 2011 12:25:10 +0000 Subject: [PATCH] (svn r23646) -Fix [FS#4901]: rescan the Game Scripts when done downloading one. --- projects/openttd_vs100.vcxproj | 6 ++++-- src/company_cmd.cpp | 2 +- src/music/dmusic.cpp | 2 +- src/network/network_content_gui.cpp | 10 ++++++++++ src/script/api/script_list.cpp | 6 ++++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj index 40fb5a69d8..04e35c2287 100644 --- a/projects/openttd_vs100.vcxproj +++ b/projects/openttd_vs100.vcxproj @@ -1,4 +1,4 @@ - + @@ -144,6 +144,7 @@ MachineX86 true + true @@ -243,6 +244,7 @@ true MachineX64 true + true @@ -1221,4 +1223,4 @@ - + \ No newline at end of file diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index d4627078f2..db0200a34f 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -695,7 +695,7 @@ void OnTick_Companies() } if (_next_competitor_start == 0) { - _next_competitor_start = AI::GetStartNextTime() * DAY_TICKS; + _next_competitor_start = 1; //AI::GetStartNextTime() * DAY_TICKS; } if (AI::CanStartNew() && _game_mode != GM_MENU && --_next_competitor_start == 0) { diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index cb255e7c09..d44f210cbe 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -9,7 +9,7 @@ /** @file dmusic.cpp Playing music via DirectMusic. */ -#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT +#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT_2 #define INITGUID #include "../stdafx.h" diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 4eef3e502e..249cfdce14 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -16,6 +16,7 @@ #include "../window_func.h" #include "../error.h" #include "../ai/ai.hpp" +#include "../game/game.hpp" #include "../base_media_base.h" #include "../sortlist_type.h" #include "../querystring_gui.h" @@ -130,6 +131,10 @@ public: case CONTENT_TYPE_AI_LIBRARY: /* AI::Rescan calls the scanner. */ break; + case CONTENT_TYPE_GAME: + case CONTENT_TYPE_GAME_LIBRARY: + /* Game::Rescan calls the scanner. */ + break; case CONTENT_TYPE_BASE_GRAPHICS: case CONTENT_TYPE_BASE_SOUNDS: @@ -161,6 +166,11 @@ public: AI::Rescan(); break; + case CONTENT_TYPE_GAME: + case CONTENT_TYPE_GAME_LIBRARY: + Game::Rescan(); + break; + case CONTENT_TYPE_BASE_GRAPHICS: BaseGraphics::FindSets(); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS); diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp index 14d400bcbd..f6f2f45962 100644 --- a/src/script/api/script_list.cpp +++ b/src/script/api/script_list.cpp @@ -818,13 +818,15 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm) sq_push(vm, 2); for (ScriptListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) { + int key = (*iter).first; + /* Check for changing of items. */ int previous_modification_count = this->modifications; /* Push the root table as instance object, this is what squirrel does for meta-functions. */ sq_pushroottable(vm); /* Push all arguments for the valuator function. */ - sq_pushinteger(vm, (*iter).first); + sq_pushinteger(vm, key); for (int i = 0; i < nparam - 1; i++) { sq_push(vm, i + 3); } @@ -868,7 +870,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm) return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function")); } - this->SetValue((*iter).first, value); + this->SetValue(key, value); /* Pop the return value. */ sq_poptop(vm);