~ubuntu-branches/ubuntu/vivid/manaplus/vivid-proposed

« back to all changes in this revision

Viewing changes to src/net/ea/buysellhandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-10-12 12:23:57 UTC
  • mfrom: (1.1.36)
  • Revision ID: package-import@ubuntu.com-20141012122357-7836sgv1j1v02cs2
Tags: 1.4.10.11-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
 
171
171
void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const
172
172
{
173
 
    if (msg.readUInt8("response") == 0U)
 
173
    const uint8_t response = msg.readUInt8("response");
 
174
    if (response == 0U)
174
175
    {
175
176
        NotifyManager::notify(NotifyTypes::BUY_DONE);
 
177
        return;
176
178
    }
177
 
    else
 
179
    // Reset player money since buy dialog already assumed purchase
 
180
    // would go fine
 
181
    if (mBuyDialog)
 
182
        mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
 
183
    switch (response)
178
184
    {
179
 
        // Reset player money since buy dialog already assumed purchase
180
 
        // would go fine
181
 
        if (mBuyDialog)
182
 
            mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
183
 
        NotifyManager::notify(NotifyTypes::BUY_FAILED);
184
 
    }
 
185
        case 1:
 
186
            NotifyManager::notify(NotifyTypes::BUY_FAILED_NO_MONEY);
 
187
            break;
 
188
 
 
189
        case 2:
 
190
            NotifyManager::notify(NotifyTypes::BUY_FAILED_OVERWEIGHT);
 
191
            break;
 
192
 
 
193
        case 3:
 
194
            NotifyManager::notify(NotifyTypes::BUY_FAILED_TOO_MANY_ITEMS);
 
195
            break;
 
196
 
 
197
        default:
 
198
            NotifyManager::notify(NotifyTypes::BUY_FAILED);
 
199
            break;
 
200
    };
185
201
}
186
202
 
187
203
}  // namespace Ea