Removed CommandSetResource action. In most cases it desynced the replays, and now there is another way to implement needed feature (it was added to make trading between players) through animations.
This commit is contained in:
parent
1d66191f8d
commit
22c596f62a
8 changed files with 3 additions and 46 deletions
src
action
game
include
network
stratagus
|
@ -693,7 +693,7 @@ static void SetPlayerData(int player, const char *prop, const char *arg, int val
|
|||
|
||||
for (int i = 0; i < MaxCosts; ++i) {
|
||||
if (res == DefaultResourceNames[i]) {
|
||||
SendCommandSetResource(Players[player].Index, i, value);
|
||||
Players[player].SetResource(i,value);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -842,18 +842,6 @@ void CommandDiplomacy(int player, int state, int opponent)
|
|||
// FIXME: Should we display a message?
|
||||
}
|
||||
|
||||
/**
|
||||
** Set new resources count for player.
|
||||
**
|
||||
** @param player Player which changes his state.
|
||||
** @param resource Resource index
|
||||
** @param value New value
|
||||
*/
|
||||
void CommandSetResource(int player, int resource, int value)
|
||||
{
|
||||
Players[player].SetResource(resource, value);
|
||||
}
|
||||
|
||||
/**
|
||||
** Shared vision changed.
|
||||
**
|
||||
|
|
|
@ -886,8 +886,6 @@ static void DoNextReplay()
|
|||
state = -1;
|
||||
}
|
||||
SendCommandDiplomacy(arg1, state, arg2);
|
||||
} else if (!strcmp(action, "set-resource")) {
|
||||
SendCommandSetResource(arg1, num, arg2);
|
||||
} else if (!strcmp(action, "shared-vision")) {
|
||||
bool state;
|
||||
state = atoi(val) ? true : false;
|
||||
|
|
|
@ -312,8 +312,6 @@ extern void CommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, SpellTy
|
|||
extern void CommandAutoSpellCast(CUnit &unit, int spellid, int on);
|
||||
/// Prepare diplomacy command
|
||||
extern void CommandDiplomacy(int player, int state, int opponent);
|
||||
/// Prepare set resources command
|
||||
extern void CommandSetResource(int player, int resource, int value);
|
||||
/// Prepare shared vision command
|
||||
extern void CommandSharedVision(int player, bool state, int opponent);
|
||||
|
||||
|
|
|
@ -101,8 +101,6 @@ extern void SendCommandCancelResearch(CUnit &unit);
|
|||
extern void SendCommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush);
|
||||
/// Send auto spell cast command
|
||||
extern void SendCommandAutoSpellCast(CUnit &unit, int spellid, int on);
|
||||
/// Send set resource command
|
||||
extern void SendCommandSetResource(int player, int resource, int value);
|
||||
/// Send diplomacy command
|
||||
extern void SendCommandDiplomacy(int player, int state, int opponent);
|
||||
/// Send shared vision command
|
||||
|
|
|
@ -107,8 +107,7 @@ enum _message_type_ {
|
|||
*/
|
||||
enum _extended_message_type_ {
|
||||
ExtendedMessageDiplomacy, /// Change diplomacy
|
||||
ExtendedMessageSharedVision, /// Change shared vision
|
||||
ExtendedMessageSetResource /// Change resource count
|
||||
ExtendedMessageSharedVision /// Change shared vision
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -494,25 +494,6 @@ void SendCommandDiplomacy(int player, int state, int opponent)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** Send command: Diplomacy changed.
|
||||
**
|
||||
** @param player Player which changes his resource.
|
||||
** @param resource Resource type.
|
||||
** @param value New resource value.
|
||||
*/
|
||||
void SendCommandSetResource(int player, int resource, int value)
|
||||
{
|
||||
if (!IsNetworkGame()) {
|
||||
CommandLog("set-resource", NoUnitP, 0, player, value,
|
||||
NoUnitP, NULL, resource);
|
||||
CommandSetResource(player, resource, value);
|
||||
} else {
|
||||
NetworkSendExtendedCommand(ExtendedMessageSetResource,
|
||||
-1, player, resource, value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** Send command: Shared vision changed.
|
||||
**
|
||||
|
@ -783,11 +764,6 @@ void ParseExtendedCommand(unsigned char type, int status,
|
|||
}
|
||||
CommandDiplomacy(arg2, arg3, arg4);
|
||||
break;
|
||||
case ExtendedMessageSetResource:
|
||||
CommandLog("set-resource", NoUnitP, 0, arg2, arg4,
|
||||
NoUnitP, NULL, arg3);
|
||||
CommandSetResource(arg2, arg3, arg4);
|
||||
break;
|
||||
case ExtendedMessageSharedVision:
|
||||
if (arg3 == 0) {
|
||||
CommandLog("shared-vision", NoUnitP, 0, arg2, arg4,
|
||||
|
|
|
@ -930,7 +930,7 @@ static int CclSetPlayerData(lua_State *l)
|
|||
if (i == MaxCosts) {
|
||||
LuaError(l, "Invalid resource \"%s\"" _C_ res.c_str());
|
||||
}
|
||||
SendCommandSetResource(p->Index,i,LuaToNumber(l, 4));
|
||||
p->SetResource(i,LuaToNumber(l, 4));
|
||||
// } else if (!strcmp(data, "UnitTypesCount")) {
|
||||
// } else if (!strcmp(data, "AiEnabled")) {
|
||||
// } else if (!strcmp(data, "TotalNumUnits")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue