Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv22805
Modified Files:
console.cpp console_win.cpp res.rc resource.h wolf.dsp
wolfpack.cpp wolfpack.h wpdefmanager.cpp
Log Message:
Misc. Updates to the GUI
Index: console.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** console.cpp 24 Sep 2003 21:19:48 -0000 1.7
--- console.cpp 8 Oct 2003 01:37:59 -0000 1.8
***************
*** 215,219 ****
break;
case 'R':
! reloadScripts();
break;
case '?':
--- 215,219 ----
break;
case 'R':
! queueReload( RELOAD_SCRIPTS );
break;
case '?':
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** console_win.cpp 8 Oct 2003 00:45:11 -0000 1.14
--- console_win.cpp 8 Oct 2003 01:37:59 -0000 1.15
***************
*** 57,60 ****
--- 57,61 ----
#define CONTROL_INPUT 0x11
+ HMENU hmMainMenu;
HBITMAP hLogo = 0;
HBRUSH hbSeparator = 0, hbBackground = 0;
***************
*** 124,127 ****
--- 125,165 ----
}
+ bool handleMenuSelect( unsigned int id )
+ {
+ bool result = true;
+
+ switch( id )
+ {
+ case IDC_EXIT:
+ keeprun = 0;
+
+ if( canClose )
+ DestroyWindow( mainWindow );
+
+ break;
+
+ case ID_RELOAD_ACCOUNTS:
+ Console::instance()->send( "RELOADING ACCOUNTS\n" );
+ break;
+
+ case ID_RELOAD_PYTHON:
+ Console::instance()->send( "RELOADING PYTHON\n" );
+ break;
+
+ case ID_RELOAD_SCRIPTS:
+ Console::instance()->send( "RELOADING SCRIPTS\n" );
+ break;
+
+ case ID_RELOAD_CONFIGURATION:
+ Console::instance()->send( "RELOADING CONFIGURATION\n" );
+ break;
+
+ default:
+ result = false;
+ }
+
+ return result;
+ }
+
LRESULT CALLBACK wpWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
***************
*** 135,138 ****
--- 173,181 ----
switch( msg )
{
+ case WM_COMMAND:
+ if( handleMenuSelect( wparam ) )
+ return 0;
+ break;
+
case WM_CREATE:
hLogo = LoadBitmap( appInstance, MAKEINTRESOURCE( IDB_LOGO ) );
***************
*** 262,265 ****
--- 305,309 ----
case WM_DESTROY:
+ DestroyMenu( hmMainMenu );
DeleteObject( hLogo );
DeleteObject( hbSeparator );
***************
*** 268,275 ****
PostQuitMessage( 0 );
return 0;
-
- default:
- return DefWindowProc( hwnd, msg, wparam, lparam );
}
}
--- 312,318 ----
PostQuitMessage( 0 );
return 0;
}
+
+ return DefWindowProc( hwnd, msg, wparam, lparam );
}
***************
*** 383,387 ****
// Create the Window itself
! mainWindow = CreateWindow( WOLFPACK_CLASS, "Wolfpack", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, 0, hInstance, NULL );
if( mainWindow == 0 )
--- 426,432 ----
// Create the Window itself
! hmMainMenu = LoadMenu( appInstance, MAKEINTRESOURCE( IDR_MAINMENU ) );
!
! mainWindow = CreateWindow( WOLFPACK_CLASS, "Wolfpack", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, hmMainMenu, hInstance, NULL );
if( mainWindow == 0 )
Index: res.rc
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/res.rc,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** res.rc 7 Oct 2003 23:57:24 -0000 1.17
--- res.rc 8 Oct 2003 01:37:59 -0000 1.18
***************
*** 1,4 ****
--- 1,5 ----
//Microsoft Developer Studio generated resource script.
//
+ #include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
***************
*** 7,11 ****
// Generated from the TEXTINCLUDE 2 resource.
//
! #include "resource.h"
/////////////////////////////////////////////////////////////////////////////
--- 8,12 ----
// Generated from the TEXTINCLUDE 2 resource.
//
!
/////////////////////////////////////////////////////////////////////////////
***************
*** 14,17 ****
--- 15,56 ----
/////////////////////////////////////////////////////////////////////////////
//
+ // Icon
+ //
+
+ // Icon with lowest ID value placed first to ensure application icon
+ // remains consistent on all systems.
+ IDI_ICON1 ICON DISCARDABLE "icon2.ico"
+
+ /////////////////////////////////////////////////////////////////////////////
+ //
+ // Bitmap
+ //
+
+ IDB_LOGO BITMAP DISCARDABLE "logo.bmp"
+
+ /////////////////////////////////////////////////////////////////////////////
+ //
+ // Menu
+ //
+
+ IDR_MAINMENU MENU DISCARDABLE
+ BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "E&xit", IDC_EXIT
+ END
+ POPUP "&Reload"
+ BEGIN
+ MENUITEM "&Accounts", ID_RELOAD_ACCOUNTS
+ MENUITEM "&Configuration", ID_RELOAD_CONFIGURATION
+ MENUITEM "&Python", ID_RELOAD_PYTHON
+ MENUITEM "&Scripts", ID_RELOAD_SCRIPTS
+ END
+ END
+
+
+ #ifndef _MAC
+ /////////////////////////////////////////////////////////////////////////////
+ //
// Version
//
***************
*** 54,67 ****
END
! /////////////////////////////////////////////////////////////////////////////
! //
! // Icon
! //
!
! // Icon with lowest ID value placed first to ensure application icon
! // remains consistent on all systems.
! IDI_ICON1 ICON DISCARDABLE "icon2.ico"
- IDB_LOGO BITMAP DISCARDABLE "logo.bmp"
#ifdef APSTUDIO_INVOKED
--- 93,98 ----
END
! #endif // !_MAC
#ifdef APSTUDIO_INVOKED
***************
*** 73,82 ****
1 TEXTINCLUDE DISCARDABLE
BEGIN
! "resrc1.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
! "#include ""resource.h""\r\n"
"\0"
END
--- 104,113 ----
1 TEXTINCLUDE DISCARDABLE
BEGIN
! "resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
! "\r\n"
"\0"
END
***************
*** 89,96 ****
#endif // APSTUDIO_INVOKED
-
- ////////////////////////////////////////////////////////////////////////////
-
-
#ifndef APSTUDIO_INVOKED
--- 120,123 ----
Index: resource.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/resource.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** resource.h 7 Oct 2003 23:57:24 -0000 1.9
--- resource.h 8 Oct 2003 01:37:59 -0000 1.10
***************
*** 4,8 ****
//
#define IDI_ICON1 101
! #define IDB_LOGO 102
// Next default values for new objects
--- 4,14 ----
//
#define IDI_ICON1 101
! #define IDB_LOGO 102
! #define IDR_MAINMENU 102
! #define IDC_EXIT 40001
! #define ID_RELOAD_ACCOUNTS 40002
! #define ID_RELOAD_CONFIGURATION 40003
! #define ID_RELOAD_PYTHON 40004
! #define ID_RELOAD_SCRIPTS 40005
// Next default values for new objects
***************
*** 11,15 ****
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
! #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
--- 17,21 ----
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
! #define _APS_NEXT_COMMAND_VALUE 40006
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
Index: wolf.dsp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v
retrieving revision 1.241
retrieving revision 1.242
diff -C2 -d -r1.241 -r1.242
*** wolf.dsp 7 Oct 2003 23:58:04 -0000 1.241
--- wolf.dsp 8 Oct 2003 01:37:59 -0000 1.242
***************
*** 673,680 ****
# Begin Source File
- SOURCE=.\resource.h
- # End Source File
- # Begin Source File
-
SOURCE=.\resources.h
--- 673,676 ----
***************
*** 948,951 ****
--- 944,951 ----
SOURCE=.\icon2.ico
+ # End Source File
+ # Begin Source File
+
+ SOURCE=.\logo.bmp
# End Source File
# Begin Source File
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.473
retrieving revision 1.474
diff -C2 -d -r1.473 -r1.474
*** wolfpack.cpp 1 Oct 2003 00:35:31 -0000 1.473
--- wolfpack.cpp 8 Oct 2003 01:37:59 -0000 1.474
***************
*** 59,62 ****
--- 59,63 ----
#include "Timing.h"
#include "verinfo.h"
+ #include "wolfpack.h"
#include "world.h"
#include "wpdefmanager.h"
***************
*** 134,167 ****
#endif
- void reloadScripts()
- {
- Console::instance()->send( "Reloading scripts...\n" );
-
- SrvParams->reload(); // Reload wolfpack.xml
-
- QStringList oldAISections = DefManager->getSections( WPDT_AI );
- DefManager->reload(); //Reload Definitions
- AIFactory::instance()->checkScriptAI( oldAISections, DefManager->getSections( WPDT_AI ) );
-
- Accounts::instance()->reload();
- SpawnRegions::instance()->reload();
- AllTerritories::instance()->reload();
- Resources::instance()->reload();
- MakeMenus::instance()->reload();
- ScriptManager::instance()->reload(); // Reload Scripts
- ContextMenus::instance()->reload();
- Skills->reload();
-
- // Update the Regions
- cCharIterator iter;
- for( P_CHAR pChar = iter.first(); pChar; pChar = iter.next() )
- {
- cTerritory *region = AllTerritories::instance()->region( pChar->pos().x, pChar->pos().y, pChar->pos().map );
- pChar->setRegion( region );
- }
-
- cNetwork::instance()->reload(); // This will be integrated into the normal definition system soon
- }
-
static bool parseParameter( const QString ¶m )
{
--- 135,138 ----
***************
*** 278,281 ****
--- 249,261 ----
}
+ QMutex reloadMutex;
+ QValueVector< eReloadType > reloadQueue;
+
+ void queueReload( eReloadType type )
+ {
+ QMutexLocker lock( &reloadMutex );
+ reloadQueue.push_back( type );
+ }
+
//#if defined(_DEBUG)
//#include <crash.h>
***************
*** 543,546 ****
--- 523,559 ----
// Update our currenttime
uiCurrentTime = getNormalizedTime();
+
+ // It is save to process any pending reloads now
+ reloadMutex.lock();
+
+ while( reloadQueue.count() > 0 )
+ {
+ eReloadType type = reloadQueue[0];
+ reloadQueue.erase( reloadQueue.begin() );
+
+ switch( type )
+ {
+ case RELOAD_ACCOUNTS:
+ Console::instance()->PrepareProgress( "Reloading Accounts" );
+ Accounts::instance()->reload();
+ Console::instance()->ProgressDone();
+ break;
+
+ case RELOAD_CONFIGURATION:
+ Console::instance()->PrepareProgress( "Reloading Configuration" );
+ SrvParams->reload();
+ Console::instance()->ProgressDone();
+ break;
+
+ case RELOAD_SCRIPTS:
+ DefManager->reload();
+
+ case RELOAD_PYTHON:
+ ScriptManager::instance()->reload();
+ break;
+ }
+ }
+
+ reloadMutex.unlock();
Console::instance()->poll();
Index: wolfpack.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** wolfpack.h 11 Sep 2003 16:19:50 -0000 1.36
--- wolfpack.h 8 Oct 2003 01:37:59 -0000 1.37
***************
*** 33,37 ****
#define __WOLFPACK_H__
! void reloadScripts();
#endif
--- 33,45 ----
#define __WOLFPACK_H__
! enum eReloadType
! {
! RELOAD_SCRIPTS = 0,
! RELOAD_PYTHON,
! RELOAD_ACCOUNTS,
! RELOAD_CONFIGURATION
! };
!
! void queueReload( eReloadType );
#endif
Index: wpdefmanager.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wpdefmanager.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** wpdefmanager.cpp 20 Sep 2003 12:01:44 -0000 1.67
--- wpdefmanager.cpp 8 Oct 2003 01:37:59 -0000 1.68
***************
*** 39,42 ****
--- 39,55 ----
#include <qvaluevector.h>
+ // Reloading
+ #include "ai.h"
+ #include "spawnregions.h"
+ #include "territories.h"
+ #include "resources.h"
+ #include "makemenus.h"
+ #include "contextmenu.h"
+ #include "skills.h"
+ #include "world.h"
+ #include "skills.h"
+ #include "basechar.h"
+ #include "network.h"
+
#include "wpdefmanager.h"
#include "globals.h"
***************
*** 274,280 ****
--- 287,315 ----
void WPDefManager::reload( void )
{
+ QStringList oldAISections = DefManager->getSections( WPDT_AI );
+
unload();
load();
+
+ // Update all SubSystems associated with this Definition Manager
KeyManager::instance()->load();
+ AIFactory::instance()->checkScriptAI( oldAISections, DefManager->getSections( WPDT_AI ) );
+
+ SpawnRegions::instance()->reload();
+ AllTerritories::instance()->reload();
+ Resources::instance()->reload();
+ MakeMenus::instance()->reload();
+ ContextMenus::instance()->reload();
+ Skills->reload();
+
+ // Update the Regions
+ cCharIterator iter;
+ for( P_CHAR pChar = iter.first(); pChar; pChar = iter.next() )
+ {
+ cTerritory *region = AllTerritories::instance()->region( pChar->pos().x, pChar->pos().y, pChar->pos().map );
+ pChar->setRegion( region );
+ }
+
+ cNetwork::instance()->reload(); // This will be integrated into the normal definition system soon
}
|