Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 26, 2013
@fizzet fizzet don't break if there is a cutscene dream when resting in an inn
This solution is kind of hacky, and ideally we wouldn't leave (or
reenter) the inn but I suppose it's better than breaking.
7c2a279
@fizzet fizzet don't set HOUR token when resting
RestParty() already does this for us
fd3b50b
View
22 gemrb/GUIScripts/GUISTORE.py
@@ -1566,19 +1566,21 @@ def RentConfirm ():
price = Store['StoreRoomPrices'][RentIndex]
Gold = GemRB.GameGetPartyGold ()
GemRB.GameSetPartyGold (Gold-price)
- GemRB.RestParty (13, 1, RentIndex+1)
+ cutscene = GemRB.RestParty (13, 1, RentIndex+1)
if RentConfirmWindow:
RentConfirmWindow.Unload ()
Window = StoreRentWindow
- TextArea = Window.GetControl (12)
- #is there any way to change this???
- GemRB.SetToken ("HOUR", "8")
- GemRB.SetToken ("HP", "%d"%(RentIndex+1))
- TextArea.SetText (16476)
- GemRB.SetVar ("RentIndex", -1)
- Button = Window.GetControl (RentIndex+4)
- Button.SetState (IE_GUI_BUTTON_ENABLED)
- UpdateStoreRentWindow ()
+ if cutscene:
+ CloseStoreWindow ()
+ else:
+ TextArea = Window.GetControl (12)
+ #is there any way to change this???
+ GemRB.SetToken ("HP", "%d"%(RentIndex+1))
+ TextArea.SetText (16476)
+ GemRB.SetVar ("RentIndex", -1)
+ Button = Window.GetControl (RentIndex+4)
+ Button.SetState (IE_GUI_BUTTON_ENABLED)
+ UpdateStoreRentWindow ()
return
def RentDeny () :
View
28 gemrb/core/Game.cpp
@@ -1566,16 +1566,17 @@ void Game::TextDream()
//dream = 0 - based on area non-0 - select from list
//-1 no dream
//hp is how much hp the rest will heal
-void Game::RestParty(int checks, int dream, int hp)
+//returns true if a cutscene dream is about to be played
+bool Game::RestParty(int checks, int dream, int hp)
{
if (!(checks&REST_NOMOVE) ) {
if (!EveryoneStopped()) {
- return;
+ return false;
}
}
Actor *leader = GetPC(0, true);
if (!leader) {
- return;
+ return false;
}
Map *area = leader->GetCurrentArea();
@@ -1584,7 +1585,7 @@ void Game::RestParty(int checks, int dream, int hp)
if (!EveryoneNearPoint( area, leader->Pos, 0 ) ) {
//party too scattered
displaymsg->DisplayConstantString( STR_SCATTERED, DMC_RED );
- return;
+ return false;
}
}
@@ -1592,12 +1593,12 @@ void Game::RestParty(int checks, int dream, int hp)
//don't allow resting while in combat
if (AnyPCInCombat()) {
displaymsg->DisplayConstantString( STR_CANTRESTMONS, DMC_RED );
- return;
+ return false;
}
//don't allow resting if hostiles are nearby
if (area->AnyEnemyNearPoint(leader->Pos)) {
displaymsg->DisplayConstantString( STR_CANTRESTMONS, DMC_RED );
- return;
+ return false;
}
}
@@ -1609,13 +1610,13 @@ void Game::RestParty(int checks, int dream, int hp)
//you cannot rest here
if (area->AreaFlags&AF_NOSAVE) {
displaymsg->DisplayConstantString( STR_MAYNOTREST, DMC_RED );
- return;
+ return false;
}
//you may not rest here, find an inn
if (!(area->AreaType&(AT_OUTDOOR|AT_FOREST|AT_DUNGEON|AT_CAN_REST) ))
{
displaymsg->DisplayConstantString( STR_MAYNOTREST, DMC_RED );
- return;
+ return false;
}
//area encounters
// also advances gametime (so partial rest is possible)
@@ -1632,7 +1633,7 @@ void Game::RestParty(int checks, int dream, int hp)
hours -= hoursLeft;
// the interruption occured before any resting could be done, so just bail out
if (!hours) {
- return;
+ return false;
}
}
} else {
@@ -1656,13 +1657,15 @@ void Game::RestParty(int checks, int dream, int hp)
// abort the partial rest; we got what we wanted
if (hoursLeft) {
- return;
+ return false;
}
//movie, cutscene, and still frame dreams
+ bool cutscene = false;
if (dream>=0) {
//cutscene dreams
if (gamedata->Exists("player1d",IE_BCS_CLASS_ID, true)) {
+ cutscene = true;
PlayerDream();
} else if (gamedata->Exists("drmtxt2", IE_2DA_CLASS_ID, true)) {
TextDream();
@@ -1695,14 +1698,15 @@ void Game::RestParty(int checks, int dream, int hp)
core->GetTokenDictionary()->SetAtCopy("HOUR", hours);
//this would be bad
- if (hrsindex == -1 || restindex == -1) return;
+ if (hrsindex == -1 || restindex == -1) return cutscene;
tmpstr = core->GetString(hrsindex, 0);
//as would this
- if (!tmpstr) return;
+ if (!tmpstr) return cutscene;
core->GetTokenDictionary()->SetAtCopy("DURATION", tmpstr);
core->FreeString(tmpstr);
displaymsg->DisplayString(restindex, DMC_WHITE, 0);
+ return cutscene;
}
//timestop effect
View
2  gemrb/core/Game.h
@@ -469,7 +469,7 @@ class GEM_EXPORT Game : public Scriptable {
areas run scripts on door, infopoint, container, actors too */
void UpdateScripts();
/** runs area functionality, sets partyrested trigger */
- void RestParty(int checks, int dream, int hp);
+ bool RestParty(int checks, int dream, int hp);
/** timestop effect initiated by actor */
void TimeStop(Actor *actor, ieDword end);
/** check if the passed actor is a victim of timestop */
View
4 gemrb/plugins/GUIScript/GUIScript.cpp
@@ -9707,9 +9707,7 @@ static PyObject* GemRB_RestParty(PyObject * /*self*/, PyObject* args)
}
GET_GAME();
- game->RestParty(noareacheck, dream, hp);
- Py_INCREF( Py_None );
- return Py_None;
+ return PyInt_FromLong(game->RestParty(noareacheck, dream, hp));
}
PyDoc_STRVAR( GemRB_ChargeSpells__doc,

No commit comments for this range

Something went wrong with that request. Please try again.