Characters are working correctly again
This commit is contained in:
+11
-2
@@ -128,7 +128,7 @@ void InWorld::RenderFrame() {
|
||||
}
|
||||
|
||||
void InWorld::Render(SDL_Surface* const screen) {
|
||||
//draw the map0
|
||||
//draw the map
|
||||
for (std::list<Region>::iterator it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); it++) {
|
||||
tileSheet.DrawRegionTo(screen, &(*it), camera.x, camera.y);
|
||||
}
|
||||
@@ -185,6 +185,7 @@ void InWorld::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_LEFT:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.x -= CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -192,6 +193,7 @@ void InWorld::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_RIGHT:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.x += CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -199,6 +201,7 @@ void InWorld::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_UP:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.y -= CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -206,6 +209,7 @@ void InWorld::KeyDown(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_DOWN:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.y += CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -218,6 +222,7 @@ void InWorld::KeyUp(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_LEFT:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.x += CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -225,6 +230,7 @@ void InWorld::KeyUp(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_RIGHT:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.x -= CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -232,6 +238,7 @@ void InWorld::KeyUp(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_UP:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.y += CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -239,6 +246,7 @@ void InWorld::KeyUp(SDL_KeyboardEvent const& key) {
|
||||
case SDLK_DOWN:
|
||||
if (localCharacter) {
|
||||
localCharacter->motion.y -= CHARACTER_WALKING_SPEED;
|
||||
localCharacter->CorrectSprite();
|
||||
SendPlayerUpdate();
|
||||
}
|
||||
break;
|
||||
@@ -297,7 +305,8 @@ void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
|
||||
character.CorrectSprite();
|
||||
|
||||
//catch this client's player object
|
||||
if (argPacket->characterIndex == characterIndex && !localCharacter) {
|
||||
if (argPacket->accountIndex == accountIndex && !localCharacter) {
|
||||
characterIndex = argPacket->characterIndex;
|
||||
localCharacter = &character;
|
||||
|
||||
//setup the camera
|
||||
|
||||
@@ -21,11 +21,6 @@
|
||||
*/
|
||||
#include "main_menu.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
//-------------------------
|
||||
//Public access members
|
||||
//-------------------------
|
||||
@@ -60,9 +55,7 @@ MainMenu::MainMenu(ConfigUtility* const argConfig):
|
||||
quitButton.SetText("Quit");
|
||||
|
||||
//debug
|
||||
cout << config["client.username"] << endl;
|
||||
cout << config["client.handle"] << endl;
|
||||
cout << config["client.avatar"] << endl;
|
||||
//
|
||||
}
|
||||
|
||||
MainMenu::~MainMenu() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#MKDIR=mkdir
|
||||
#RM=del /y
|
||||
|
||||
CXXFLAGS+=-static-libgcc -static-libstdc++ -g
|
||||
CXXFLAGS+=-static-libgcc -static-libstdc++
|
||||
|
||||
export
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
//-------------------------
|
||||
//public methods
|
||||
//-------------------------
|
||||
@@ -244,8 +241,6 @@ void ServerApplication::HandleBroadcastRequest(SerialPacket* const argPacket) {
|
||||
}
|
||||
|
||||
void ServerApplication::HandleJoinRequest(ClientPacket* const argPacket) {
|
||||
cout << "Attempting connection: " << argPacket->username << endl;
|
||||
|
||||
//create the new client
|
||||
ClientData newClient;
|
||||
newClient.address = argPacket->srcAddress;
|
||||
@@ -273,7 +268,6 @@ void ServerApplication::HandleJoinRequest(ClientPacket* const argPacket) {
|
||||
}
|
||||
|
||||
void ServerApplication::HandleDisconnect(ClientPacket* const argPacket) {
|
||||
cout << "Trying to disconnect account " << argPacket->accountIndex << endl;
|
||||
//TODO: authenticate who is disconnecting/kicking
|
||||
|
||||
//forward to the specified client
|
||||
@@ -287,10 +281,8 @@ void ServerApplication::HandleDisconnect(ClientPacket* const argPacket) {
|
||||
characterMgr.UnloadCharacterIf([&](std::map<int, CharacterData>::iterator it) -> bool {
|
||||
if (argPacket->accountIndex == it->second.owner) {
|
||||
PumpCharacterUnload(it->first);
|
||||
cout << "Deleting character " << it->first << endl;
|
||||
return true;
|
||||
}
|
||||
cout << "Not deleting character " << it->first << endl;
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user