1
0

Forgotten files for previous merge commit (rev 1139)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1140 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-01-13 11:10:26 +00:00
parent 43e6840719
commit 752057fb1b
15 changed files with 474 additions and 117 deletions

View File

@ -1,15 +1,30 @@
function Initialize( Plugin )
Plugin:SetName( "ChatLog" )
Plugin:SetVersion( 2 )
-- plugin.lua
-- Implements the main entrypoint for the plugin, as well as all the handling needed
-- ChatLog plugin logs all chat messages into the server log
function Initialize(Plugin)
Plugin:SetName("ChatLog")
Plugin:SetVersion(3)
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_CHAT )
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT)
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function OnChat( Player, Message )
function OnChat(Player, Message)
-- Lets get loggin'
LOGINFO("[" .. Player:GetName() .. "]: " .. Message);

View File

@ -27,7 +27,7 @@ function Initialize(Plugin)
PLUGIN:SetVersion(6)
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(PLUGIN, cPluginManager.E_PLUGIN_TICK)
PluginManager:AddHook(PLUGIN, cPluginManager.HOOK_TICK)
Plugin:AddWebTab("(Re)Generation", HandleRequest_Generation)
@ -71,7 +71,7 @@ function OnDisable()
LOG(PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " is shutting down...")
end
function Tick( DeltaTime )
function OnTick( DeltaTime )
if (GENERATION_STATE == 1 or GENERATION_STATE == 3) then
LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works STARTED!")
LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": At world: " .. WORK_WORLD)

View File

@ -1,6 +1,6 @@
function HandleItemCommand( Split, Player )
if( #Split ~= 2 and #Split ~=3 ) then
Player:SendMessage( cChatColor.Green .. "Usage: /item [ItemID/Name:Dmg] <Amount>" )
Player:SendMessage( cChatColor.Green .. "Usage: /item [ItemType/Name:Dmg] <Amount>" )
return true
end
@ -12,7 +12,7 @@ function HandleItemCommand( Split, Player )
end
if( FoundItem == false ) then
Player:SendMessage( cChatColor.Green .. "Invalid Item ID / Name !" )
Player:SendMessage( cChatColor.Green .. "Invalid Item type / name !" )
return true
end

View File

@ -12,34 +12,34 @@ function Initialize( Plugin )
PLUGIN = Plugin
Plugin:SetName( "Core" )
Plugin:SetVersion( 8 )
Plugin:SetVersion(9)
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOIN)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_PLACE)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_DIG)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLED)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) -- used in web_chat.lua
Plugin:AddCommand("/help", " - [Page] Show this message", "core.help")
Plugin:AddCommand("/pluginlist", " - Show list of plugins", "core.pluginlist")
Plugin:AddCommand("/tp", " - [Player] - Teleport yourself to a player", "core.teleport")
Plugin:AddCommand("/item", " - [ItemID/Name] <Amount> - Spawn an item for yourself", "core.item")
Plugin:AddCommand("/list", " - Shows list of connected players", "core.playerlist")
Plugin:AddCommand("/motd", " - Show message of the day", "core.motd")
Plugin:AddCommand("/reload", " - Reload all plugins", "core.reload")
Plugin:AddCommand("/stop", " - Stops the server", "core.stop")
Plugin:AddCommand("/time", " - [Day/Night] - Sets the time of day", "core.time")
Plugin:AddCommand("/spawn", " - Return to the spawn", "core.spawn")
Plugin:AddCommand("/kick", " - [Player] - Kick a player", "core.kick")
Plugin:AddCommand("/ban", " - [Player] - Ban a player", "core.ban")
Plugin:AddCommand("/unban", " - [Player] - Unban a player", "core.unban")
Plugin:AddCommand("/top", " - Teleport yourself to the top most block", "core.top")
Plugin:AddCommand("/gm", " - [Gamemode (0|1)] - Change your gamemode", "core.changegm")
Plugin:AddCommand("/gotoworld", " - Move to a different world!", "core.gotoworld")
Plugin:AddCommand("/coords", " - Show your current server coordinates", "core.coords")
Plugin:AddCommand("/help", " - [Page] Show this message", "core.help")
Plugin:AddCommand("/pluginlist", " - Show list of plugins", "core.pluginlist")
Plugin:AddCommand("/tp", " - [Player] - Teleport yourself to a player", "core.teleport")
Plugin:AddCommand("/item", " - [ItemType/Name] <Amount> - Give yourself an item", "core.item")
Plugin:AddCommand("/list", " - Shows list of connected players", "core.playerlist")
Plugin:AddCommand("/motd", " - Show message of the day", "core.motd")
Plugin:AddCommand("/reload", " - Reload all plugins", "core.reload")
Plugin:AddCommand("/stop", " - Stops the server", "core.stop")
Plugin:AddCommand("/time", " - [Day/Night] - Sets the time of day", "core.time")
Plugin:AddCommand("/spawn", " - Return to the spawn", "core.spawn")
Plugin:AddCommand("/kick", " - [Player] - Kick a player", "core.kick")
Plugin:AddCommand("/ban", " - [Player] - Ban a player", "core.ban")
Plugin:AddCommand("/unban", " - [Player] - Unban a player", "core.unban")
Plugin:AddCommand("/top", " - Teleport yourself to the top most block", "core.top")
Plugin:AddCommand("/gm", " - [Gamemode (0|1)] - Change your gamemode", "core.changegm")
Plugin:AddCommand("/gotoworld", " - Move to a different world!", "core.gotoworld")
Plugin:AddCommand("/coords", " - Show your current server coordinates", "core.coords")
Plugin:AddCommand("/viewdistance", " - [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."] - Change your view distance", "core.viewdistance")
Plugin:AddCommand("/regeneratechunk", " - <X [Z]> - Regenerates a chunk", "core.regeneratechunk")

View File

@ -16,7 +16,7 @@ function OnCraftingNoRecipe(Player, Grid, Recipe)
for x = 0, Grid:GetWidth() - 1 do
for y = 0, Grid:GetHeight() - 1 do
local Item = Grid:GetItem(x, y)
if (Item.m_ItemID ~= E_ITEM_EMPTY) then
if (Item.m_ItemType ~= E_ITEM_EMPTY) then
table.insert(Items, Item)
end
end
@ -27,23 +27,23 @@ function OnCraftingNoRecipe(Player, Grid, Recipe)
return false
end
if (Items[1].m_ItemID ~= Items[2].m_ItemID) then
if (Items[1].m_ItemType ~= Items[2].m_ItemType) then
-- Only items of the same type may be fixed
return false
end
if (
(Items[1].m_ItemHealth == 0) or
(Items[2].m_ItemHealth == 0)
(Items[1].m_ItemDamage == 0) or
(Items[2].m_ItemDamage == 0)
)
then
-- Only damaged items may be fixed
return false
end
local _ID = Items[1].m_ItemID
local _least_hp = math.max(Items[1].m_ItemHealth, Items[2].m_ItemHealth)
local _most_hp = math.min(Items[1].m_ItemHealth, Items[2].m_ItemHealth)
local _ID = Items[1].m_ItemType
local _least_hp = math.max(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
local _most_hp = math.min(Items[1].m_ItemDamage, Items[2].m_ItemDamage)
local _item_hp = 0
-- TODO: This could be refactored into better code, using an _ID-indexed table for _item_hp

View File

@ -1,4 +1,4 @@
function OnBlockDig(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta)
function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, OldBlockType, OldBlockMeta)
-- dont check if the direction is in the air
if (BlockFace ~= -1) then

View File

@ -1,4 +0,0 @@
function OnPlayerJoin( Player )
ShowMOTDTo( Player )
return false
end

View File

@ -0,0 +1,4 @@
function OnPlayerJoined(Player)
ShowMOTDTo( Player )
return false
end

View File

@ -1,4 +1,4 @@
function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType)
-- dont check if the direction is in the air
if (BlockFace == -1) then
@ -14,7 +14,7 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
local X = BlockX
local Y = BlockY
local Z = BlockZ
X, Y, Z = AddDirection(X, Y, Z, BlockFace)
X, Y, Z = AddFaceDirection(X, Y, Z, BlockFace)
if (Y >= 256 or Y < 0) then
return true
end

View File

@ -13,7 +13,7 @@ function Initialize(Plugin)
Plugin:SetVersion(1)
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.E_PLUGIN_BLOCK_PLACE)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE)
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
@ -24,13 +24,15 @@ end
function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
-- dont check if the direction is in the air
if BlockFace == BLOCK_FACE_NONE then
if (BlockFace == BLOCK_FACE_NONE) then
return false
end
local HeldItem = Player:GetEquippedItem();
if (HeldItem.m_ItemType == E_ITEM_STICK) then
-- Magic sTick of ticking: set the pointed block for ticking at the next tick
Player:SendMessage(cChatColor.LightGray .. "Setting next block tick to {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}")
@ -42,7 +44,9 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
-- Magic rod of query: show block types and metas for both neighbors of the pointed face
local Type = 0;
local Meta = 0;
Type, Meta = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta);
local Valid = false;
Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta);
if (Type == E_BLOCK_AIR) then
Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: air:" .. Meta);
else
@ -53,8 +57,8 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
local X = BlockX;
local Y = BlockY;
local Z = BlockZ;
X, Y, Z = AddDirection(BlockX, BlockY, BlockZ, BlockFace);
Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta);
X, Y, Z = AddFaceDirection(BlockX, BlockY, BlockZ, BlockFace);
Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta);
if (Type == E_BLOCK_AIR) then
Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: air:" .. Meta);
else

View File

@ -25,7 +25,7 @@ function Initialize(Plugin)
Plugin:SetVersion(1);
PluginManager = cRoot:Get():GetPluginManager();
PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_PLACE);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
return true;
end
@ -33,7 +33,7 @@ end
function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
-- Don't check if the direction is in the air
if (BlockFace == -1) then

View File

@ -0,0 +1,333 @@
-- Global variables
PLUGIN = {} -- Reference to own plugin object
function Initialize(Plugin)
PLUGIN = Plugin
Plugin:SetName("HookNotify")
Plugin:SetVersion(1)
PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_COLLECT_PICKUP);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLED);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BROKEN_BLOCK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_EATING);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVED);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACED_BLOCK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHTCLICK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SHOOTING);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SPAWNED);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_TOSSING_ITEM);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_BLOCK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_POST_CRAFTING);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PRE_CRAFTING);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATED_SIGN);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATING_SIGN);
PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGED);
LOGINFO("HookNotify plugin is installed, beware, the log output may be quite large!");
LOGINFO("You want this plugin enabled only when developing another plugin, not for regular gameplay.");
return true
end
function LogHook(FnName, ...)
LOG(FnName .. "(");
for i, v in ipairs(arg) do
local vt = tostring(v);
local TypeString = type(v);
if (type(v) == "userdata") then
TypeString = tolua.type(v);
end;
LOG(" " .. tostring(i) .. ": " .. TypeString .. ": " .. tostring(v));
end
LOG(")");
end
function OnChat(...)
LogHook("OnChat", unpack(arg));
end
function OnChunkGenerated(...)
LogHook("OnChunkGenerated", unpack(arg));
end
function OnChunkGenerating(...)
LogHook("OnChunkGenerating", unpack(arg));
end
function OnPlayerUsingItem(...)
LogHook("OnPlayerUsingItem", unpack(arg));
end
function OnCollectPickup(...)
LogHook("OnCollectPickup", unpack(arg));
end
function OnCraftingNoRecipe(...)
LogHook("OnCraftingNoRecipe", unpack(arg));
end
function OnDisconnect(...)
LogHook("OnDisconnect", unpack(arg));
end
function OnHandshake(...)
LogHook("OnHandshake", unpack(arg));
end
function OnKilled(...)
LogHook("OnKilled", unpack(arg));
end
function OnLogin(...)
LogHook("OnLogin", unpack(arg));
end
function OnPlayerBreakingBlock(...)
LogHook("OnPlayerBreakingBlock", unpack(arg));
end
function OnPlayerBrokenBlock(...)
LogHook("OnPlayerBrokenBlock", unpack(arg));
end
function OnPlayerEating(...)
LogHook("OnPlayerEating", unpack(arg));
end
function OnPlayerJoined(...)
LogHook("OnPlayerJoined", unpack(arg));
end
function OnPlayerLeftClick(...)
LogHook("OnPlayerLeftClick", unpack(arg));
end
function OnPlayerMoved(...)
LogHook("OnPlayerMoved", unpack(arg));
end
function OnPlayerPlacedBlock(...)
LogHook("OnPlayerPlacedBlock", unpack(arg));
end
function OnPlayerPlacingBlock(...)
LogHook("OnPlayerPlacingBlock", unpack(arg));
end
function OnPlayerRightClick(...)
LogHook("OnPlayerRightClick", unpack(arg));
end
function OnPlayerShooting(...)
LogHook("OnPlayerShooting", unpack(arg));
end
function OnPlayerSpawned(...)
LogHook("OnPlayerSpawned", unpack(arg));
end
function OnPlayerTossingItem(...)
LogHook("OnPlayerTossingItem", unpack(arg));
end
function OnPlayerUsedBlock(...)
LogHook("OnPlayerUsedBlock", unpack(arg));
end
function OnPlayerUsedItem(...)
LogHook("OnPlayerUsedItem", unpack(arg));
end
function OnPlayerUsingBlock(...)
LogHook("OnPlayerUsingBlock", unpack(arg));
end
function OnPlayerUsingItem(...)
LogHook("OnPlayerUsingItem", unpack(arg));
end
function OnPostCrafting(...)
LogHook("OnPostCrafting", unpack(arg));
end
function OnPreCrafting(...)
LogHook("OnPreCrafting", unpack(arg));
end
function OnUpdatedSign(...)
LogHook("OnUpdatedSign", unpack(arg));
end
function OnUpdatingSign(...)
LogHook("OnUpdatingSign", unpack(arg));
end
function OnWeatherChanged(...)
LogHook("OnWeatherChanged", unpack(arg));
end
------------------------------------------------------------------
-- Special handling for OnTakeDamage to print the contents of TDI:
function OnTakeDamage(Receiver, TDI)
-- Receiver is cPawn
-- TDI is TakeDamageInfo
LOG("OnTakeDamage(): " .. Receiver:GetClass() .. " was dealt RawDamage " .. TDI.RawDamage .. ", FinalDamage " .. TDI.FinalDamage .. " (that is, " .. (TDI.RawDamage - TDI.FinalDamage) .. " HPs covered by armor)");
end

View File

@ -6,6 +6,7 @@
Port=25565
MaxPlayers=100
Description=MCServer - in C++
DefaultViewDistance=9
[Worlds]
DefaultWorld=world
@ -15,6 +16,10 @@ DefaultWorld=world
; Plugin=DiamondMover
Plugin=Core
Plugin=ChunkWorx
Plugin=Debuggers
Plugin=HookNotify
Plugin=ChatLog
Plugin=DiamondMover
[HelpPlugin]
ShowPluginNames=1

View File

@ -699,14 +699,6 @@
RelativePath="..\source\WebAdmin.h"
>
</File>
<File
RelativePath="..\source\WebPlugin.cpp"
>
</File>
<File
RelativePath="..\source\WebPlugin.h"
>
</File>
<File
RelativePath="..\source\World.cpp"
>
@ -1551,6 +1543,14 @@
RelativePath="..\source\tolua_base.h"
>
</File>
<File
RelativePath="..\source\WebPlugin.cpp"
>
</File>
<File
RelativePath="..\source\WebPlugin.h"
>
</File>
<Filter
Name="Squirrel"
>

View File

@ -30,8 +30,8 @@
class cIniFile //tolua_export
{ //tolua_export
class cIniFile // tolua_export
{ // tolua_export
private:
bool caseInsensitive;
std::string path;
@ -46,64 +46,64 @@ private:
std::string CheckCase( std::string s) const;
public:
enum errors{ noID = -1}; //tolua_export
cIniFile( const std::string iniPath = ""); //tolua_export
enum errors{ noID = -1}; // tolua_export
cIniFile( const std::string iniPath = ""); // tolua_export
virtual ~cIniFile() {}
// Sets whether or not keynames and valuenames should be case sensitive.
// The default is case insensitive.
void CaseSensitive() {caseInsensitive = false;} //tolua_export
void CaseInsensitive() {caseInsensitive = true;} //tolua_export
void CaseSensitive() {caseInsensitive = false;} // tolua_export
void CaseInsensitive() {caseInsensitive = true;} // tolua_export
// Sets path of ini file to read and write from.
void Path(const std::string & newPath) {path = newPath;} //tolua_export
std::string Path() const {return path;} //tolua_export
void SetPath(const std::string & newPath) {Path( newPath);} //tolua_export
void Path(const std::string & newPath) {path = newPath;} // tolua_export
std::string Path() const {return path;} // tolua_export
void SetPath(const std::string & newPath) {Path( newPath);} // tolua_export
// Reads ini file specified using path.
// Returns true if successful, false otherwise.
bool ReadFile(); //tolua_export
bool ReadFile(); // tolua_export
// Writes data stored in class to ini file.
bool WriteFile(); //tolua_export
bool WriteFile(); // tolua_export
// Deletes all stored ini data.
void Erase(); //tolua_export
void Clear() {Erase();} //tolua_export
void Reset() {Erase();} //tolua_export
void Erase(); // tolua_export
void Clear() {Erase();} // tolua_export
void Reset() {Erase();} // tolua_export
// Returns index of specified key, or noID if not found.
long FindKey( const std::string & keyname) const; //tolua_export
long FindKey( const std::string & keyname) const; // tolua_export
// Returns index of specified value, in the specified key, or noID if not found.
long FindValue( const unsigned keyID, const std::string & valuename) const; //tolua_export
long FindValue( const unsigned keyID, const std::string & valuename) const; // tolua_export
// Returns number of keys currently in the ini.
unsigned NumKeys() const {return names.size();} //tolua_export
unsigned GetNumKeys() const {return NumKeys();} //tolua_export
unsigned NumKeys() const {return names.size();} // tolua_export
unsigned GetNumKeys() const {return NumKeys();} // tolua_export
// Add a key name.
unsigned AddKeyName( const std::string & keyname); //tolua_export
unsigned AddKeyName( const std::string & keyname); // tolua_export
// Returns key names by index.
std::string KeyName( const unsigned keyID) const; //tolua_export
std::string GetKeyName( const unsigned keyID) const {return KeyName(keyID);} //tolua_export
std::string KeyName( const unsigned keyID) const; // tolua_export
std::string GetKeyName( const unsigned keyID) const {return KeyName(keyID);} // tolua_export
// Returns number of values stored for specified key.
unsigned NumValues( const std::string & keyname); //tolua_export
unsigned GetNumValues( const std::string & keyname) {return NumValues( keyname);} //tolua_export
unsigned NumValues( const unsigned keyID); //tolua_export
unsigned GetNumValues( const unsigned keyID) {return NumValues( keyID);} //tolua_export
unsigned NumValues( const std::string & keyname); // tolua_export
unsigned GetNumValues( const std::string & keyname) {return NumValues( keyname);} // tolua_export
unsigned NumValues( const unsigned keyID); // tolua_export
unsigned GetNumValues( const unsigned keyID) {return NumValues( keyID);} // tolua_export
// Returns value name by index for a given keyname or keyID.
std::string ValueName( const std::string & keyname, const unsigned valueID) const; //tolua_export
std::string GetValueName( const std::string & keyname, const unsigned valueID) const { //tolua_export
std::string ValueName( const std::string & keyname, const unsigned valueID) const; // tolua_export
std::string GetValueName( const std::string & keyname, const unsigned valueID) const { // tolua_export
return ValueName( keyname, valueID);
} //tolua_export
std::string ValueName( const unsigned keyID, const unsigned valueID) const; //tolua_export
std::string GetValueName( const unsigned keyID, const unsigned valueID) const { //tolua_export
} // tolua_export
std::string ValueName( const unsigned keyID, const unsigned valueID) const; // tolua_export
std::string GetValueName( const unsigned keyID, const unsigned valueID) const { // tolua_export
return ValueName( keyID, valueID);
} //tolua_export
} // tolua_export
// Gets value of [keyname] valuename =.
// Overloaded to return string, int, and double.
@ -128,37 +128,37 @@ public:
// Specify the optional paramter as false (0) if you do not want it to create
// the key if it doesn't exist. Returns true if data entered, false otherwise.
// Overloaded to accept string, int, and double.
bool SetValue( const unsigned keyID, const unsigned valueID, const std::string & value); //tolua_export
bool SetValue( const std::string & keyname, const std::string & valuename, const std::string & value, const bool create = true); //tolua_export
bool SetValueI( const std::string & keyname, const std::string & valuename, const int value, const bool create = true); //tolua_export
bool SetValueB( const std::string & keyname, const std::string & valuename, const bool value, const bool create = true) { //tolua_export
bool SetValue( const unsigned keyID, const unsigned valueID, const std::string & value); // tolua_export
bool SetValue( const std::string & keyname, const std::string & valuename, const std::string & value, const bool create = true); // tolua_export
bool SetValueI( const std::string & keyname, const std::string & valuename, const int value, const bool create = true); // tolua_export
bool SetValueB( const std::string & keyname, const std::string & valuename, const bool value, const bool create = true) { // tolua_export
return SetValueI( keyname, valuename, int(value), create);
} //tolua_export
bool SetValueF( const std::string & keyname, const std::string & valuename, const double value, const bool create = true); //tolua_export
} // tolua_export
bool SetValueF( const std::string & keyname, const std::string & valuename, const double value, const bool create = true); // tolua_export
bool SetValueV( const std::string & keyname, const std::string & valuename, char *format, ...);
// Deletes specified value.
// Returns true if value existed and deleted, false otherwise.
bool DeleteValueByID( const unsigned keyID, const unsigned valueID ); //tolua_export
bool DeleteValue( const std::string & keyname, const std::string & valuename); //tolua_export
bool DeleteValueByID( const unsigned keyID, const unsigned valueID ); // tolua_export
bool DeleteValue( const std::string & keyname, const std::string & valuename); // tolua_export
// Deletes specified key and all values contained within.
// Returns true if key existed and deleted, false otherwise.
bool DeleteKey(const std::string & keyname); //tolua_export
bool DeleteKey(const std::string & keyname); // tolua_export
// Header comment functions.
// Header comments are those comments before the first key.
//
// Number of header comments.
unsigned NumHeaderComments() {return comments.size();} //tolua_export
unsigned NumHeaderComments() {return comments.size();} // tolua_export
// Add a header comment.
void HeaderComment( const std::string & comment); //tolua_export
void HeaderComment( const std::string & comment); // tolua_export
// Return a header comment.
std::string HeaderComment( const unsigned commentID) const; //tolua_export
std::string HeaderComment( const unsigned commentID) const; // tolua_export
// Delete a header comment.
bool DeleteHeaderComment( unsigned commentID); //tolua_export
bool DeleteHeaderComment( unsigned commentID); // tolua_export
// Delete all header comments.
void DeleteHeaderComments() {comments.clear();} //tolua_export
void DeleteHeaderComments() {comments.clear();} // tolua_export
// Key comment functions.
// Key comments are those comments within a key. Any comments
@ -167,20 +167,20 @@ public:
// the CIniFile::WriteFile() is called.
//
// Number of key comments.
unsigned NumKeyComments( const unsigned keyID) const; //tolua_export
unsigned NumKeyComments( const std::string & keyname) const; //tolua_export
unsigned NumKeyComments( const unsigned keyID) const; // tolua_export
unsigned NumKeyComments( const std::string & keyname) const; // tolua_export
// Add a key comment.
bool KeyComment( const unsigned keyID, const std::string & comment); //tolua_export
bool KeyComment( const std::string & keyname, const std::string & comment); //tolua_export
bool KeyComment( const unsigned keyID, const std::string & comment); // tolua_export
bool KeyComment( const std::string & keyname, const std::string & comment); // tolua_export
// Return a key comment.
std::string KeyComment( const unsigned keyID, const unsigned commentID) const; //tolua_export
std::string KeyComment( const std::string & keyname, const unsigned commentID) const; //tolua_export
std::string KeyComment( const unsigned keyID, const unsigned commentID) const; // tolua_export
std::string KeyComment( const std::string & keyname, const unsigned commentID) const; // tolua_export
// Delete a key comment.
bool DeleteKeyComment( const unsigned keyID, const unsigned commentID); //tolua_export
bool DeleteKeyComment( const std::string & keyname, const unsigned commentID); //tolua_export
bool DeleteKeyComment( const unsigned keyID, const unsigned commentID); // tolua_export
bool DeleteKeyComment( const std::string & keyname, const unsigned commentID); // tolua_export
// Delete all comments for a key.
bool DeleteKeyComments( const unsigned keyID); //tolua_export
bool DeleteKeyComments( const std::string & keyname); //tolua_export
}; //tolua_export
bool DeleteKeyComments( const unsigned keyID); // tolua_export
bool DeleteKeyComments( const std::string & keyname); // tolua_export
}; // tolua_export
#endif