Changeset 31b347a in network-game for client/Client/main.cpp
- Timestamp:
- Dec 17, 2013, 2:11:14 PM (11 years ago)
- Branches:
- master
- Children:
- 453087e
- Parents:
- e103b51
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
re103b51 r31b347a 743 743 cout << "Received MSG_TYPE_PLAYER" << endl; 744 744 745 Player * p = new Player("", "");746 p ->deserialize(msg.buffer);747 p ->timeLastUpdated = getCurrentMillis();748 p ->isChasing = false;749 if (p ->health <= 0)750 p ->isDead = true;745 Player p("", ""); 746 p.deserialize(msg.buffer); 747 p.timeLastUpdated = getCurrentMillis(); 748 p.isChasing = false; 749 if (p.health <= 0) 750 p.isDead = true; 751 751 else 752 p->isDead = false; 753 754 if (mapPlayers.find(p->id) != mapPlayers.end()) 755 delete mapPlayers[p->id]; 756 mapPlayers[p->id] = p; 752 p.isDead = false; 753 754 if (mapPlayers.find(p.id) != mapPlayers.end()) 755 *(mapPlayers[p.id]) = p; 756 else 757 mapPlayers[p.id] = new Player(p); 757 758 758 759 break; … … 947 948 cout << "Received MSG_TYPE_PLAYER" << endl; 948 949 949 Player * p = new Player("", "");950 p ->deserialize(msg.buffer);951 p ->timeLastUpdated = getCurrentMillis();952 p ->isChasing = false;953 if (p ->health <= 0)954 p ->isDead = true;950 Player p("", ""); 951 p.deserialize(msg.buffer); 952 p.timeLastUpdated = getCurrentMillis(); 953 p.isChasing = false; 954 if (p.health <= 0) 955 p.isDead = true; 955 956 else 956 p->isDead = false; 957 958 if (mapPlayers.find(p->id) != mapPlayers.end()) 959 delete mapPlayers[p->id]; 960 mapPlayers[p->id] = p; 961 962 game->addPlayer(p); 957 p.isDead = false; 958 959 if (mapPlayers.find(p.id) != mapPlayers.end()) 960 *(mapPlayers[p.id]) = p; 961 else 962 mapPlayers[p.id] = new Player(p); 963 964 break; 965 966 // there's a problem here because PLAYER messages will be sent 967 // for players in this game as well as for new players logging in 968 // we might need two different message types 969 game->addPlayer(mapPlayers[p.id]); 963 970 964 971 break;
Note:
See TracChangeset
for help on using the changeset viewer.