offline
- Pridružio: 16 Feb 2011
- Poruke: 1630
- Gde živiš: Pancevo
|
Ajde jedno retardirano pitanje:
VS 2012 mi stalno daje gresku Compiler Error C2059
Radim skriptu za igricu World of Warcraft, upitanju je teleport koji ce igrace teleportovati na odredjene lokacije.
Greska :
Error 1 error C2059: syntax error : '{' c:\users\ikac\desktop\teleporter\teleporter\my_teleporter.cpp teleporter
Kod koji je izazvao ovo cudo je :
/*
* Definig zone for capital cities
*
* @params <int> City #ID
* @params <int> Side #ID
* @params <int> Icon #ID
* @params <str> City Name
* @param <float> X Cords
* @param <float> Y Cords
*
* @return <array>
*/
typedef struct Zone;
Zone city [] =
{ // <<--------------- Compailer kaze da je ova "{" greska
// Horde
{ 1, 1, 5, "Ogrimar", 44.9, 14.9 },
{ 2, 1, 5, "Thunder Bluff", 50.0, 49.5 },
{ 3, 1, 5, "Undercity", 61.5, 64.6 },
{ 4, 1, 5, "Ogrimar", 56.4, 52.1 },
// Alliance
{ 5, 2, 6, "Stormwind", 32.6, 52.2 },
{ 6, 2, 6, "Ironforge" , 52.8, 37.2 },
{ 7, 2, 6, "Darnassus" , 68.3 37.4 },
{ 7, 2, 6, "Exodar" , 80.5, 55.6 },
};
MIcrosoft kaze : [Link mogu videti samo ulogovani korisnici]
Sve sto je naveo sam probao ali opet me zeza, dok sam primoren da ovo odradim na WIN, a testirao sam na Linuksu skriptu u NetBeans i Eclipse i neprikazuju nikakvu gresku. A primoren sam da to napravim u VS2012.
Kod(nije ceo ubacen jer je ogroman) skripte koje sam pisao je :
#include "ScriptPCH.h"
// Teleport data
struct Eric
{
uint32 menu_id, next_menu_id;
uint8 icon;
std::string name;
uint32 cost;
uint8 level, faction; // 0 Both, 1 Horde, 2 Ally
uint32 map;
float x, y, z, o;
};
/*
* Definig zone for capital cities
*
* @params <int> City #ID
* @params <int> Side #ID
* @params <int> Icon #ID
* @params <str> City Name
* @param <float> X Cords
* @param <float> Y Cords
*
* @return <array>
*/
typedef struct Zone;
Zone city [] =
{
// Horde
{ 1, 1, 5, "Ogrimar", 44.9, 14.9 },
{ 2, 1, 5, "Thunder Bluff", 50.0, 49.5 },
{ 3, 1, 5, "Undercity", 61.5, 64.6 },
{ 4, 1, 5, "Ogrimar", 56.4, 52.1 },
// Alliance
{ 5, 2, 6, "Stormwind", 32.6, 52.2 },
{ 6, 2, 6, "Ironforge" , 52.8, 37.2 },
{ 7, 2, 6, "Darnassus" , 68.3 37.4 },
{ 7, 2, 6, "Exodar" , 80.5, 55.6 },
};
// TextIDs from npc_text
enum eEnums
{
TEXT_MAIN_H = 300000, //Horde main menu text
TEXT_MAIN_A = 300001, //Alliance main menu text
TEXT_DUNGEON = 300002, //Dungeon teleport menu texts
TEXT_RAID = 300003, //Raid teleport menu text
TEXT_AREA = 300004, //Area teleport location menu texts
TELEPORT_COUNT = sizeof TeLe/sizeof(*TeLe),
};
#define ARE_YOU_SURE "Are you sure, that you want to go to "
#define ERROR_COMBAT "|cffff0000You are in combat|r"
bool Custom_FactCheck (uint32 Fact, unsigned char Key)
{
bool Show = false;
switch (TeLe[Key].faction)
{
case 0:
Show = true;
break;
case 1:
if (Fact == HORDE)
Show = true;
break;
case 2:
if (Fact == ALLIANCE)
Show = true;
break;
}
return (Show);
}
uint32 Custom_GetText (unsigned int menu, Player* pPlayer)
{
uint32 TEXT = TEXT_AREA;
switch (menu)
{
case 0:
switch (pPlayer->GetTeam())
{
case ALLIANCE:
TEXT = TEXT_MAIN_A;
break;
case HORDE:
TEXT = TEXT_MAIN_H;
break;
}
case 1:
case 2:
case 3:
TEXT = TEXT_DUNGEON;
break;
case 4:
TEXT = TEXT_RAID;
break;
}
return (TEXT);
}
void Custom_GetMenu (Player* pPlayer, Creature* pCreature, uint32 Key)
{
bool ENDMENU = false;
for(uint32 i = 0; i < TELEPORT_COUNT; i++)
{
if (ENDMENU && TeLe[i].menu_id != Key)
break;
if (TeLe[i].menu_id == Key && pPlayer->getLevel() >= TeLe[i].level && Custom_FactCheck(pPlayer->GetTeam(), i))
{
if (TeLe[i].next_menu_id != 0)
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe[i].icon, TeLe[i].name, GOSSIP_SENDER_MAIN, i, "", TeLe[i].cost, false);
else
pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe[i].icon, TeLe[i].name, GOSSIP_SENDER_MAIN, i, ARE_YOU_SURE+TeLe[i].name, TeLe[i].cost, false);
ENDMENU = true;
}
}
pPlayer->PlayerTalkClass->SendGossipMenu(Custom_GetText(Key, pPlayer), pCreature->GetGUID());
}
class TeLe_gossip_codebox : public CreatureScript
{
public:
TeLe_gossip_codebox()
: CreatureScript("TeLe_gossip_codebox")
{
}
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
{
Custom_GetMenu(pPlayer, pCreature, 1);
return true;
}
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
pPlayer->PlayerTalkClass->ClearMenus(); // clear the menu
pPlayer->ModifyMoney(-1 * TeLe[uiAction].cost); // take cash
uint32 Key = TeLe[uiAction].next_menu_id;
if (Key == 0) // if no next_menu_id, then teleport to coords
{
if (!pPlayer->isInCombat())
{
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->TeleportTo(TeLe[uiAction].map, TeLe[uiAction].x, TeLe[uiAction].y, TeLe[uiAction].z, TeLe[uiAction].o);
return true;
}
pPlayer->GetSession()->SendAreaTriggerMessage(ERROR_COMBAT);
Key = TeLe[uiAction].menu_id;
}
Custom_GetMenu(pPlayer, pCreature, Key);
return true;
}
};
void AddSC_TeLe_gossip_codebox()
{
new TeLe_gossip_codebox();
}
Da li neko ima predstavu sta se desava, jedino u VS prikazuje error ali pokrene skriptu bez problema i pored tog errora.
|