[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog ./BUGS src/NetPanzer/Clas...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog ./BUGS src/NetPanzer/Clas... |
Date: |
Tue, 11 Nov 2003 08:42:08 -0500 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/11/11 08:42:08
Modified files:
. : ChangeLog BUGS
src/NetPanzer/Classes: UnitOpcodes.hpp
src/NetPanzer/Classes/Units: Vehicle.cpp
src/NetPanzer/Core: main.cpp
src/NetPanzer/Interfaces: DedicatedGameManager.cpp
GameConfig.cpp GameConfig.hpp
src/NetPanzer/Views/Game: MiniMapView.cpp
src/NetPanzer/Views/MainMenu/Multi: GetSessionView.cpp
HostJoinTemplateView.cpp
IPAddressView.cpp
IRCLobby.cpp IRCLobby.hpp
IRCLobbyView.cpp
IRCLobbyView.hpp
PlayerNameView.cpp
PlayerNameView.hpp
src/Lib/View : cInputField.cpp cInputField.hpp
Log message:
-fixed irclobby view to not crash on refresh button, when connection is
broken
-report exceptions in the irclobby view
-fixed serveraddress view to not contain the ok and abort buttons
-make irc lobby change nickname when the player changes it's name
Patches:
Index: netpanzer/BUGS
diff -u netpanzer/BUGS:1.8 netpanzer/BUGS:1.9
--- netpanzer/BUGS:1.8 Fri Nov 7 04:56:50 2003
+++ netpanzer/BUGS Tue Nov 11 08:42:04 2003
@@ -34,7 +34,10 @@
- HOM effect outside the progressview window -fixed
- Astar priority_queue "open" are not clear anytime
- in LinkListDoubleTemplate.addFront sometime is (front==0 && rear != 0)
-- the lobby views disappears when you switch to options menu and back
+ - Matze: I checked LinkListDoubleTemplate alot, the class seems to be
+ correct. Most probably the memory corruption happens elsewhere
+- the lobby views disappears when you switch to options menu and back - party
+ fixed, after a connection error the lobby view still isn't visible anymore
- when the bot occupied an outpost and you occupy it back, then the build menu
shows the panzer you built last, but the one choosen by the bot comes out the
outpost
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.26 netpanzer/ChangeLog:1.27
--- netpanzer/ChangeLog:1.26 Fri Nov 7 11:29:56 2003
+++ netpanzer/ChangeLog Tue Nov 11 08:42:04 2003
@@ -1,3 +1,9 @@
+11-Nov-2003 by Matthias Braun
+-fixed irclobby view to not crash on refresh button, when connection is broken
+-report exceptions in the irclobby view
+-fixed serveraddress view to not contain the ok and abort buttons
+-make irc lobby change nickname when the player changes it's name
+
07-Nov-2003 by Matthias Braun
-fixed HOM effect while joining server
-added new poland flag by Bartosz Fenski
Index: netpanzer/src/Lib/View/cInputField.cpp
diff -u netpanzer/src/Lib/View/cInputField.cpp:1.13
netpanzer/src/Lib/View/cInputField.cpp:1.14
--- netpanzer/src/Lib/View/cInputField.cpp:1.13 Thu Nov 6 14:58:29 2003
+++ netpanzer/src/Lib/View/cInputField.cpp Tue Nov 11 08:42:07 2003
@@ -216,7 +216,8 @@
case SDLK_KP_ENTER:
case SDLK_RETURN: {
- returnaction(this);
+ if(returnaction != 0)
+ returnaction(this);
}
default: break;
Index: netpanzer/src/Lib/View/cInputField.hpp
diff -u netpanzer/src/Lib/View/cInputField.hpp:1.8
netpanzer/src/Lib/View/cInputField.hpp:1.9
--- netpanzer/src/Lib/View/cInputField.hpp:1.8 Thu Nov 6 14:58:29 2003
+++ netpanzer/src/Lib/View/cInputField.hpp Tue Nov 11 08:42:08 2003
@@ -122,8 +122,6 @@
ACTION_FUNC_PTR returnaction;
void reset();
-
-}
-; // end cInputField
+}; // end cInputField
#endif // end __cInputField_hpp__
Index: netpanzer/src/NetPanzer/Classes/UnitOpcodes.hpp
diff -u netpanzer/src/NetPanzer/Classes/UnitOpcodes.hpp:1.5
netpanzer/src/NetPanzer/Classes/UnitOpcodes.hpp:1.6
--- netpanzer/src/NetPanzer/Classes/UnitOpcodes.hpp:1.5 Fri Nov 7 20:28:45 2003
+++ netpanzer/src/NetPanzer/Classes/UnitOpcodes.hpp Tue Nov 11 08:42:04 2003
@@ -64,8 +64,12 @@
{
flags = 0;
opcode = _UNIT_OPCODE_MOVE;
- }
+ square = 0;
+ loc_x_offset = 0;
+ loc_y_offset = 0;
+ pad[0] = 0;
+ }
}
__attribute__((packed));
@@ -83,6 +87,10 @@
{
flags = 0;
opcode = _UNIT_OPCODE_TURRET_TRACK_POINT;
+
+ x = y = 0;
+ activate = false;
+ pad[0] = pad[1] = 0;
}
}
@@ -103,6 +111,11 @@
{
flags = 0;
opcode = _UNIT_OPCODE_TURRET_TRACK_TARGET;
+
+ target_player_index = 0;
+ target_unit_index = 0;
+ activate = false;
+ pad[0] = pad[1] = pad[2] = 0;
}
}
@@ -121,6 +134,9 @@
{
flags = 0;
opcode = _UNIT_OPCODE_FIRE_WEAPON;
+
+ x = y = 0;
+ pad[0] = pad[1] = pad[2] = 0;
}
}
__attribute__((packed));
@@ -136,6 +152,9 @@
{
flags = 0;
opcode = _UNIT_OPCODE_SYNC_UNIT;
+
+ for(int i=0;i<7;i++)
+ pad[i] = 0;
}
}
@@ -154,7 +173,6 @@
flags = 0;
opcode = _UNIT_OPCODE_UPDATE_STATE;
}
-
}
__attribute__((packed));
Index: netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp
diff -u netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp:1.13
netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp:1.14
--- netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp:1.13 Fri Nov 7
20:28:45 2003
+++ netpanzer/src/NetPanzer/Classes/Units/Vehicle.cpp Tue Nov 11 08:42:04 2003
@@ -47,12 +47,8 @@
fsm_timer.changeRate( 10 );
unit_state_timer.changeRate( 10 );
setAiFsmDefendHold();
- reload_counter = 0;
- critical_ai_section = false;
- ai_fsm_transition_complete = false;
pending_AI_comm = false;
unit_state.lifecycle_state = _UNIT_LIFECYCLE_ACTIVE;
- external_ai_event = _external_event_null;
memset( fsm_active_list, 0, sizeof( bool ) * 7 );
in_sync_flag = true;
@@ -60,6 +56,31 @@
body_anim_shadow.setDrawModeBlend(&Palette::colorTableDarkenALot);
turret_anim_shadow.setDrawModeBlend(&Palette::colorTableDarkenALot);
+ path_generated = false;
+ critical_ai_section = false;
+ ai_fsm_transition_complete = false;
+
+ reload_counter = 0;
+ death_counter = 0;
+
+ ai_command_state = 0;
+ external_ai_event = _external_event_null;
+
+ fsmBodyRotate_rotation = 0;
+ fsmBodyRotate_goal_angle = 0;
+ fsmTurretRotate_rotation = 0;
+ fsmTurretRotate_goal_angle = 0;
+
+ interpolation_speed = 0;
+ fsmMove_first_stamp = false;
+ fsmMove_offset_x = fsmMove_offset_y = 0;
+ fsmMove_moves_counter = 0;
+ fsmMove_moves_per_square = 0;
+
+ move_opcode_sent = false;
+ fsmMoveMapSquare_movement_type = 0;
+
+ aiFsmDefendHold_state = 0;
}
void Vehicle::updateUnitStateProperties( void )
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.20
netpanzer/src/NetPanzer/Core/main.cpp:1.21
--- netpanzer/src/NetPanzer/Core/main.cpp:1.20 Tue Nov 11 06:56:41 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp Tue Nov 11 08:42:04 2003
@@ -192,9 +192,8 @@
LOGGER.setLogLevel(Logger::LEVEL_DEBUG);
LOGGER.debug("debug option enabled");
}
- if (lobby_server_option.value()) {
- IRCLobbyView::lobby_server=lobby_server_option.value();
- }
+ if (lobby_server_option.value())
+ gameconfig->lobbyserver = lobby_server_option.value();
// Initialize SDL
SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER);
Index: netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.4
netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.5
--- netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.4 Mon Nov
3 08:26:34 2003
+++ netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp Tue Nov 11
08:42:05 2003
@@ -152,7 +152,9 @@
gameconfig->hostorjoin=_game_session_host;
Particle2D::setCreateParticles(false);
- IRCLobbyView::startIRC();
+ if(!lobby_view)
+ lobby_view = new IRCLobbyView;
+ lobby_view->startIRC();
ConsoleInterface::postMessage( "Game Launched, Server Ready...");
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.15
netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.16
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp:1.15 Sun Nov 9
08:43:29 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.cpp Tue Nov 11 08:42:05 2003
@@ -28,6 +28,7 @@
// VariableName("Name", value [, minimum, maximum])
: hostorjoin("hostorjoin", _game_session_join, 0, _game_session_last-1),
playername("name", "Player"),
+ lobbyserver("lobbyserver", "irc.freenode.net:6667"),
gametype("gametype", _gametype_objective, 0, _gametype_last-1),
maxplayers("maxplayers", 8, 1, 25),
@@ -81,6 +82,7 @@
//gamesettings.push_back(&hostorjoin);
playersettings.push_back(&playername);
+ playersettings.push_back(&lobbyserver);
serversettings.push_back(&gametype);
serversettings.push_back(&maxplayers);
Index: netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.13
netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.14
--- netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp:1.13 Sun Nov 9
08:43:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameConfig.hpp Tue Nov 11 08:42:05 2003
@@ -112,6 +112,7 @@
// player settings
ConfigString playername;
+ ConfigString lobbyserver;
// server settings
ConfigInt gametype; //Objectives, FragLimit, TimeLimit
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.20
netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.21
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.20 Mon Nov 10
08:50:34 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp Tue Nov 11 08:42:05 2003
@@ -26,7 +26,6 @@
#include "ScreenSurface.hpp"
#include "WorldInputCmdProcessor.hpp"
-
MiniMapView miniMapView;
MAP_DRAW_TYPES MiniMapView::mapDrawType;
@@ -34,7 +33,6 @@
float MiniMapView::scaleDelta = 400.0f;
int MiniMapView::decreaseSize = 0;
int MiniMapView::increaseSize = 0;
-
// MiniMapView
//---------------------------------------------------------------------------
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp:1.17
netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp:1.18
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp:1.17
Fri Nov 7 23:28:31 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/GetSessionView.cpp Tue Nov
11 08:42:06 2003
@@ -141,9 +141,9 @@
Desktop::setVisibility("IPAddressView", true);
- if(!IRCLobbyView::lobby_server.empty()) {
+ if((const std::string&) gameconfig->lobbyserver != "") {
Desktop::setVisibility("IRCLobbyView", true);
- IRCLobbyView::startIRC();
+ lobby_view->startIRC();
}
//Desktop::setVisibility("JoinView", true);
//Desktop::setVisibility("GetSessionHostView", true);
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
diff -u
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.20
netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.21
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp:1.20
Mon Nov 3 08:26:36 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/HostJoinTemplateView.cpp
Tue Nov 11 08:42:06 2003
@@ -30,6 +30,7 @@
#include "FlagSelectionView.hpp"
#include "Palette.hpp"
#include "GameViewGlobals.hpp"
+#include "IPAddressView.hpp"
#include "IRCLobbyView.hpp"
#include "Client.hpp"
@@ -63,21 +64,8 @@
void bReady()
{
- char temp_str[64];
-
- if (strlen(PlayerNameView::playerName.getString()) <= 0) {
+ if ((const std::string&) gameconfig->playername == "")
return;
- }
-
- strcpy( temp_str, PlayerNameView::playerName.getString() );
-
- // make string lowercase
- for(char* p = temp_str; *p != 0; p++) {
- *p = tolower(*p);
- }
- if (strstr( temp_str, "server" ) != 0 ) {
- return;
- }
// Check a few things which should be ok.
if (strlen(HostJoinTemplateView::gameTypeBuf) == 0) {
@@ -86,9 +74,8 @@
if (MapSelectionView::curMap == -1) {
return;
}
-
- // Set the player name.
- gameconfig->playername = PlayerNameView::playerName.getString();
+ if (strcmp(IPAddressView::szServer.getString(), "") == 0)
+ return;
// Set the player flag.
gameconfig->playerflag = playerFlagSelected;
@@ -119,103 +106,10 @@
MenuTemplateView::backgroundSurface.free();
//MenuTemplateView::titleSurface.free();
- IRCLobbyView::stopIRC();
+ lobby_view->stopIRC();
//TODO: I don't like static methods
PlayerGameManager::launchMultiPlayerGame();
}
-/*
-enum { _unit_type_valentine,
- _unit_type_leopard,
- _unit_type_abrams,
- _unit_type_hammerhead,
- _unit_type_humvee,
-*/
-
-#if 0
-// Increase unit count.
-static void bIncreaseHumvee()
-{
- gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_humvee);
-}
-
-static void bIncreaseLightTank()
-{
-
gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_valentine);
-}
-
-static void bIncreaseMediumTank()
-{
- gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_leopard);
-}
-
-static void bIncreaseHeavyTank()
-{
- gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_abrams);
-}
-
-static void bIncreaseMissleLauncher()
-{
-
gameconfig->unit_spawn_config.incrementSpawnUnitCount(_unit_type_hammerhead);
-}
-
-// Decrease unit count.
-static void bDecreaseHumvee()
-{
- gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_humvee);
-}
-
-static void bDecreaseLightTank()
-{
-
gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_valentine);
-}
-
-static void bDecreaseMediumTank()
-{
- gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_leopard);
-}
-
-static void bDecreaseHeavyTank()
-{
- gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_abrams);
-}
-
-static void bDecreaseMissleLauncher()
-{
-
gameconfig->unit_spawn_config.decrementSpawnUnitCount(_unit_type_hammerhead);
-}
-
-// Get unit count.
-static int getHumveeCount()
-{
- return gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_humvee);
-}
-
-static int getLightTankCount()
-{
- return
gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_valentine);
-}
-
-static int getMediumTankCount()
-{
- return gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_leopard);
-}
-
-static int getHeavyTankCount()
-{
- return gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_abrams);
-}
-
-static int getMissleLauncherCount()
-{
- return
gameconfig->unit_spawn_config.getSpawnUnitCount(_unit_type_hammerhead);
-}
-
-static int getSelectionsRemaining()
-{
- return gameconfig->unit_spawn_config.getMaxAllowedUnits() -
gameconfig->unit_spawn_config.unitTotal();
-}
-#endif
-
// HostJoinTemplateView
//---------------------------------------------------------------------------
@@ -234,209 +128,15 @@
addSpecialButton( readyPos,
"Ready",
bReady);
-
- //addVehicleButtons(iXY(220, 195));
- /*
- Surface s(20, 15, 20, 1);
- x = 84;
- cDarkBlue = pal.findNearestColor(RGB_COLOR(0, 0, 100));
- cLightBlue = pal.findNearestColor(RGB_COLOR(173, 216, 230));
- cLightGreen = pal.findNearestColor(RGB_COLOR(0, 160, 0));
- cOrange = pal.findNearestColor(RGB_COLOR(255, 128, 0));
-
- y += 20;
- // Dark Blue
- s.fill(cDarkBlue);
- s.drawButtonBorder(Color::white, Color::gray64);
- addButtonSurface(iXY(x, y), s, "Dark Blue", bSetColorDarkBlue);
- x += xOffset;
-
- // Light Blue
- s.fill(cLightBlue);
- s.drawButtonBorder(Color::white, Color::gray64);
- addButtonSurface(iXY(x, y), s, "Light Blue", bSetColorLightBlue);
- x += xOffset;
-
- // Light Green
- s.fill(cLightGreen);
- s.drawButtonBorder(Color::white, Color::gray64);
- addButtonSurface(iXY(x, y), s, "Light Green", bSetColorLightGreen);
- x += xOffset;
-
- // Red
- s.fill(Color::red);
- s.drawButtonBorder(Color::white, Color::gray64);
- addButtonSurface(iXY(x, y), s, "Red", bSetColorRed);
- x += xOffset;
-
- // Orange
- s.fill(cOrange);
- s.drawButtonBorder(Color::white, Color::gray64);
- addButtonSurface(iXY(x, y), s, "Orange", bSetColorOrange);
- x += xOffset;
-
- // Surface for the player's current color.
- playerColor.create(20, 15, 20, 1);
- playerColor.fill(cDarkBlue);
- */
- //for (int i = 0; i < NUM_FLAGS; i++)
- //{
- // playerFlag.setFrame(i);
- // playerFlag.fill(rand() % 256);
- // playerFlag.drawButtonBorder(Color::white, Color::gray64);
- //
- // sprintf(strBuf, "%d", i);
- // bltString(playerFlag, 2, 3, strBuf, Color::white);
- //
- // // Create a button off the created surface.
- // addButtonSurface(iXY(x, 38), playerFlag, strBuf, 0);
- // x += xOffset;
- //}
-
} // end HostJoinTemplateView constructor
-#if 0
-// addVehicleButtons
-//---------------------------------------------------------------------------
-void HostJoinTemplateView::addVehicleButtons(const iXY &pos)
-{
- // Add the vehicle buttons.
- // Get the dimensions of the buttons to draw.
- Surface tempSurface;
- tempSurface.loadTIL("pics/vehicleSelectionMenu/light.bmp");
-
- iXY buttonSize(tempSurface.getPix());
- int arrowButtonWidth = 16;
-
- int x;
- int y;
-
- x = pos.x;
-
- y = pos.y;
-
- addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/humvee.bmp",
"", 0);
- x += buttonSize.x + 1;
-
- addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/light.bmp", "",
0);
- x += buttonSize.x + 1;
-
- addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/medium.bmp",
"", 0);
- x += buttonSize.x + 1;
-
- addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/heavy.bmp", "",
0);
- x += buttonSize.x + 1;
-
- addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/missle.bmp",
"", 0);
- x += buttonSize.x + 1;
-
- // Draw the arrows to change the numbers.
- x = pos.x;
- y = pos.y + buttonSize.y;
-
- x = pos.x + (buttonSize.x + 1) * 0;
- x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
- addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseHumvee);
- addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">",
"", bIncreaseHumvee);
-
- x = pos.x + (buttonSize.x + 1) * 1;
- x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
- addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "",
bDecreaseLightTank);
- addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">",
"", bIncreaseLightTank);
-
- x = pos.x + (buttonSize.x + 1) * 2;
- x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
- addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "",
bDecreaseMediumTank);
- addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">",
"", bIncreaseMediumTank);
-
- x = pos.x + (buttonSize.x + 1) * 3;
- x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
- addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "",
bDecreaseHeavyTank);
- addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">",
"", bIncreaseHeavyTank);
-
- x = pos.x + (buttonSize.x + 1) * 4;
- x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
- addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "",
bDecreaseMissleLauncher);
- addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">",
"", bIncreaseMissleLauncher);
-
-
-} // end HostJoinTemplateView::addVehicleButtons
-
-void HostJoinTemplateView::drawVehicleInfo(Surface &dest, const iXY &pos)
-{
- // Draw the dimmed background.
- iXY size(580, 118);
- iRect mapBorder(pos.x, pos.y, pos.x + size.x, pos.y + size.y);
- dest.bltLookup(mapBorder, Palette::darkGray256.getColorArray());
- dest.drawButtonBorder(mapBorder, Color::lightGreen, Color::darkGreen);
-
- // Draw the text.
- char strBuf[256];
- const PIX color = Color::lightGreen;
- int x = pos.x + 10;
- int y = pos.y + 10;
-
- const int yOffset = 15;
-
- sprintf(strBuf, "VEHICLE SELECTION");
- //dest.bltString(x, y, strBuf, color);
- dest.bltStringVGradient(x, y, strBuf, Palette::gradientWhite2Green);
- y += yOffset;
-
- sprintf(strBuf, " Humvee - %2d", getHumveeCount());
- dest.bltString(x, y, strBuf, color);
- y += yOffset;
-
- sprintf(strBuf, " Light Tank - %2d", getLightTankCount());
- dest.bltString(x, y, strBuf, color);
- y += yOffset;
-
- sprintf(strBuf, " Medium Tank - %2d", getMediumTankCount());
- dest.bltString(x, y, strBuf, color);
- y += yOffset;
-
- sprintf(strBuf, " Heavy Tank - %2d", getHeavyTankCount());
- dest.bltString(x, y, strBuf, color);
- y += yOffset;
-
- sprintf(strBuf, " Missle Launcher - %2d", getMissleLauncherCount());
- dest.bltString(x, y, strBuf, color);
- y += yOffset;
-
- sprintf(strBuf, " Selections Remaining - %2d", getSelectionsRemaining());
- dest.bltString(x, y, strBuf, color);
- y += yOffset;
-
-} // end HostView::drawVehicleInfo
-#endif
-
// doDraw
//---------------------------------------------------------------------------
void HostJoinTemplateView::doDraw(Surface &viewArea, Surface &clientArea)
{
MenuTemplateView::doDraw(viewArea, clientArea);
- //iXY pos(420, 38);
- //clientArea.bltString(pos, "Are You", Color::white);
-
- // Display the game type.
- //sprintf(strBuf, "Game Type: Call game type function.");
- //clientArea.bltStringShadowed(5, y, strBuf, Color::white, Color::gray64);
-
- //yOffset
- // Display the player count.
- //sprintf(strBuf, "Player Count: Call player count function.");
- //clientArea.bltString(5, 78, strBuf, Color::white);
-
- //sprintf(strBuf, "Player Name Flag Status");
- //clientArea.bltStringShadowed(5, 96, strBuf, Color::white, Color::gray64);
-
- //clientArea.drawButtonBorder(iRECT(4, 106, getClientRect().size().x - 5,
210), Color::white, Color::gray64);
- //iXY pos(7, 108);
- //drawPlayerInfo(clientArea, pos);
-
View::doDraw(viewArea, clientArea);
-
} // end doDraw
// drawNameInfo
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IPAddressView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IPAddressView.cpp:1.12
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IPAddressView.cpp:1.13
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IPAddressView.cpp:1.12 Wed Oct
15 17:16:33 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IPAddressView.cpp Tue Nov
11 08:42:06 2003
@@ -25,53 +25,6 @@
cInputFieldString IPAddressView::szServer;
-
-static void buttonOkay(void)
-{
- ConnectionAddress address;
- char * szServerName;
-
- szServerName = (char *)IPAddressView::szServer.getString();
-
- strcpy( address.string_rep, szServerName );
-
- // XXX No server info view yet
-#if 0
- ret_val = CLIENT->startEnumeration( address );
- ret_val = 1;
-
- if(ret_val == 1) {
- Desktop::setVisibility("IPAddressView", false);
-
- Desktop::setVisibility("JoinView", true);
- Desktop::setVisibility("GetSessionHostView", true);
- Desktop::setVisibility("UnitSelectionView", true);
- Desktop::setVisibility("FlagSelectionView", true);
- Desktop::setVisibility("PlayerNameView", true);
-
- } else {
- CLIENT->closeSession();
- Desktop::setVisibilityAllWindows(false);
- Desktop::setVisibility("GetSessionView", true);
- }
-#endif
-}
-////////////////////////////////////////////
-//END buttonOkay////////////////////////////
-
-
-static void buttonCancel(void)
-{
- CLIENT->closeSession();
- Desktop::setVisibilityAllWindows(false);
- Desktop::setVisibility("GetSessionView", true);
-
-}
-////////////////////////////////////////////
-//END buttonCancel//////////////////////////
-
-
-
// IPAddressView
//---------------------------------------------------------------------------
IPAddressView::IPAddressView() : View()
@@ -86,28 +39,20 @@
moveTo(iXY(bodyTextRect.min.x, bodyTextRect.min.y + 50));
- iXY area_size = iXY(280, 110);
+ iXY area_size = iXY(
+ 30 * 8 + 16,
+ Surface::getFontHeight() + 4 + 8);
resizeClientArea(area_size);
- addButtonCenterText(iXY(185, 10 ), 80, "Okay", "", buttonOkay);
- addButtonCenterText(iXY(185, 35 ), 80, "Cancel", "", buttonCancel);
-
- //addButtonCenterText(iXY(16, 50 ), area_size.x - 40, "Cancel", "",
buttonCancel);
-
Init();
} // end IPAddressView constructor
-
-
void IPAddressView::Init()
{
- szServer.init(" ", 100);
- addInputField(iXY(10, 80), &szServer, "", true);
+ szServer.init("", 50);
+ addInputField(iXY(8, 8), &szServer, "", true);
} // end IPAddressView::init
-
-
-
// doDraw
//---------------------------------------------------------------------------
void IPAddressView::doDraw(Surface &viewArea, Surface &clientArea)
@@ -115,3 +60,4 @@
clientArea.fill(Color::black);
View::doDraw(viewArea, clientArea);
} // end IPAddressView::doDraw
+
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.cpp:1.4
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.cpp:1.5
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.cpp:1.4 Fri Nov
7 23:53:09 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.cpp Tue Nov 11
08:42:06 2003
@@ -48,6 +48,8 @@
}
game_servers=new GameServerList();
game_servers_mutex=SDL_CreateMutex();
+
+ connectToServer();
startMessagesThread();
}
@@ -96,25 +98,15 @@
{
IPaddress addr;
// some old versions of SDL_net take a char* instead of const char*
- if(SDLNet_ResolveHost(&addr, const_cast<char*>(serveraddress.c_str()),
6667)
- < 0) {
- std::string err_mess("Couldn't resolve server address for "+
- serveraddress);
- addChatMessage("",err_mess);
- LOG((err_mess.c_str()));
- return;
- }
+ if(SDLNet_ResolveHost(&addr, const_cast<char*>(serveraddress.c_str()),
+ serverport) < 0)
+ throw Exception("Couldn't resolve server address '%s:%d'",
+ serveraddress.c_str(), serverport);
irc_server_socket = SDLNet_TCP_Open(&addr);
- if(!irc_server_socket) {
- std::stringstream err_mess;
- err_mess << "Couldn't connect to irc server: " << serveraddress
- << ":" << serverport << " Err:" << SDLNet_GetError();
- addChatMessage("",err_mess.str());
-
- LOG(("%s",err_mess.str().c_str()));
- return;
- }
+ if(!irc_server_socket)
+ throw Exception("Couldn't connect to irc server '%s:%d': %s",
+ serveraddress.c_str(), serverport, SDLNet_GetError());
// login
const char *playername = nickname.c_str();
@@ -175,7 +167,6 @@
int IRCLobby::messagesThreadEntry(void* data)
{
IRCLobby* t = (IRCLobby*) data;
- t->connectToServer();
t->processMessages();
return 0;
}
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.hpp:1.3
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.hpp:1.4
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.hpp:1.3 Fri Nov
7 23:28:31 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobby.hpp Tue Nov 11
08:42:06 2003
@@ -46,6 +46,9 @@
void refreshServerList();
void refreshUserList();
+ bool isConnected() const
+ { return irc_server_socket != 0; }
+
private:
void startMessagesThread();
void stopThread();
@@ -61,7 +64,6 @@
void readIRCLine(char *buf, size_t buf_len);
void connectToServer();
void addChatMessage(const std::string& user, const std::string& message);
- int isConnected() { return irc_server_socket!=NULL?1:0; }
SDL_mutex *game_servers_mutex;
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.4
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.5
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.4 Fri Nov
7 23:28:31 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp Tue Nov
11 08:42:06 2003
@@ -29,31 +29,10 @@
#include "Client.hpp"
-IRCLobby *IRCLobbyView::lobby_connection=0;
-std::string IRCLobbyView::lobby_server("irc.freenode.net:6667");
-
-cInputFieldString IRCLobbyView::szChat;
-
-
-static void buttonRefresh(void)
-{
- IRCLobbyView::lobby_connection->refreshServerList();
- IRCLobbyView::lobby_connection->refreshUserList();
-}
-
-static void chatReturnPressed(cInputField* )
-{
- IRCLobbyView::lobby_connection->sendChatMessage(
- gameconfig->playername,
- IRCLobbyView::szChat.getString());
- IRCLobbyView::szChat.setString("");
-}
-
-
-// IRCLobbyView
-//---------------------------------------------------------------------------
-IRCLobbyView::IRCLobbyView() : View()
+IRCLobbyView::IRCLobbyView()
+ : View()
{
+ lobby_connection=0;
lobby_view_height=160;
mouse_down_server=0;
total_displayed_servers=0;
@@ -76,6 +55,10 @@
szChat.init(" ", 34);
cInputField* input = addInputField(iXY(4, chat_y), &szChat, "", true);
input->setReturnAction(chatReturnPressed);
+
+ // XXX ugly ugly ugly
+ if(!lobby_view)
+ lobby_view = this;
}
@@ -91,7 +74,12 @@
int server_list_end_y=lobby_view_height-(Surface::getFontHeight()*6);
int chat_list_end_y=server_list_end_y+(Surface::getFontHeight()*4);
- if(lobby_connection==0) { return; }
+ if(lobby_connection == 0) {
+ clientArea.bltString(iXY(0,0), "Not connected to lobby:",
Color::white);
+ clientArea.bltString(iXY(0, Surface::getFontHeight()),
+ error_message.c_str(), Color::white);
+ return;
+ }
//~~~ todo: scrollbar for large list of servers
if(!lobby_connection->isConnected()) {
@@ -154,19 +142,37 @@
return View::lMouseUp(down_pos,up_pos);
}
+void IRCLobbyView::buttonRefresh()
+{
+ if(!lobby_view->lobby_connection)
+ return;
+
+ lobby_view->lobby_connection->refreshServerList();
+ lobby_view->lobby_connection->refreshUserList();
+}
+void IRCLobbyView::chatReturnPressed(cInputField* )
+{
+ lobby_view->lobby_connection->sendChatMessage(
+ gameconfig->playername,
+ lobby_view->szChat.getString());
+ lobby_view->szChat.setString("");
+}
// connect to remote irc
//---------------------------------------------------------------------------
void IRCLobbyView::startIRC()
{
+ if((const std::string&) gameconfig->lobbyserver == "")
+ return;
+
try {
- if(lobby_server.empty()) { return; }
stopIRC();
- lobby_connection=new IRCLobby(lobby_server,
+ lobby_connection=new IRCLobby(gameconfig->lobbyserver,
gameconfig->playername, "#netpanzerlob");
} catch(std::exception& e) {
LOG(("Couldn't connect to irc lobby: %s", e.what()));
+ error_message = e.what();
}
}
@@ -176,3 +182,4 @@
lobby_connection=0;
}
+IRCLobbyView* lobby_view = 0;
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp:1.3
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp:1.4
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp:1.3 Fri Nov
7 23:28:31 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.hpp Tue Nov
11 08:42:06 2003
@@ -18,6 +18,8 @@
#ifndef __IRCLobbyView_h__
#define __IRCLobbyView_h__
+#include <string>
+
#include "IRCLobby.hpp"
#include "View.hpp"
#include "Surface.hpp"
@@ -26,22 +28,30 @@
//---------------------------------------------------------------------------
class IRCLobbyView : public View
{
- int lobby_view_height;
- const GameServer *mouse_down_server;
- const GameServer *displayed_servers[64];
- int total_displayed_servers;
public:
- static std::string lobby_server;
- static cInputFieldString szChat;
- static IRCLobby *lobby_connection;
- IRCLobbyView();
+ IRCLobbyView();
+
+ void startIRC();
+ void stopIRC();
- static void startIRC();
- static void stopIRC();
+ virtual void doDraw(Surface &windowArea, Surface &clientArea);
+ virtual int lMouseUp(const iXY &up_pos,const iXY &down_pos);
- virtual void doDraw(Surface &windowArea, Surface &clientArea);
- virtual int lMouseUp(const iXY &up_pos,const iXY &down_pos);
+private:
+ static void buttonRefresh();
+ static void chatReturnPressed(cInputField* input);
+
+ int lobby_view_height;
+ const GameServer *mouse_down_server;
+ const GameServer *displayed_servers[64];
+ int total_displayed_servers;
+
+ std::string error_message;
+ cInputFieldString szChat;
+ IRCLobby *lobby_connection;
};
+
+extern IRCLobbyView* lobby_view;
#endif
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp:1.8
netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp:1.9
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp:1.8 Wed Oct
22 13:50:47 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp Tue Nov
11 08:42:06 2003
@@ -16,13 +16,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <config.h>
+
+#include <SDL/SDL.h>
+
#include "PlayerNameView.hpp"
#include "GameViewGlobals.hpp"
+#include "IRCLobbyView.hpp"
#include "GameConfig.hpp"
-cInputFieldString PlayerNameView::playerName;
-
-
// PlayerNameView
//---------------------------------------------------------------------------
PlayerNameView::PlayerNameView() : View()
@@ -44,15 +45,23 @@
init();
+ // XXX ugly
+ if(!playernameview)
+ playernameview = this;
} // end PlayerNameView::PlayerNameView
+PlayerNameView::~PlayerNameView()
+{
+}
+
// init
//---------------------------------------------------------------------------
void PlayerNameView::init()
{
playerName.init(gameconfig->playername.c_str(), INPUT_FIELD_CHARACTERS);
- addInputField(iXY(BORDER_SPACE, BORDER_SPACE), &playerName, "", true);
-
+ cInputField* input
+ = addInputField(iXY(BORDER_SPACE, BORDER_SPACE), &playerName, "",
true);
+ input->setReturnAction(returnPressed);
} // end PlayerNameView::init
// doDraw
@@ -63,5 +72,18 @@
//viewArea.bltLookup(r, Palette::darkGray256.getColorArray());
View::doDraw(viewArea, clientArea);
-
} // end PlayerNameView::doDraw
+
+void PlayerNameView::returnPressed(cInputField* input)
+{
+ gameconfig->playername = input->getDestString();
+ if(lobby_view) {
+ // the crude method for nickname change...
+ lobby_view->stopIRC();
+ SDL_Delay(500);
+ lobby_view->startIRC();
+ }
+}
+
+// sometime we shoudl eleminate all these global vars...
+PlayerNameView* playernameview = 0;
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.hpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.hpp:1.3
netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.hpp:1.4
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.hpp:1.3 Mon Oct
13 10:30:23 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.hpp Tue Nov
11 08:42:06 2003
@@ -25,24 +25,25 @@
//---------------------------------------------------------------------------
class PlayerNameView : public View
{
-private:
- enum { BORDER_SPACE = 4 };
- enum { INPUT_FIELD_CHARACTERS = 16 };
-
public:
PlayerNameView();
- virtual ~PlayerNameView()
- {}
+ virtual ~PlayerNameView();
virtual void doDraw(Surface &windowArea, Surface &clientArea);
virtual void drawBorder(Surface &windowArea)
{}
- static cInputFieldString playerName;
-
void init();
-}
-; // end PlayerNameView
+private:
+ static void returnPressed(cInputField* input);
+
+ enum { BORDER_SPACE = 4 };
+ enum { INPUT_FIELD_CHARACTERS = 16 };
+
+ cInputFieldString playerName;
+}; // end PlayerNameView
+
+extern PlayerNameView* playernameview;
#endif // end __PlayerNameView_hpp__