[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: |
Fri, 21 Nov 2003 09:23:56 -0500 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/11/21 09:23:55
Modified files:
. : ChangeLog BUGS
src/NetPanzer/Classes: Objective.hpp ObjectiveMessageTypes.hpp
Outpost.cpp Outpost.hpp UnitMessage.hpp
UnitMessageTypes.hpp
WorldInputCmdProcessor.cpp
WorldInputCmdProcessor.hpp
src/NetPanzer/Classes/Network: NetMessageEncoder.cpp
ServerMessageRouter.cpp
TerminalNetMesg.hpp
src/NetPanzer/Interfaces: MiniMapInterface.cpp
Log message:
-Applied a patch by Michel Metzger (address@hidden) which makes it
possible to
select the location where built units move.
Patches:
Index: netpanzer/BUGS
diff -u netpanzer/BUGS:1.10 netpanzer/BUGS:1.11
--- netpanzer/BUGS:1.10 Thu Nov 20 12:53:17 2003
+++ netpanzer/BUGS Fri Nov 21 09:23:54 2003
@@ -43,3 +43,4 @@
outpost
- bernhard reports that the bots crash when the server closes
- sometimes 2 players spawn at the same place
+- game end when all objectives occupation is complete is broken again
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.32 netpanzer/ChangeLog:1.33
--- netpanzer/ChangeLog:1.32 Thu Nov 20 19:19:23 2003
+++ netpanzer/ChangeLog Fri Nov 21 09:23:54 2003
@@ -1,3 +1,7 @@
+21-Nov-2003 by Matthias Braun
+-Applied a patch by Michel Metzger (address@hidden) which makes it possible to
+ select the location where built units move.
+
20-Nov-2003 by Matthias Braun
-removed lots of remaining nonused code handling with UDP networking
-convert PlayerStats to use STL
Index: netpanzer/src/NetPanzer/Classes/Network/NetMessageEncoder.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/NetMessageEncoder.cpp:1.4
netpanzer/src/NetPanzer/Classes/Network/NetMessageEncoder.cpp:1.5
--- netpanzer/src/NetPanzer/Classes/Network/NetMessageEncoder.cpp:1.4 Tue Sep
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/NetMessageEncoder.cpp Fri Nov
21 09:23:55 2003
@@ -37,6 +37,7 @@
void NetMessageEncoder::resetEncoder( void )
{
encode_message.message_class = _net_message_class_multi ;
+ encode_message.message_id = 0;
encode_message.message_count = 0;
memset( encode_message.data, 0, _MULTI_PACKET_LIMIT );
encode_message_index = 0;
@@ -44,6 +45,7 @@
void NetMessageEncoder::encodeMessage( NetMessage *message, unsigned short
size )
{
+ message->size = size;
if( ( (encode_message_index + size + sizeof(SubPacketType)) >
_MULTI_PACKET_LIMIT )
) {
encode_message.message_size = (unsigned short) encode_message_index;
Index: netpanzer/src/NetPanzer/Classes/Network/ServerMessageRouter.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ServerMessageRouter.cpp:1.4
netpanzer/src/NetPanzer/Classes/Network/ServerMessageRouter.cpp:1.5
--- netpanzer/src/NetPanzer/Classes/Network/ServerMessageRouter.cpp:1.4 Tue Sep
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ServerMessageRouter.cpp Fri Nov
21 09:23:55 2003
@@ -64,6 +64,12 @@
}
break;
+ case _net_message_id_term_output_loc: {
+ TerminalOutpostOutputLocRequest * terminal_command;
+ terminal_command = (TerminalOutpostOutputLocRequest *) message;
+ ObjectiveInterface::sendMessage(
&(terminal_command->output_loc_request));
+ }
+ break;
} // ** switch
Index: netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp
diff -u netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp:1.4
netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp:1.4 Thu Nov
20 19:19:25 2003
+++ netpanzer/src/NetPanzer/Classes/Network/TerminalNetMesg.hpp Fri Nov 21
09:23:55 2003
@@ -24,7 +24,8 @@
enum { _net_message_id_term_unit_cmd,
- _net_message_id_term_unit_gen
+ _net_message_id_term_unit_gen,
+ _net_message_id_term_output_loc
};
#ifdef MSVC
@@ -53,6 +54,20 @@
{
message_class = _net_message_class_terminal;
message_id = _net_message_id_term_unit_gen;
+ }
+
+}
+__attribute__((packed));
+
+class TerminalOutpostOutputLocRequest : public NetMessage
+{
+public:
+ ChangeOutputLocation output_loc_request;
+
+ TerminalOutpostOutputLocRequest()
+ {
+ message_class = _net_message_class_terminal;
+ message_id = _net_message_id_term_output_loc;
}
}
Index: netpanzer/src/NetPanzer/Classes/Objective.hpp
diff -u netpanzer/src/NetPanzer/Classes/Objective.hpp:1.5
netpanzer/src/NetPanzer/Classes/Objective.hpp:1.6
--- netpanzer/src/NetPanzer/Classes/Objective.hpp:1.5 Tue Sep 16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Objective.hpp Fri Nov 21 09:23:54 2003
@@ -60,6 +60,7 @@
bool unit_generation_on_off;
float unit_generation_time;
float unit_generation_time_remaining;
+ iXY unit_collection_loc;
};
class Objective
Index: netpanzer/src/NetPanzer/Classes/ObjectiveMessageTypes.hpp
diff -u netpanzer/src/NetPanzer/Classes/ObjectiveMessageTypes.hpp:1.4
netpanzer/src/NetPanzer/Classes/ObjectiveMessageTypes.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/ObjectiveMessageTypes.hpp:1.4 Tue Sep
16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/ObjectiveMessageTypes.hpp Fri Nov 21
09:23:55 2003
@@ -36,7 +36,8 @@
enum { _objective_mesg_update_occupation,
_objective_mesg_change_unit_generation,
_objective_mesg_disown_player_objective,
- _objective_mesg_sync_objective
+ _objective_mesg_sync_objective,
+ _objective_mesg_change_output_location
};
class UpdateOccupationsStatus : public ObjectiveMessage
@@ -105,6 +106,22 @@
SyncObjective::occupation_status = occupation_status;
SyncObjective::occupying_player = occupying_player;
message_type = _objective_mesg_sync_objective;
+ }
+
+}
+__attribute__((packed));
+
+class ChangeOutputLocation : public ObjectiveMessage
+{
+public:
+ iXY new_point;
+
+ void set( unsigned short id,
+ iXY point)
+ {
+ objective_id = id;
+ new_point = point;
+ message_type = _objective_mesg_change_output_location;
}
}
Index: netpanzer/src/NetPanzer/Classes/Outpost.cpp
diff -u netpanzer/src/NetPanzer/Classes/Outpost.cpp:1.8
netpanzer/src/NetPanzer/Classes/Outpost.cpp:1.9
--- netpanzer/src/NetPanzer/Classes/Outpost.cpp:1.8 Thu Nov 20 19:19:24 2003
+++ netpanzer/src/NetPanzer/Classes/Outpost.cpp Fri Nov 21 09:23:55 2003
@@ -29,7 +29,6 @@
#include "UnitNetMessage.hpp"
#include "ObjectiveNetMessage.hpp"
#include "UnitMessageTypes.hpp"
-
Outpost::Outpost( short ID, iXY location, BoundBox area )
: Objective( ID, location, area )
{
@@ -38,12 +37,13 @@
objective_state.selection_box.min = location + iXY( -224, -128 );
objective_state.area.min = iXY( -400, -144 );
objective_state.area.max = iXY( 400, 240 );
-
+ objective_state.outpost_type = 0;
+
unit_generation_type = _unit_type_humvee;
occupation_status_timer.changePeriod( 3 );
unit_generation_timer.changePeriod( 1 );
- unit_collection_loc = iXY( 13, 13 );
+ unit_collection_loc = outpost_map_loc + iXY( 13, 13 );
unit_generation_loc = iXY( 1, 3 );
occupation_pad_offset = iXY( 224, 48 );
unit_generation_on_flag = false;
@@ -167,7 +167,7 @@
PlacementMatrix placement_matrix;
iXY collection_loc, loc;
- collection_loc = outpost_map_loc + unit_collection_loc;
+ collection_loc = /*outpost_map_loc +*/ unit_collection_loc;
placement_matrix.reset( collection_loc );
placement_matrix.getNextEmptyLoc( &loc );
@@ -199,6 +199,14 @@
}
+void Outpost::objectiveMesgChangeOutputLocation( ObjectiveMessage *message ){
+ ChangeOutputLocation *msg;
+ msg = (ChangeOutputLocation *) message;
+ iXY temp;
+ MapInterface::pointXYtoMapXY( msg->new_point, &temp );
+ unit_collection_loc = temp;
+}
+
void Outpost::objectiveMesgChangeUnitGeneration( ObjectiveMessage *message )
{
ChangeUnitGeneration *unit_gen_mesg;
@@ -252,6 +260,7 @@
status.unit_generation_type = unit_generation_type;
status.unit_generation_on_off = unit_generation_on_flag;
+ status.unit_collection_loc = unit_collection_loc;
if ( unit_generation_type != _unit_type_null ) {
profile = UnitProfileInterface::getUnitProfile( unit_generation_type );
@@ -277,6 +286,9 @@
case _objective_mesg_disown_player_objective :
objectiveMesgDisownPlayerObjective( message );
+ break;
+ case _objective_mesg_change_output_location :
+ objectiveMesgChangeOutputLocation( message );
break;
} // ** switch
Index: netpanzer/src/NetPanzer/Classes/Outpost.hpp
diff -u netpanzer/src/NetPanzer/Classes/Outpost.hpp:1.3
netpanzer/src/NetPanzer/Classes/Outpost.hpp:1.4
--- netpanzer/src/NetPanzer/Classes/Outpost.hpp:1.3 Tue Sep 16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/Outpost.hpp Fri Nov 21 09:23:55 2003
@@ -48,6 +48,7 @@
// ** Message Handlers **
void objectiveMesgChangeUnitGeneration( ObjectiveMessage *message );
void objectiveMesgDisownPlayerObjective( ObjectiveMessage *message );
+ void objectiveMesgChangeOutputLocation( ObjectiveMessage *message );
public:
Index: netpanzer/src/NetPanzer/Classes/UnitMessage.hpp
diff -u netpanzer/src/NetPanzer/Classes/UnitMessage.hpp:1.4
netpanzer/src/NetPanzer/Classes/UnitMessage.hpp:1.5
--- netpanzer/src/NetPanzer/Classes/UnitMessage.hpp:1.4 Tue Sep 16 16:16:11 2003
+++ netpanzer/src/NetPanzer/Classes/UnitMessage.hpp Fri Nov 21 09:23:55 2003
@@ -18,6 +18,7 @@
#ifndef _UNITMESSAGE_HPP
#define _UNITMESSAGE_HPP
+#include <stdint.h>
#include "UnitID.hpp"
enum { _umesg_flag_unique = 0x01,
@@ -29,14 +30,16 @@
_umesg_flag_manager_request = 0x40
};
+#ifdef MSVC
+#pragma pack(1)
+#endif
class UnitMessage
{
public:
UnitID unit_id;
- unsigned char message_id;
- unsigned char message_flags;
-
+ uint8_t message_id;
+ uint8_t message_flags;
public:
@@ -63,7 +66,11 @@
return( false );
}
+}
+__attribute__((packed));
-};
+#ifdef MSVC
+#pragma pack()
+#endif
#endif // ** _UNITMESSAGE_HPP
Index: netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp
diff -u netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp:1.5
netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp:1.6
--- netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp:1.5 Thu Nov 20
19:19:24 2003
+++ netpanzer/src/NetPanzer/Classes/UnitMessageTypes.hpp Fri Nov 21
09:23:55 2003
@@ -40,10 +40,10 @@
class UMesgAICommand : public UnitMessage
{
public:
- unsigned char command;
+ uint8_t command;
iXY goal_loc;
- UnitID target_id;
- unsigned char manual_move_orientation;
+ UnitID target_id;
+ uint8_t manual_move_orientation;
iXY target_loc;
UMesgAICommand()
Index: netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp
diff -u netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.27
netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.28
--- netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp:1.27 Thu Nov
20 19:19:24 2003
+++ netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.cpp Fri Nov 21
09:23:55 2003
@@ -77,6 +77,7 @@
keyboard_input_mode = _keyboard_input_mode_command;
selection_box_active = false;
+ outpost_goal_selection = -1;
previous_manual_control_state = false;
manual_control_state = false;
manual_fire_state = false;
@@ -155,12 +156,6 @@
return;
}
- if(((bool)gameconfig->fullscreen)!=true) {
- // don't do border scrolling on windowed mode because
- // the window isn't always on the edge of the screen.
- return;
- }
-
if(mouse_pos.x >= (screen_size.x - 1)) {
WorldViewInterface::scroll_right(scroll_increment);
}
@@ -622,16 +617,27 @@
//updateScrollStatus( mouse_pos );
if ( (MouseInterface::buttonHeld( _LEFT_BUTTON_MASK ) == true)
- && (manual_control_state == false) && (manual_fire_state == false)
- ) {
- if ( selection_box_active == false ) {
- selection_box_active = true;
+ && (manual_control_state == false) && (manual_fire_state == false)
+ ) {
+
+ /* Objective *objective;
+ PlayerID player_id;
+
+ player_id = PlayerInterface::getLocalPlayerID();
+ unsigned char status =
ObjectiveInterface::quearyObjectiveLocationStatus( world_pos, player_id,
&objective );
+ if(status != _player_occupied_objective_found){*/
+ if(outpost_goal_selection == -1){
+ if ( selection_box_active == false ) {
+ selection_box_active = true;
+ }
}
} else {
if ( selection_box_active == true ) {
selection_box_active = false;
box_release = world_pos;
left_button_hold_action_complete = selectBoundBoxUnits();
+ }else{
+
}
}
@@ -669,20 +675,60 @@
} else {
if ( event.event == MouseEvent::EVENT_DOWN ) {
- if ( selection_box_active == false ) {
- WorldViewInterface::clientXYtoWorldXY( world_win,
event.down_pos, &world_pos );
+ WorldViewInterface::clientXYtoWorldXY( world_win, event.down_pos,
&world_pos );
+ Objective *objective;
+ PlayerID player_id;
+
+ player_id = PlayerInterface::getLocalPlayerID();
+ click_status = ObjectiveInterface::quearyObjectiveLocationStatus(
world_pos, player_id, &objective );
+
+ if ( (click_status == _player_occupied_objective_found) ) {
box_press = world_pos;
box_release = world_pos;
+
+ if ( outpost_goal_selection == -1){
+ outpost_goal_selection = objective->objective_state.ID;
+ output_pos_press = objective->objective_state.location;
+ }
+
+ }else{
+ if ( selection_box_active == false) {
+ WorldViewInterface::clientXYtoWorldXY( world_win,
event.down_pos, &world_pos );
+ box_press = world_pos;
+ box_release = world_pos;
+ }else{
+
+ }
}
} // ** _event_mbutton_down
+ if ( event.event == MouseEvent::EVENT_UP ) {
+ if (outpost_goal_selection != -1 ){
+ iXY temp;
+ MouseInterface::getMousePosition( &temp.x, &temp.y );
+ WorldViewInterface::clientXYtoWorldXY( world_win, temp,
&world_pos );
+
+ TerminalOutpostOutputLocRequest term_mesg;
+
+ term_mesg.output_loc_request.set( outpost_goal_selection,
+ world_pos);
+
+ CLIENT->sendMessage( &term_mesg,
sizeof(TerminalOutpostOutputLocRequest), 0 );
+
+ if ( NetworkState::status == _network_state_client ) {
+
+ ObjectiveInterface::sendMessage(
&(term_mesg.output_loc_request) );
+ }
+ outpost_goal_selection = -1;
+ }
+ }
if ( (event.event == MouseEvent::EVENT_CLICK) &&
(left_button_hold_action_complete == false) ) {
WorldViewInterface::clientXYtoWorldXY( world_win, event.down_pos,
&world_pos );
click_status = getCursorStatus( world_pos );
- switch ( click_status ) {
+ switch ( click_status ) {
case _cursor_player_unit : {
if( (KeyboardInterface::getKeyState( SDLK_LSHIFT ) ==
true) ||
(KeyboardInterface::getKeyState( SDLK_RSHIFT ) ==
true)
@@ -704,7 +750,9 @@
case _cursor_move:
case _cursor_blocked: {
- sendMoveCommand( world_pos );
+ if(outpost_goal_selection == -1){
+ sendMoveCommand( world_pos );
+ }
}
break;
@@ -1071,6 +1119,15 @@
screen->drawVLine( mouse_pos.x, mouse_pos.y, client_pos.y, 252 );
}
+ }
+
+ if (outpost_goal_selection != -1){
+ MouseInterface::getMousePosition( &mouse_pos.x, &mouse_pos.y );
+
+ WorldViewInterface::getViewWindow( &world_win );
+ WorldViewInterface::worldXYtoClientXY( world_win, output_pos_press,
&client_pos );
+
+ screen->drawLine(client_pos.x, client_pos.y, mouse_pos.x,
mouse_pos.y,252 );
}
}
Index: netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.hpp
diff -u netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.hpp:1.8
netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.hpp:1.9
--- netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.hpp:1.8 Wed Nov
12 03:28:31 2003
+++ netpanzer/src/NetPanzer/Classes/WorldInputCmdProcessor.hpp Fri Nov 21
09:23:55 2003
@@ -31,6 +31,10 @@
bool selection_box_active;
iXY box_press, box_release;
+
+ short outpost_goal_selection; //number of the outpost, -1 if none
+ iXY output_pos_press;
+
iXY right_mouse_scroll_pos;
iXY right_mouse_scrolled_pos;
bool right_mouse_scroll;
Index: netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.10
netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.11
--- netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp:1.10 Sun Nov
9 08:43:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/MiniMapInterface.cpp Fri Nov 21
09:23:55 2003
@@ -143,10 +143,11 @@
iRect world_rect, map_rect;
unsigned char objective_disposition;
PIX color;
+ int objective_id;
ObjectiveInterface::startObjectivePositionEnumeration();
- while( ObjectiveInterface::objectivePositionEnumeration( &world_rect,
&objective_disposition, 0 ) ) {
+ while( ObjectiveInterface::objectivePositionEnumeration( &world_rect,
&objective_disposition, &objective_id ) ) {
switch( objective_disposition ) {
case _objective_disposition_unoccupied :
color = Color::white;
@@ -183,6 +184,28 @@
} else {
assert(false);
}
+
+ ObjectiveState * obj_state =
ObjectiveInterface::getObjectiveState(objective_id);
+ //LOG(("%d", obj_state.outpost_type));
+ if(obj_state->outpost_type == 0){
+ //outpost_type is never used, I assume it determine the type of
objective and 0 is for outpost
+ // Actually, outpost is the only type of objective
+
+ if(objective_disposition == _objective_disposition_player){
+ OutpostStatus status =
ObjectiveInterface::getOutpostStatus(objective_id);
+ //Only draw our unit collection location
+ iXY dest, src;
+ MapInterface::mapXYtoPointXY(status.unit_collection_loc, &dest);
+ dest.x = int(float(dest.x) / scale_factor.x);
+ dest.y = int(float(dest.y) / scale_factor.y);
+
+ src.x = int(float(obj_state->location.x) / scale_factor.x);
+ src.y = int(float(obj_state->location.y) / scale_factor.y);
+ map_surface.drawLine(src.x, src.y, dest.x, dest.y, color);
+ }
+ }
+
+
} // ** while
}