~flosoft/s25rttr/trunk

« back to all changes in this revision

Viewing changes to src/nofStonemason.cpp

  • Committer: FloSoft
  • Date: 2014-04-25 15:35:50 UTC
  • Revision ID: flosoft@siedler25.org-20140425153550-9muu4vodhlqu58m0
committing subversion revision 9357 by FloSoft
astyle

modified:
s25client/trunk/
s25client/trunk/contrib/lua/lin32/include/
s25client/trunk/contrib/lua/lin64/include/
s25client/trunk/contrib/lua/mac/include/
s25client/trunk/contrib/lua/win32/include/
s25client/trunk/contrib/lua/win64/include/
s25client/trunk/driver/audio/SDL/src/
s25client/trunk/driver/src/
s25client/trunk/driver/video/GLFW/src/
s25client/trunk/driver/video/SDL/src/
s25client/trunk/driver/video/WinAPI/src/
s25client/trunk/src/
s25client/trunk/win32/
s25client/trunk/win32/prebuild-mutex/src/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: nofStonemason.cpp 7521 2011-09-08 20:45:55Z FloSoft $
 
1
// $Id: nofStonemason.cpp 9357 2014-04-25 15:35:25Z FloSoft $
2
2
//
3
3
// Copyright (c) 2005 - 2011 Settlers Freaks (sf-team at siedler25.org)
4
4
//
34
34
///////////////////////////////////////////////////////////////////////////////
35
35
// Makros / Defines
36
36
#if defined _WIN32 && defined _DEBUG && defined _MSC_VER
37
 
        #define new new(_NORMAL_BLOCK, THIS_FILE, __LINE__)
38
 
        #undef THIS_FILE
39
 
        static char THIS_FILE[] = __FILE__;
 
37
#define new new(_NORMAL_BLOCK, THIS_FILE, __LINE__)
 
38
#undef THIS_FILE
 
39
static char THIS_FILE[] = __FILE__;
40
40
#endif
41
41
 
42
 
nofStonemason::nofStonemason(const unsigned short x, const unsigned short y,const unsigned char player,nobUsual * workplace)
43
 
: nofFarmhand(JOB_STONEMASON,x,y,player,workplace)
 
42
nofStonemason::nofStonemason(const unsigned short x, const unsigned short y, const unsigned char player, nobUsual* workplace)
 
43
    : nofFarmhand(JOB_STONEMASON, x, y, player, workplace)
44
44
{
45
45
}
46
46
 
47
 
nofStonemason::nofStonemason(SerializedGameData * sgd, const unsigned obj_id) : nofFarmhand(sgd,obj_id)
 
47
nofStonemason::nofStonemason(SerializedGameData* sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id)
48
48
{
49
49
}
50
50
 
51
51
/// Malt den Arbeiter beim Arbeiten
52
 
void nofStonemason::DrawWorking(int x,int y)
 
52
void nofStonemason::DrawWorking(int x, int y)
53
53
{
54
 
        unsigned now_id;
55
 
 
56
 
        // Stein hauen
57
 
        LOADER.GetImageN("rom_bobs", 40+(now_id=GAMECLIENT.Interpolate(64,current_ev))%8)
58
 
                ->Draw(x,y,0,0,0,0,0,0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);
59
 
 
60
 
        if(now_id%8 == 5)
61
 
        {
62
 
                SoundManager::inst().PlayNOSound(56,this,now_id);
63
 
                was_sounding = true;
64
 
        }
 
54
    unsigned now_id;
 
55
 
 
56
    // Stein hauen
 
57
    LOADER.GetImageN("rom_bobs", 40 + (now_id = GAMECLIENT.Interpolate(64, current_ev)) % 8)
 
58
    ->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);
 
59
 
 
60
    if(now_id % 8 == 5)
 
61
    {
 
62
        SoundManager::inst().PlayNOSound(56, this, now_id);
 
63
        was_sounding = true;
 
64
    }
65
65
 
66
66
}
67
67
 
68
68
/// Fragt die abgeleitete Klasse um die ID in JOBS.BOB, wenn der Beruf Waren raustr�gt (bzw rein)
69
69
unsigned short nofStonemason::GetCarryID() const
70
70
{
71
 
        return 63;
 
71
    return 63;
72
72
}
73
73
 
74
74
/// Abgeleitete Klasse informieren, wenn sie anf�ngt zu arbeiten (Vorbereitungen)
79
79
/// Abgeleitete Klasse informieren, wenn fertig ist mit Arbeiten
80
80
void nofStonemason::WorkFinished()
81
81
{
82
 
        // Stein abhauen (wenn er nur noch ganz klein ist, dann wird er von der Landkarte getilgt)
83
 
        if(gwg->GetSpecObj<noGranite>(x,y)->IsSmall())
84
 
        {
85
 
                // Granitkl�tzchen l�schen
86
 
                gwg->GetSpecObj<noGranite>(x,y)->Destroy();
87
 
                delete gwg->GetSpecObj<noGranite>(x,y);
88
 
                gwg->SetNO(0,x,y);
89
 
 
90
 
                // Minimap Bescheid geben (Granitgl�tzchen muss weg)
91
 
                gwg->GetGameInterface()->GI_UpdateMinimap(x,y);
92
 
 
93
 
                // Drumherum BQ neu berechnen, da diese sich ja jetzt h�tten �ndern k�nnen
94
 
                gwg->RecalcBQAroundPoint(x,y);
95
 
        }
96
 
        else
97
 
                // ansonsten wird er um 1 kleiner
98
 
                gwg->GetSpecObj<noGranite>(x,y)->Hew();
99
 
 
100
 
        // Stein in die Hand nehmen
101
 
        ware = GD_STONES;
 
82
    // Stein abhauen (wenn er nur noch ganz klein ist, dann wird er von der Landkarte getilgt)
 
83
    if(gwg->GetSpecObj<noGranite>(x, y)->IsSmall())
 
84
    {
 
85
        // Granitkl�tzchen l�schen
 
86
        gwg->GetSpecObj<noGranite>(x, y)->Destroy();
 
87
        delete gwg->GetSpecObj<noGranite>(x, y);
 
88
        gwg->SetNO(0, x, y);
 
89
 
 
90
        // Minimap Bescheid geben (Granitgl�tzchen muss weg)
 
91
        gwg->GetGameInterface()->GI_UpdateMinimap(x, y);
 
92
 
 
93
        // Drumherum BQ neu berechnen, da diese sich ja jetzt h�tten �ndern k�nnen
 
94
        gwg->RecalcBQAroundPoint(x, y);
 
95
    }
 
96
    else
 
97
        // ansonsten wird er um 1 kleiner
 
98
        gwg->GetSpecObj<noGranite>(x, y)->Hew();
 
99
 
 
100
    // Stein in die Hand nehmen
 
101
    ware = GD_STONES;
102
102
}
103
103
 
104
104
/// Returns the quality of this working point or determines if the worker can work here at all
105
105
nofFarmhand::PointQuality nofStonemason::GetPointQuality(const MapCoord x, const MapCoord y)
106
106
{
107
 
        // An dieser Position muss es nur Stein geben
108
 
        return ((gwg->GetNO(x,y)->GetType() == NOP_GRANITE) ? PQ_CLASS1 : PQ_NOTPOSSIBLE);
 
107
    // An dieser Position muss es nur Stein geben
 
108
    return ((gwg->GetNO(x, y)->GetType() == NOP_GRANITE) ? PQ_CLASS1 : PQ_NOTPOSSIBLE);
109
109
}
110
110